💥 Switch all id to uuid
This commit is contained in:
@ -9,7 +9,7 @@ namespace DysonNetwork.Sphere.Account;
|
||||
[Index(nameof(Name), IsUnique = true)]
|
||||
public class Account : ModelBase
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
[MaxLength(256)] public string Name { get; set; } = string.Empty;
|
||||
[MaxLength(256)] public string Nick { get; set; } = string.Empty;
|
||||
[MaxLength(32)] public string Language { get; set; } = string.Empty;
|
||||
@ -30,7 +30,7 @@ public class Account : ModelBase
|
||||
|
||||
public class Profile : ModelBase
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
[MaxLength(256)] public string? FirstName { get; set; }
|
||||
[MaxLength(256)] public string? MiddleName { get; set; }
|
||||
[MaxLength(256)] public string? LastName { get; set; }
|
||||
@ -46,7 +46,7 @@ public class Profile : ModelBase
|
||||
|
||||
public class AccountContact : ModelBase
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public AccountContactType Type { get; set; }
|
||||
public Instant? VerifiedAt { get; set; }
|
||||
[MaxLength(1024)] public string Content { get; set; } = string.Empty;
|
||||
@ -63,9 +63,9 @@ public enum AccountContactType
|
||||
|
||||
public class AccountAuthFactor : ModelBase
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public AccountAuthFactorType Type { get; set; }
|
||||
public string? Secret { get; set; } = null;
|
||||
[MaxLength(8196)] public string? Secret { get; set; } = null;
|
||||
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
|
||||
|
@ -19,13 +19,13 @@ public class AccountEventService(
|
||||
private static readonly Random Random = new();
|
||||
private const string StatusCacheKey = "account_status_";
|
||||
|
||||
public void PurgeStatusCache(long userId)
|
||||
public void PurgeStatusCache(Guid userId)
|
||||
{
|
||||
var cacheKey = $"{StatusCacheKey}{userId}";
|
||||
cache.Remove(cacheKey);
|
||||
}
|
||||
|
||||
public async Task<Status> GetStatus(long userId)
|
||||
public async Task<Status> GetStatus(Guid userId)
|
||||
{
|
||||
var cacheKey = $"{StatusCacheKey}{userId}";
|
||||
if (cache.TryGetValue(cacheKey, out Status? cachedStatus))
|
||||
|
@ -14,6 +14,6 @@ public class Badge : ModelBase
|
||||
[Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } = new();
|
||||
public Instant? ExpiredAt { get; set; }
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
}
|
@ -22,7 +22,7 @@ public class Status : ModelBase
|
||||
[MaxLength(1024)] public string? Label { get; set; }
|
||||
public Instant? ClearedAt { get; set; }
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
public Account Account { get; set; } = null!;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class CheckInResult : ModelBase
|
||||
public CheckInResultLevel Level { get; set; }
|
||||
[Column(TypeName = "jsonb")] public ICollection<FortuneTip> Tips { get; set; } = new List<FortuneTip>();
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
public Account Account { get; set; } = null!;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,6 @@ public class MagicSpell : ModelBase
|
||||
public Instant? AffectedAt { get; set; }
|
||||
[Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; }
|
||||
|
||||
public long? AccountId { get; set; }
|
||||
public Guid? AccountId { get; set; }
|
||||
public Account? Account { get; set; }
|
||||
}
|
@ -17,7 +17,7 @@ public class Notification : ModelBase
|
||||
public int Priority { get; set; } = 10;
|
||||
public Instant? ViewedAt { get; set; }
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ public class NotificationPushSubscription : ModelBase
|
||||
public NotificationPushProvider Provider { get; set; }
|
||||
public Instant? LastUsedAt { get; set; }
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
}
|
@ -11,9 +11,9 @@ public enum RelationshipStatus
|
||||
|
||||
public class Relationship : ModelBase
|
||||
{
|
||||
public long AccountId { get; set; }
|
||||
public Guid AccountId { get; set; }
|
||||
public Account Account { get; set; } = null!;
|
||||
public long RelatedId { get; set; }
|
||||
public Guid RelatedId { get; set; }
|
||||
public Account Related { get; set; } = null!;
|
||||
|
||||
public Instant? ExpiredAt { get; set; }
|
||||
|
@ -124,9 +124,9 @@ public class RelationshipService(AppDatabase db, PermissionService pm, IMemoryCa
|
||||
return relationship;
|
||||
}
|
||||
|
||||
public async Task<List<long>> ListAccountFriends(Account account)
|
||||
public async Task<List<Guid>> ListAccountFriends(Account account)
|
||||
{
|
||||
if (!cache.TryGetValue($"UserFriends_{account.Id}", out List<long>? friends))
|
||||
if (!cache.TryGetValue($"UserFriends_{account.Id}", out List<Guid>? friends))
|
||||
{
|
||||
friends = await db.AccountRelationships
|
||||
.Where(r => r.RelatedId == account.Id)
|
||||
|
Reference in New Issue
Block a user