1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 10:02:47 -05:00

[SG-998] Move files to Vault folders (#2724)

* Move Api files

* Move Core files

* Move Infrastructure files

* Move Sql Files

* Move Api Sync files to Vault

* Move test vault files

* Update Sql.sqlproj paths

* Update Codeowners

* Fix vault file paths in sqlproj

* Update CipherDetails.sql path in sqlproj

* Update Core models and entities namespaces

* Update namespaces Core Services and Repositories

* Missed service namespaces

* Update Api namespaces

* Update Infrastructure namespaces

* Move infrastructure queries that were missed

* Tests namespace updates

* Admin and Events namespace updates

* Remove unused usings

* Remove extra CiphersController usings

* Rename folder

* Fix CipherDetails namespace

* Sqlproj fixes

* Move stored procs into folders by table

* using order fix
This commit is contained in:
Robyn MacCallum
2023-03-02 13:23:38 -05:00
committed by GitHub
parent 05f5d79938
commit 3289a8c35e
162 changed files with 375 additions and 267 deletions

View File

@ -0,0 +1,52 @@
using System.Text.Json.Serialization;
using Bit.Core.Models.Api;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Models.Data;
namespace Bit.Api.Vault.Models.Response;
public class AttachmentResponseModel : ResponseModel
{
public AttachmentResponseModel(AttachmentResponseData data) : base("attachment")
{
Id = data.Id;
Url = data.Url;
FileName = data.Data.FileName;
Key = data.Data.Key;
Size = data.Data.Size;
SizeName = CoreHelpers.ReadableBytesSize(data.Data.Size);
}
public AttachmentResponseModel(string id, CipherAttachment.MetaData data, Cipher cipher,
IGlobalSettings globalSettings)
: base("attachment")
{
Id = id;
Url = $"{globalSettings.Attachment.BaseUrl}/{cipher.Id}/{id}";
FileName = data.FileName;
Key = data.Key;
Size = data.Size;
SizeName = CoreHelpers.ReadableBytesSize(data.Size);
}
public string Id { get; set; }
public string Url { get; set; }
public string FileName { get; set; }
public string Key { get; set; }
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
public long Size { get; set; }
public string SizeName { get; set; }
public static IEnumerable<AttachmentResponseModel> FromCipher(Cipher cipher, IGlobalSettings globalSettings)
{
var attachments = cipher.GetAttachments();
if (attachments == null)
{
return null;
}
return attachments.Select(a => new AttachmentResponseModel(a.Key, a.Value, cipher, globalSettings));
}
}