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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user