mirror of
https://github.com/bitwarden/server
synced 2025-12-18 17:23:28 +00:00
move all models into core
This commit is contained in:
47
src/Core/Models/Api/Response/LoginResponseModel.cs
Normal file
47
src/Core/Models/Api/Response/LoginResponseModel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class LoginResponseModel : ResponseModel
|
||||
{
|
||||
public LoginResponseModel(Cipher cipher, Guid userId, string obj = "login")
|
||||
: base(obj)
|
||||
{
|
||||
if(cipher == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(cipher));
|
||||
}
|
||||
|
||||
if(cipher.Type != Core.Enums.CipherType.Login)
|
||||
{
|
||||
throw new ArgumentException(nameof(cipher.Type));
|
||||
}
|
||||
|
||||
var data = new LoginDataModel(cipher);
|
||||
|
||||
Id = cipher.Id.ToString();
|
||||
FolderId = cipher.FolderId?.ToString();
|
||||
Favorite = cipher.Favorite;
|
||||
Name = data.Name;
|
||||
Uri = data.Uri;
|
||||
Username = data.Username;
|
||||
Password = data.Password;
|
||||
Notes = data.Notes;
|
||||
RevisionDate = cipher.RevisionDate;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Favorite { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Uri { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public DateTime RevisionDate { get; set; }
|
||||
|
||||
// Expandables
|
||||
public FolderResponseModel Folder { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user