1
0
mirror of https://github.com/bitwarden/server synced 2025-12-21 18:53:41 +00:00
Files
server/src/Core/Models/EntityFramework/Cipher.cs
2020-01-10 18:54:44 -05:00

65 lines
1.5 KiB
C#

using System.Text.Json;
using AutoMapper;
namespace Bit.Core.Models.EntityFramework
{
public class Cipher : Table.Cipher
{
private JsonDocument _dataJson;
private JsonDocument _attachmentsJson;
private JsonDocument _favoritesJson;
private JsonDocument _foldersJson;
public User User { get; set; }
public Organization Organization { get; set; }
[IgnoreMap]
public JsonDocument DataJson
{
get => _dataJson;
set
{
Data = value?.ToString();
_dataJson = value;
}
}
[IgnoreMap]
public JsonDocument AttachmentsJson
{
get => _attachmentsJson;
set
{
Attachments = value?.ToString();
_attachmentsJson = value;
}
}
[IgnoreMap]
public JsonDocument FavoritesJson
{
get => _favoritesJson;
set
{
Favorites = value?.ToString();
_favoritesJson = value;
}
}
[IgnoreMap]
public JsonDocument FoldersJson
{
get => _foldersJson;
set
{
Folders = value?.ToString();
_foldersJson = value;
}
}
}
public class CipherMapperProfile : Profile
{
public CipherMapperProfile()
{
CreateMap<Table.Cipher, Cipher>().ReverseMap();
}
}
}