✨ Automated status meta
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Sdk Name="Aspire.AppHost.Sdk" Version="9.4.2"/>
|
||||
<Project Sdk="Microsoft.NET.Sdk/9.4.2;Aspire.AppHost.Sdk/9.4.2">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@@ -194,6 +194,7 @@ public class AccountController(
|
||||
public bool IsAutomated { get; set; } = false;
|
||||
[MaxLength(1024)] public string? Label { get; set; }
|
||||
[MaxLength(4096)] public string? AppIdentifier { get; set; }
|
||||
public Dictionary<string, object>? Meta { get; set; }
|
||||
public Instant? ClearedAt { get; set; }
|
||||
}
|
||||
|
||||
|
@@ -216,6 +216,7 @@ public class AccountCurrentController(
|
||||
status.IsAutomated = request.IsAutomated;
|
||||
status.Label = request.Label;
|
||||
status.AppIdentifier = request.AppIdentifier;
|
||||
status.Meta = request.Meta;
|
||||
status.ClearedAt = request.ClearedAt;
|
||||
|
||||
db.Update(status);
|
||||
@@ -245,6 +246,7 @@ public class AccountCurrentController(
|
||||
existingStatus.Attitude = request.Attitude;
|
||||
existingStatus.IsInvisible = request.IsInvisible;
|
||||
existingStatus.IsNotDisturb = request.IsNotDisturb;
|
||||
existingStatus.Meta = request.Meta;
|
||||
existingStatus.Label = request.Label;
|
||||
db.Update(existingStatus);
|
||||
await db.SaveChangesAsync();
|
||||
@@ -268,6 +270,7 @@ public class AccountCurrentController(
|
||||
IsNotDisturb = request.IsNotDisturb,
|
||||
IsAutomated = request.IsAutomated,
|
||||
Label = request.Label,
|
||||
Meta = request.Meta,
|
||||
AppIdentifier = request.AppIdentifier,
|
||||
ClearedAt = request.ClearedAt
|
||||
};
|
||||
@@ -287,7 +290,7 @@ public class AccountCurrentController(
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.AsQueryable();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(app))
|
||||
if (!string.IsNullOrWhiteSpace(app))
|
||||
queryable = queryable.Where(s => s.IsAutomated && s.AppIdentifier == app);
|
||||
|
||||
var status = await queryable
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using DysonNetwork.Shared.Data;
|
||||
using DysonNetwork.Shared.Proto;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.Protobuf;
|
||||
|
||||
@@ -22,6 +23,7 @@ public class Status : ModelBase
|
||||
public bool IsInvisible { get; set; }
|
||||
public bool IsNotDisturb { get; set; }
|
||||
[MaxLength(1024)] public string? Label { get; set; }
|
||||
[Column(TypeName = "jsonb")] public Dictionary<string, object>? Meta { get; set; }
|
||||
public Instant? ClearedAt { get; set; }
|
||||
[MaxLength(4096)] public string? AppIdentifier { get; set; }
|
||||
|
||||
@@ -50,6 +52,7 @@ public class Status : ModelBase
|
||||
IsInvisible = IsInvisible,
|
||||
IsNotDisturb = IsNotDisturb,
|
||||
Label = Label ?? string.Empty,
|
||||
Meta = GrpcTypeHelper.ConvertObjectToByteString(Meta),
|
||||
ClearedAt = ClearedAt?.ToTimestamp(),
|
||||
AccountId = AccountId.ToString()
|
||||
};
|
||||
@@ -74,6 +77,7 @@ public class Status : ModelBase
|
||||
IsInvisible = proto.IsInvisible,
|
||||
IsNotDisturb = proto.IsNotDisturb,
|
||||
Label = proto.Label,
|
||||
Meta = GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object>>(proto.Meta),
|
||||
ClearedAt = proto.ClearedAt?.ToInstant(),
|
||||
AccountId = Guid.Parse(proto.AccountId)
|
||||
};
|
||||
@@ -88,7 +92,8 @@ public enum CheckInResultLevel
|
||||
Worse,
|
||||
Normal,
|
||||
Better,
|
||||
Best
|
||||
Best,
|
||||
Special
|
||||
}
|
||||
|
||||
public class CheckInResult : ModelBase
|
||||
|
@@ -13,6 +13,7 @@ public class AccountStatusReference : ModelBase
|
||||
public bool IsInvisible { get; set; }
|
||||
public bool IsNotDisturb { get; set; }
|
||||
public string? Label { get; set; }
|
||||
public Dictionary<string, object>? Meta { get; set; }
|
||||
public Instant? ClearedAt { get; set; }
|
||||
|
||||
public Guid AccountId { get; set; }
|
||||
@@ -28,6 +29,7 @@ public class AccountStatusReference : ModelBase
|
||||
IsInvisible = IsInvisible,
|
||||
IsNotDisturb = IsNotDisturb,
|
||||
Label = Label ?? string.Empty,
|
||||
Meta = GrpcTypeHelper.ConvertObjectToByteString(Meta),
|
||||
ClearedAt = ClearedAt?.ToTimestamp(),
|
||||
AccountId = AccountId.ToString()
|
||||
};
|
||||
@@ -46,6 +48,7 @@ public class AccountStatusReference : ModelBase
|
||||
IsInvisible = proto.IsInvisible,
|
||||
IsNotDisturb = proto.IsNotDisturb,
|
||||
Label = proto.Label,
|
||||
Meta = GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object>>(proto.Meta),
|
||||
ClearedAt = proto.ClearedAt?.ToInstant(),
|
||||
AccountId = Guid.Parse(proto.AccountId)
|
||||
};
|
||||
|
@@ -56,6 +56,7 @@ message AccountStatus {
|
||||
google.protobuf.StringValue label = 7;
|
||||
google.protobuf.Timestamp cleared_at = 8;
|
||||
string account_id = 9;
|
||||
bytes meta = 10;
|
||||
}
|
||||
|
||||
// Profile contains detailed information about a user
|
||||
|
Reference in New Issue
Block a user