Files
server/src/Core/Models/EntityFramework/Cipher.cs

65 lines
1.5 KiB
C#
Raw Normal View History

2020-01-08 21:34:49 -05:00
using System.Text.Json;
using AutoMapper;
2020-01-08 20:28:16 -05:00
namespace Bit.Core.Models.EntityFramework
{
public class Cipher : Table.Cipher
{
2020-01-08 21:34:49 -05:00
private JsonDocument _dataJson;
private JsonDocument _attachmentsJson;
2020-01-10 18:54:44 -05:00
private JsonDocument _favoritesJson;
private JsonDocument _foldersJson;
2020-01-08 21:34:49 -05:00
2020-01-08 20:28:16 -05:00
public User User { get; set; }
2020-01-08 21:34:49 -05:00
public Organization Organization { get; set; }
[IgnoreMap]
2020-01-08 21:34:49 -05:00
public JsonDocument DataJson
{
get => _dataJson;
set
{
2020-01-10 18:54:44 -05:00
Data = value?.ToString();
2020-01-08 21:34:49 -05:00
_dataJson = value;
}
}
[IgnoreMap]
2020-01-08 21:34:49 -05:00
public JsonDocument AttachmentsJson
{
get => _attachmentsJson;
set
{
2020-01-10 18:54:44 -05:00
Attachments = value?.ToString();
2020-01-08 21:34:49 -05:00
_attachmentsJson = value;
}
}
2020-01-10 18:54:44 -05:00
[IgnoreMap]
public JsonDocument FavoritesJson
{
get => _favoritesJson;
set
{
Favorites = value?.ToString();
_favoritesJson = value;
}
}
[IgnoreMap]
public JsonDocument FoldersJson
{
get => _foldersJson;
set
{
Folders = value?.ToString();
_foldersJson = value;
}
}
2020-01-08 20:28:16 -05:00
}
public class CipherMapperProfile : Profile
{
public CipherMapperProfile()
{
2020-01-08 21:34:49 -05:00
CreateMap<Table.Cipher, Cipher>().ReverseMap();
2020-01-08 20:28:16 -05:00
}
}
}