1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

Folder APIs to new tables

This commit is contained in:
Kyle Spearrin
2017-03-18 11:35:41 -04:00
parent d7a1cd1ce3
commit 2b71420818
9 changed files with 84 additions and 76 deletions

View File

@ -13,19 +13,17 @@ namespace Bit.Core.Models.Api
[StringLength(300)]
public string Name { get; set; }
public Cipher ToCipher(Guid userId)
public Folder ToFolder(Guid userId)
{
return ToCipher(new Cipher
return ToFolder(new Folder
{
UserId = userId
});
}
public Cipher ToCipher(Cipher existingFolder)
public Folder ToFolder(Folder existingFolder)
{
existingFolder.Data = JsonConvert.SerializeObject(new FolderDataModel(this), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
existingFolder.Type = Core.Enums.CipherType.Folder;
existingFolder.Name = Name;
return existingFolder;
}
}