♻️ Finish centerlizing the data models
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.Protobuf;
|
||||
|
||||
namespace DysonNetwork.Shared.Models;
|
||||
|
||||
@@ -32,6 +33,21 @@ public class SnPermissionNode : ModelBase, IDisposable
|
||||
public Guid? GroupId { get; set; } = null;
|
||||
[JsonIgnore] public SnPermissionGroup? Group { get; set; } = null;
|
||||
|
||||
public Proto.PermissionNode ToProtoValue()
|
||||
{
|
||||
return new Proto.PermissionNode
|
||||
{
|
||||
Id = Id.ToString(),
|
||||
Actor = Actor,
|
||||
Area = Area,
|
||||
Key = Key,
|
||||
Value = Google.Protobuf.WellKnownTypes.Value.Parser.ParseJson(Value.RootElement.GetRawText()),
|
||||
ExpiredAt = ExpiredAt?.ToTimestamp(),
|
||||
AffectedAt = AffectedAt?.ToTimestamp(),
|
||||
GroupId = GroupId?.ToString() ?? string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Value.Dispose();
|
||||
|
Reference in New Issue
Block a user