♻️ Centralized data models (wip)
This commit is contained in:
34
DysonNetwork.Shared/Models/Relationship.cs
Normal file
34
DysonNetwork.Shared/Models/Relationship.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.Protobuf;
|
||||
|
||||
namespace DysonNetwork.Shared.Models;
|
||||
|
||||
public enum RelationshipStatus : short
|
||||
{
|
||||
Friends = 100,
|
||||
Pending = 0,
|
||||
Blocked = -100
|
||||
}
|
||||
|
||||
public class SnAccountRelationship : ModelBase
|
||||
{
|
||||
public Guid AccountId { get; set; }
|
||||
public SnAccount Account { get; set; } = null!;
|
||||
public Guid RelatedId { get; set; }
|
||||
public SnAccount Related { get; set; } = null!;
|
||||
|
||||
public Instant? ExpiredAt { get; set; }
|
||||
|
||||
public RelationshipStatus Status { get; set; } = RelationshipStatus.Pending;
|
||||
|
||||
public Proto.Relationship ToProtoValue() => new()
|
||||
{
|
||||
AccountId = AccountId.ToString(),
|
||||
RelatedId = RelatedId.ToString(),
|
||||
Account = Account.ToProtoValue(),
|
||||
Related = Related.ToProtoValue(),
|
||||
Status = (int)Status,
|
||||
CreatedAt = CreatedAt.ToTimestamp(),
|
||||
UpdatedAt = UpdatedAt.ToTimestamp()
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user