mirror of
https://github.com/bitwarden/server.git
synced 2025-07-05 10:02:47 -05:00
Move request/response models (#1754)
This commit is contained in:
12
src/Core/Models/Data/AttachmentResponseData.cs
Normal file
12
src/Core/Models/Data/AttachmentResponseData.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class AttachmentResponseData
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public CipherAttachment.MetaData Data { get; set; }
|
||||
public Cipher Cipher { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
@ -1,22 +1,9 @@
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class CipherCardData : CipherData
|
||||
{
|
||||
public CipherCardData() { }
|
||||
|
||||
public CipherCardData(CipherRequestModel cipher)
|
||||
: base(cipher)
|
||||
{
|
||||
CardholderName = cipher.Card.CardholderName;
|
||||
Brand = cipher.Card.Brand;
|
||||
Number = cipher.Card.Number;
|
||||
ExpMonth = cipher.Card.ExpMonth;
|
||||
ExpYear = cipher.Card.ExpYear;
|
||||
Code = cipher.Card.Code;
|
||||
}
|
||||
|
||||
public string CardholderName { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public string Number { get; set; }
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
@ -8,14 +6,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public CipherData() { }
|
||||
|
||||
public CipherData(CipherRequestModel cipher)
|
||||
{
|
||||
Name = cipher.Name;
|
||||
Notes = cipher.Notes;
|
||||
Fields = cipher.Fields?.Select(f => new CipherFieldData(f));
|
||||
PasswordHistory = cipher.PasswordHistory?.Select(ph => new CipherPasswordHistoryData(ph));
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public IEnumerable<CipherFieldData> Fields { get; set; }
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
@ -7,14 +6,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public CipherFieldData() { }
|
||||
|
||||
public CipherFieldData(CipherFieldModel field)
|
||||
{
|
||||
Type = field.Type;
|
||||
Name = field.Name;
|
||||
Value = field.Value;
|
||||
LinkedId = field.LinkedId ?? null;
|
||||
}
|
||||
|
||||
public FieldType Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
@ -1,34 +1,9 @@
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class CipherIdentityData : CipherData
|
||||
{
|
||||
public CipherIdentityData() { }
|
||||
|
||||
public CipherIdentityData(CipherRequestModel cipher)
|
||||
: base(cipher)
|
||||
{
|
||||
Title = cipher.Identity.Title;
|
||||
FirstName = cipher.Identity.FirstName;
|
||||
MiddleName = cipher.Identity.MiddleName;
|
||||
LastName = cipher.Identity.LastName;
|
||||
Address1 = cipher.Identity.Address1;
|
||||
Address2 = cipher.Identity.Address2;
|
||||
Address3 = cipher.Identity.Address3;
|
||||
City = cipher.Identity.City;
|
||||
State = cipher.Identity.State;
|
||||
PostalCode = cipher.Identity.PostalCode;
|
||||
Country = cipher.Identity.Country;
|
||||
Company = cipher.Identity.Company;
|
||||
Email = cipher.Identity.Email;
|
||||
Phone = cipher.Identity.Phone;
|
||||
SSN = cipher.Identity.SSN;
|
||||
Username = cipher.Identity.Username;
|
||||
PassportNumber = cipher.Identity.PassportNumber;
|
||||
LicenseNumber = cipher.Identity.LicenseNumber;
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string MiddleName { get; set; }
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
@ -12,17 +11,6 @@ namespace Bit.Core.Models.Data
|
||||
|
||||
public CipherLoginData() { }
|
||||
|
||||
public CipherLoginData(CipherRequestModel cipher)
|
||||
: base(cipher)
|
||||
{
|
||||
Uris = cipher.Login.Uris?.Where(u => u != null).Select(u => new CipherLoginUriData(u));
|
||||
Username = cipher.Login.Username;
|
||||
Password = cipher.Login.Password;
|
||||
PasswordRevisionDate = cipher.Login.PasswordRevisionDate;
|
||||
Totp = cipher.Login.Totp;
|
||||
AutofillOnPageLoad = cipher.Login.AutofillOnPageLoad;
|
||||
}
|
||||
|
||||
public string Uri
|
||||
{
|
||||
get => Uris?.FirstOrDefault()?.Uri ?? _uri;
|
||||
@ -39,12 +27,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public CipherLoginUriData() { }
|
||||
|
||||
public CipherLoginUriData(CipherLoginModel.CipherLoginUriModel uri)
|
||||
{
|
||||
Uri = uri.Uri;
|
||||
Match = uri.Match;
|
||||
}
|
||||
|
||||
public string Uri { get; set; }
|
||||
public UriMatchType? Match { get; set; } = null;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
@ -7,12 +6,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public CipherPasswordHistoryData() { }
|
||||
|
||||
public CipherPasswordHistoryData(CipherPasswordHistoryModel phModel)
|
||||
{
|
||||
Password = phModel.Password;
|
||||
LastUsedDate = phModel.LastUsedDate.Value;
|
||||
}
|
||||
|
||||
public string Password { get; set; }
|
||||
public DateTime LastUsedDate { get; set; }
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
@ -7,12 +6,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public CipherSecureNoteData() { }
|
||||
|
||||
public CipherSecureNoteData(CipherRequestModel cipher)
|
||||
: base(cipher)
|
||||
{
|
||||
Type = cipher.SecureNote.Type;
|
||||
}
|
||||
|
||||
public SecureNoteType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
12
src/Core/Models/Data/EmergencyAccessViewData.cs
Normal file
12
src/Core/Models/Data/EmergencyAccessViewData.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Models.Table;
|
||||
using Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class EmergencyAccessViewData
|
||||
{
|
||||
public EmergencyAccess EmergencyAccess { get; set; }
|
||||
public IEnumerable<CipherDetails> Ciphers { get; set; }
|
||||
}
|
||||
}
|
14
src/Core/Models/Data/OrganizationUserInviteData.cs
Normal file
14
src/Core/Models/Data/OrganizationUserInviteData.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class OrganizationUserInviteData
|
||||
{
|
||||
public IEnumerable<string> Emails { get; set; }
|
||||
public OrganizationUserType? Type { get; set; }
|
||||
public bool AccessAll { get; set; }
|
||||
public IEnumerable<SelectionReadOnly> Collections { get; set; }
|
||||
public Permissions Permissions { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +1,13 @@
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public abstract class SendData
|
||||
{
|
||||
public SendData() { }
|
||||
|
||||
public SendData(SendRequestModel send)
|
||||
public SendData(string name, string notes)
|
||||
{
|
||||
Name = send.Name;
|
||||
Notes = send.Notes;
|
||||
Name = name;
|
||||
Notes = notes;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Api;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
@ -10,8 +9,8 @@ namespace Bit.Core.Models.Data
|
||||
|
||||
public SendFileData() { }
|
||||
|
||||
public SendFileData(SendRequestModel send, string fileName)
|
||||
: base(send)
|
||||
public SendFileData(string name, string notes, string fileName)
|
||||
: base(name, notes)
|
||||
{
|
||||
FileName = fileName;
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class SendTextData : SendData
|
||||
{
|
||||
public SendTextData() { }
|
||||
|
||||
public SendTextData(SendRequestModel send)
|
||||
: base(send)
|
||||
public SendTextData(string name, string notes, string text, bool hidden)
|
||||
: base(name, notes)
|
||||
{
|
||||
Text = send.Text.Text;
|
||||
Hidden = send.Text.Hidden;
|
||||
Text = text;
|
||||
Hidden = hidden;
|
||||
}
|
||||
|
||||
public string Text { get; set; }
|
||||
|
Reference in New Issue
Block a user