1
0
mirror of https://github.com/bitwarden/server synced 2025-12-12 06:13:43 +00:00

cipher details create/update

This commit is contained in:
Kyle Spearrin
2017-03-18 23:41:46 -04:00
parent 3d5437e238
commit 26b553c248
16 changed files with 159 additions and 44 deletions

View File

@@ -1,32 +1,10 @@
using System;
using Bit.Core.Models.Table;
using Core.Models.Data;
namespace Bit.Core.Models.Api
{
public class CipherResponseModel : ResponseModel
{
public CipherResponseModel(Cipher cipher, string obj = "cipher")
: base(obj)
{
if(cipher == null)
{
throw new ArgumentNullException(nameof(cipher));
}
Id = cipher.Id.ToString();
Type = cipher.Type;
RevisionDate = cipher.RevisionDate;
switch(cipher.Type)
{
case Enums.CipherType.Login:
Data = new LoginDataModel(cipher);
break;
default:
throw new ArgumentException("Unsupported " + nameof(Type) + ".");
}
}
public CipherResponseModel(CipherDetails cipher, string obj = "cipher")
: base(obj)
{
@@ -38,6 +16,8 @@ namespace Bit.Core.Models.Api
Id = cipher.Id.ToString();
Type = cipher.Type;
RevisionDate = cipher.RevisionDate;
FolderId = cipher.FolderId?.ToString();
Favorite = cipher.Favorite;
switch(cipher.Type)
{