mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
refactored data storage to use cipher table. added history table and insert triggers.
This commit is contained in:
@ -1,21 +1,29 @@
|
||||
using System;
|
||||
using Bit.Core.Domains;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class FolderResponseModel : ResponseModel
|
||||
{
|
||||
public FolderResponseModel(Folder folder)
|
||||
public FolderResponseModel(Cipher cipher)
|
||||
: base("folder")
|
||||
{
|
||||
if(folder == null)
|
||||
if(cipher == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(folder));
|
||||
throw new ArgumentNullException(nameof(cipher));
|
||||
}
|
||||
|
||||
Id = folder.Id;
|
||||
Name = folder.Name;
|
||||
RevisionDate = folder.RevisionDate;
|
||||
if(cipher.Type != Core.Enums.CipherType.Folder)
|
||||
{
|
||||
throw new ArgumentException(nameof(cipher.Type));
|
||||
}
|
||||
|
||||
var data = JsonConvert.DeserializeObject<CipherDataModel>(cipher.Data);
|
||||
|
||||
Id = cipher.Id.ToString();
|
||||
Name = data.Name;
|
||||
RevisionDate = cipher.RevisionDate;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
|
Reference in New Issue
Block a user