Compare commits

..

No commits in common. "95768703736d08dc913123bb2d49901397658913" and "d1d4eb180fb74f3cd9fcfade9439ad65b0dfde5e" have entirely different histories.

54 changed files with 24209 additions and 801 deletions

View File

@ -9,7 +9,7 @@ namespace DysonNetwork.Sphere.Account;
[Index(nameof(Name), IsUnique = true)] [Index(nameof(Name), IsUnique = true)]
public class Account : ModelBase public class Account : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(256)] public string Name { get; set; } = string.Empty; [MaxLength(256)] public string Name { get; set; } = string.Empty;
[MaxLength(256)] public string Nick { get; set; } = string.Empty; [MaxLength(256)] public string Nick { get; set; } = string.Empty;
[MaxLength(32)] public string Language { 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 class Profile : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(256)] public string? FirstName { get; set; } [MaxLength(256)] public string? FirstName { get; set; }
[MaxLength(256)] public string? MiddleName { get; set; } [MaxLength(256)] public string? MiddleName { get; set; }
[MaxLength(256)] public string? LastName { get; set; } [MaxLength(256)] public string? LastName { get; set; }
@ -46,7 +46,7 @@ public class Profile : ModelBase
public class AccountContact : ModelBase public class AccountContact : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
public AccountContactType Type { get; set; } public AccountContactType Type { get; set; }
public Instant? VerifiedAt { get; set; } public Instant? VerifiedAt { get; set; }
[MaxLength(1024)] public string Content { get; set; } = string.Empty; [MaxLength(1024)] public string Content { get; set; } = string.Empty;
@ -63,9 +63,9 @@ public enum AccountContactType
public class AccountAuthFactor : ModelBase public class AccountAuthFactor : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
public AccountAuthFactorType Type { get; set; } public AccountAuthFactorType Type { get; set; }
[MaxLength(8196)] public string? Secret { get; set; } = null; public string? Secret { get; set; } = null;
[JsonIgnore] public Account Account { get; set; } = null!; [JsonIgnore] public Account Account { get; set; } = null!;

View File

@ -34,19 +34,6 @@ public class AccountController(
return account is null ? new NotFoundResult() : account; return account is null ? new NotFoundResult() : account;
} }
[HttpGet("{name}/badges")]
[ProducesResponseType<List<Badge>>(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<List<Badge>>> GetBadgesByName(string name)
{
var account = await db.Accounts
.Include(e => e.Badges)
.Where(a => a.Name == name)
.FirstOrDefaultAsync();
return account is null ? NotFound() : account.Badges.ToList();
}
public class AccountCreateRequest public class AccountCreateRequest
{ {
[Required] [MaxLength(256)] public string Name { get; set; } = string.Empty; [Required] [MaxLength(256)] public string Name { get; set; } = string.Empty;

View File

@ -19,13 +19,13 @@ public class AccountEventService(
private static readonly Random Random = new(); private static readonly Random Random = new();
private const string StatusCacheKey = "account_status_"; private const string StatusCacheKey = "account_status_";
public void PurgeStatusCache(Guid userId) public void PurgeStatusCache(long userId)
{ {
var cacheKey = $"{StatusCacheKey}{userId}"; var cacheKey = $"{StatusCacheKey}{userId}";
cache.Remove(cacheKey); cache.Remove(cacheKey);
} }
public async Task<Status> GetStatus(Guid userId) public async Task<Status> GetStatus(long userId)
{ {
var cacheKey = $"{StatusCacheKey}{userId}"; var cacheKey = $"{StatusCacheKey}{userId}";
if (cache.TryGetValue(cacheKey, out Status? cachedStatus)) if (cache.TryGetValue(cacheKey, out Status? cachedStatus))

View File

@ -14,6 +14,6 @@ public class Badge : ModelBase
[Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } = new(); [Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } = new();
public Instant? ExpiredAt { get; set; } public Instant? ExpiredAt { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account Account { get; set; } = null!; [JsonIgnore] public Account Account { get; set; } = null!;
} }

View File

@ -22,7 +22,7 @@ public class Status : ModelBase
[MaxLength(1024)] public string? Label { get; set; } [MaxLength(1024)] public string? Label { get; set; }
public Instant? ClearedAt { get; set; } public Instant? ClearedAt { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account Account { get; set; } = null!; public Account Account { get; set; } = null!;
} }
@ -41,7 +41,7 @@ public class CheckInResult : ModelBase
public CheckInResultLevel Level { get; set; } public CheckInResultLevel Level { get; set; }
[Column(TypeName = "jsonb")] public ICollection<FortuneTip> Tips { get; set; } = new List<FortuneTip>(); [Column(TypeName = "jsonb")] public ICollection<FortuneTip> Tips { get; set; } = new List<FortuneTip>();
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account Account { get; set; } = null!; public Account Account { get; set; } = null!;
} }

View File

@ -25,6 +25,6 @@ public class MagicSpell : ModelBase
public Instant? AffectedAt { get; set; } public Instant? AffectedAt { get; set; }
[Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } [Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; }
public Guid? AccountId { get; set; } public long? AccountId { get; set; }
public Account? Account { get; set; } public Account? Account { get; set; }
} }

View File

@ -17,7 +17,7 @@ public class Notification : ModelBase
public int Priority { get; set; } = 10; public int Priority { get; set; } = 10;
public Instant? ViewedAt { get; set; } public Instant? ViewedAt { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account Account { get; set; } = null!; [JsonIgnore] public Account Account { get; set; } = null!;
} }
@ -37,6 +37,6 @@ public class NotificationPushSubscription : ModelBase
public NotificationPushProvider Provider { get; set; } public NotificationPushProvider Provider { get; set; }
public Instant? LastUsedAt { get; set; } public Instant? LastUsedAt { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account Account { get; set; } = null!; [JsonIgnore] public Account Account { get; set; } = null!;
} }

View File

@ -11,9 +11,9 @@ public enum RelationshipStatus
public class Relationship : ModelBase public class Relationship : ModelBase
{ {
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account Account { get; set; } = null!; public Account Account { get; set; } = null!;
public Guid RelatedId { get; set; } public long RelatedId { get; set; }
public Account Related { get; set; } = null!; public Account Related { get; set; } = null!;
public Instant? ExpiredAt { get; set; } public Instant? ExpiredAt { get; set; }

View File

@ -124,9 +124,9 @@ public class RelationshipService(AppDatabase db, PermissionService pm, IMemoryCa
return relationship; return relationship;
} }
public async Task<List<Guid>> ListAccountFriends(Account account) public async Task<List<long>> ListAccountFriends(Account account)
{ {
if (!cache.TryGetValue($"UserFriends_{account.Id}", out List<Guid>? friends)) if (!cache.TryGetValue($"UserFriends_{account.Id}", out List<long>? friends))
{ {
friends = await db.AccountRelationships friends = await db.AccountRelationships
.Where(r => r.RelatedId == account.Id) .Where(r => r.RelatedId == account.Id)

View File

@ -17,9 +17,9 @@ public class Activity : ModelBase
[MaxLength(4096)] public string ResourceIdentifier { get; set; } = null!; [MaxLength(4096)] public string ResourceIdentifier { get; set; } = null!;
public ActivityVisibility Visibility { get; set; } = ActivityVisibility.Public; public ActivityVisibility Visibility { get; set; } = ActivityVisibility.Public;
[Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } = new(); [Column(TypeName = "jsonb")] public Dictionary<string, object> Meta { get; set; } = new();
[Column(TypeName = "jsonb")] public ICollection<Guid> UsersVisible { get; set; } = new List<Guid>(); [Column(TypeName = "jsonb")] public ICollection<long> UsersVisible { get; set; } = new List<long>();
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account.Account Account { get; set; } = null!; public Account.Account Account { get; set; } = null!;
[NotMapped] public object? Data { get; set; } [NotMapped] public object? Data { get; set; }

View File

@ -1,18 +1,19 @@
using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Post;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NodaTime;
namespace DysonNetwork.Sphere.Activity; namespace DysonNetwork.Sphere.Activity;
public class ActivityReaderService(AppDatabase db, PostService ps) public class ActivityReaderService(AppDatabase db, PostService ps)
{ {
public async Task<List<Activity>> LoadActivityData(List<Activity> input, Account.Account? currentUser, public async Task<List<Activity>> LoadActivityData(List<Activity> input, Account.Account? currentUser,
List<Guid> userFriends) List<long> userFriends)
{ {
if (input.Count == 0) return input; if (input.Count == 0) return input;
var postsId = input var postsId = input
.Where(e => e.ResourceIdentifier.StartsWith("posts/")) .Where(e => e.ResourceIdentifier.StartsWith("posts/"))
.Select(e => Guid.Parse(e.ResourceIdentifier.Split("/").Last())) .Select(e => long.Parse(e.ResourceIdentifier.Split("/").Last()))
.Distinct() .Distinct()
.ToList(); .ToList();
if (postsId.Count > 0) if (postsId.Count > 0)
@ -39,7 +40,7 @@ public class ActivityReaderService(AppDatabase db, PostService ps)
{ {
var resourceIdentifier = item.ResourceIdentifier; var resourceIdentifier = item.ResourceIdentifier;
if (!resourceIdentifier.StartsWith("posts/")) continue; if (!resourceIdentifier.StartsWith("posts/")) continue;
var postId = Guid.Parse(resourceIdentifier.Split("/").Last()); var postId = long.Parse(resourceIdentifier.Split("/").Last());
if (postsDict.TryGetValue(postId, out var post) && item.Data is null) if (postsDict.TryGetValue(postId, out var post) && item.Data is null)
{ {
item.Data = post; item.Data = post;
@ -108,7 +109,7 @@ public class ActivityService(AppDatabase db)
string type, string type,
string identifier, string identifier,
ActivityVisibility visibility = ActivityVisibility.Public, ActivityVisibility visibility = ActivityVisibility.Public,
List<Guid>? visibleUsers = null List<long>? visibleUsers = null
) )
{ {
var activity = new Activity var activity = new Activity
@ -157,7 +158,7 @@ public class ActivityService(AppDatabase db)
public static class ActivityQueryExtensions public static class ActivityQueryExtensions
{ {
public static IQueryable<Activity> FilterWithVisibility(this IQueryable<Activity> source, public static IQueryable<Activity> FilterWithVisibility(this IQueryable<Activity> source,
Account.Account? currentUser, List<Guid> userFriends) Account.Account? currentUser, List<long> userFriends)
{ {
if (currentUser is null) if (currentUser is null)
return source.Where(e => e.Visibility == ActivityVisibility.Public); return source.Where(e => e.Visibility == ActivityVisibility.Public);

View File

@ -78,8 +78,8 @@ public class AuthController(
: challenge.Account.AuthFactors.ToList(); : challenge.Account.AuthFactors.ToList();
} }
[HttpPost("challenge/{id}/factors/{factorId:guid}")] [HttpPost("challenge/{id}/factors/{factorId:long}")]
public async Task<ActionResult> RequestFactorCode([FromRoute] Guid id, [FromRoute] Guid factorId) public async Task<ActionResult> RequestFactorCode([FromRoute] Guid id, [FromRoute] long factorId)
{ {
var challenge = await db.AuthChallenges var challenge = await db.AuthChallenges
.Include(e => e.Account) .Include(e => e.Account)

View File

@ -43,7 +43,7 @@ public class Challenge : ModelBase
public int FailedAttempts { get; set; } public int FailedAttempts { get; set; }
public ChallengePlatform Platform { get; set; } = ChallengePlatform.Unidentified; public ChallengePlatform Platform { get; set; } = ChallengePlatform.Unidentified;
public ChallengeType Type { get; set; } = ChallengeType.Login; public ChallengeType Type { get; set; } = ChallengeType.Login;
[Column(TypeName = "jsonb")] public List<Guid> BlacklistFactors { get; set; } = new(); [Column(TypeName = "jsonb")] public List<long> BlacklistFactors { get; set; } = new();
[Column(TypeName = "jsonb")] public List<string> Audiences { get; set; } = new(); [Column(TypeName = "jsonb")] public List<string> Audiences { get; set; } = new();
[Column(TypeName = "jsonb")] public List<string> Scopes { get; set; } = new(); [Column(TypeName = "jsonb")] public List<string> Scopes { get; set; } = new();
[MaxLength(128)] public string? IpAddress { get; set; } [MaxLength(128)] public string? IpAddress { get; set; }
@ -51,7 +51,7 @@ public class Challenge : ModelBase
[MaxLength(256)] public string? DeviceId { get; set; } [MaxLength(256)] public string? DeviceId { get; set; }
[MaxLength(1024)] public string? Nonce { get; set; } [MaxLength(1024)] public string? Nonce { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account.Account Account { get; set; } = null!; [JsonIgnore] public Account.Account Account { get; set; } = null!;
public Challenge Normalize() public Challenge Normalize()

View File

@ -16,7 +16,7 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
public class MarkMessageReadRequest public class MarkMessageReadRequest
{ {
public Guid MessageId { get; set; } public Guid MessageId { get; set; }
public Guid ChatRoomId { get; set; } public long ChatRoomId { get; set; }
} }
public class SendMessageRequest public class SendMessageRequest
@ -29,8 +29,8 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
public Guid? ForwardedMessageId { get; set; } public Guid? ForwardedMessageId { get; set; }
} }
[HttpGet("{roomId:guid}/messages")] [HttpGet("{roomId:long}/messages")]
public async Task<ActionResult<List<Message>>> ListMessages(Guid roomId, [FromQuery] int offset, [FromQuery] int take = 20) public async Task<ActionResult<List<Message>>> ListMessages(long roomId, [FromQuery] int offset, [FromQuery] int take = 20)
{ {
var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; var currentUser = HttpContext.Items["CurrentUser"] as Account.Account;
@ -67,8 +67,8 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
return Ok(messages); return Ok(messages);
} }
[HttpGet("{roomId:guid}/messages/{messageId:guid}")] [HttpGet("{roomId:long}/messages/{messageId:guid}")]
public async Task<ActionResult<Message>> GetMessage(Guid roomId, Guid messageId) public async Task<ActionResult<Message>> GetMessage(long roomId, Guid messageId)
{ {
var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; var currentUser = HttpContext.Items["CurrentUser"] as Account.Account;
@ -104,10 +104,10 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
[GeneratedRegex("@([A-Za-z0-9_-]+)")] [GeneratedRegex("@([A-Za-z0-9_-]+)")]
private static partial Regex MentionRegex(); private static partial Regex MentionRegex();
[HttpPost("{roomId:guid}/messages")] [HttpPost("{roomId:long}/messages")]
[Authorize] [Authorize]
[RequiredPermission("global", "chat.messages.create")] [RequiredPermission("global", "chat.messages.create")]
public async Task<ActionResult> SendMessage([FromBody] SendMessageRequest request, Guid roomId) public async Task<ActionResult> SendMessage([FromBody] SendMessageRequest request, long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
if (string.IsNullOrWhiteSpace(request.Content) && (request.AttachmentsId == null || request.AttachmentsId.Count == 0)) if (string.IsNullOrWhiteSpace(request.Content) && (request.AttachmentsId == null || request.AttachmentsId.Count == 0))
@ -185,9 +185,9 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
[HttpPatch("{roomId:guid}/messages/{messageId:guid}")] [HttpPatch("{roomId:long}/messages/{messageId:guid}")]
[Authorize] [Authorize]
public async Task<ActionResult> UpdateMessage([FromBody] SendMessageRequest request, Guid roomId, Guid messageId) public async Task<ActionResult> UpdateMessage([FromBody] SendMessageRequest request, long roomId, Guid messageId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -254,9 +254,9 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
return Ok(message); return Ok(message);
} }
[HttpDelete("{roomId:guid}/messages/{messageId:guid}")] [HttpDelete("{roomId:long}/messages/{messageId:guid}")]
[Authorize] [Authorize]
public async Task<ActionResult> DeleteMessage(Guid roomId, Guid messageId) public async Task<ActionResult> DeleteMessage(long roomId, Guid messageId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -280,8 +280,8 @@ public partial class ChatController(AppDatabase db, ChatService cs) : Controller
public long LastSyncTimestamp { get; set; } public long LastSyncTimestamp { get; set; }
} }
[HttpPost("{roomId:guid}/sync")] [HttpPost("{roomId:long}/sync")]
public async Task<ActionResult<SyncResponse>> GetSyncData([FromBody] SyncRequest request, Guid roomId) public async Task<ActionResult<SyncResponse>> GetSyncData([FromBody] SyncRequest request, long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser)
return Unauthorized(); return Unauthorized();

View File

@ -14,7 +14,7 @@ public enum ChatRoomType
public class ChatRoom : ModelBase public class ChatRoom : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(1024)] public string Name { get; set; } = string.Empty; [MaxLength(1024)] public string Name { get; set; } = string.Empty;
[MaxLength(4096)] public string Description { get; set; } = string.Empty; [MaxLength(4096)] public string Description { get; set; } = string.Empty;
public ChatRoomType Type { get; set; } public ChatRoomType Type { get; set; }
@ -27,7 +27,7 @@ public class ChatRoom : ModelBase
[JsonIgnore] public ICollection<ChatMember> Members { get; set; } = new List<ChatMember>(); [JsonIgnore] public ICollection<ChatMember> Members { get; set; } = new List<ChatMember>();
public Guid? RealmId { get; set; } public long? RealmId { get; set; }
public Realm.Realm? Realm { get; set; } public Realm.Realm? Realm { get; set; }
[NotMapped] [NotMapped]
@ -53,9 +53,9 @@ public enum ChatMemberNotify
public class ChatMember : ModelBase public class ChatMember : ModelBase
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid ChatRoomId { get; set; } public long ChatRoomId { get; set; }
public ChatRoom ChatRoom { get; set; } = null!; public ChatRoom ChatRoom { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account.Account Account { get; set; } = null!; public Account.Account Account { get; set; } = null!;
[MaxLength(1024)] public string? Nick { get; set; } [MaxLength(1024)] public string? Nick { get; set; }
@ -69,8 +69,8 @@ public class ChatMember : ModelBase
public class ChatMemberTransmissionObject : ModelBase public class ChatMemberTransmissionObject : ModelBase
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid ChatRoomId { get; set; } public long ChatRoomId { get; set; }
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account.Account Account { get; set; } = null!; public Account.Account Account { get; set; } = null!;
[MaxLength(1024)] public string? Nick { get; set; } [MaxLength(1024)] public string? Nick { get; set; }

View File

@ -12,8 +12,8 @@ namespace DysonNetwork.Sphere.Chat;
[Route("/chat")] [Route("/chat")]
public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService crs) : ControllerBase public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService crs) : ControllerBase
{ {
[HttpGet("{id:guid}")] [HttpGet("{id:long}")]
public async Task<ActionResult<ChatRoom>> GetChatRoom(Guid id) public async Task<ActionResult<ChatRoom>> GetChatRoom(long id)
{ {
var chatRoom = await db.ChatRooms var chatRoom = await db.ChatRooms
.Where(c => c.Id == id) .Where(c => c.Id == id)
@ -59,7 +59,7 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
.Include(m => m.Account) .Include(m => m.Account)
.Include(m => m.Account.Profile) .Include(m => m.Account.Profile)
.ToDictionaryAsync(m => m.ChatRoomId, m => m) .ToDictionaryAsync(m => m.ChatRoomId, m => m)
: new Dictionary<Guid, ChatMember>(); : new Dictionary<long, ChatMember>();
// Map the results // Map the results
var result = chatRooms.Select(r => var result = chatRooms.Select(r =>
@ -75,7 +75,7 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
public class DirectMessageRequest public class DirectMessageRequest
{ {
[Required] public Guid RelatedUserId { get; set; } [Required] public long RelatedUserId { get; set; }
} }
[HttpPost("direct")] [HttpPost("direct")]
@ -139,7 +139,7 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
[MaxLength(4096)] public string? Description { get; set; } [MaxLength(4096)] public string? Description { get; set; }
public string? PictureId { get; set; } public string? PictureId { get; set; }
public string? BackgroundId { get; set; } public string? BackgroundId { get; set; }
public Guid? RealmId { get; set; } public long? RealmId { get; set; }
} }
[HttpPost] [HttpPost]
@ -202,8 +202,8 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
} }
[HttpPatch("{id:guid}")] [HttpPatch("{id:long}")]
public async Task<ActionResult<ChatRoom>> UpdateChatRoom(Guid id, [FromBody] ChatRoomRequest request) public async Task<ActionResult<ChatRoom>> UpdateChatRoom(long id, [FromBody] ChatRoomRequest request)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -273,8 +273,8 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return Ok(chatRoom); return Ok(chatRoom);
} }
[HttpDelete("{id:guid}")] [HttpDelete("{id:long}")]
public async Task<ActionResult> DeleteChatRoom(Guid id) public async Task<ActionResult> DeleteChatRoom(long id)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -315,9 +315,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return NoContent(); return NoContent();
} }
[HttpGet("{roomId:guid}/members/me")] [HttpGet("{roomId:long}/members/me")]
[Authorize] [Authorize]
public async Task<ActionResult<ChatMember>> GetRoomIdentity(Guid roomId) public async Task<ActionResult<ChatMember>> GetRoomIdentity(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser)
return Unauthorized(); return Unauthorized();
@ -334,8 +334,8 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return Ok(member); return Ok(member);
} }
[HttpGet("{roomId:guid}/members")] [HttpGet("{roomId:long}/members")]
public async Task<ActionResult<List<ChatMember>>> ListMembers(Guid roomId, [FromQuery] int take = 20, public async Task<ActionResult<List<ChatMember>>> ListMembers(long roomId, [FromQuery] int take = 20,
[FromQuery] int skip = 0) [FromQuery] int skip = 0)
{ {
var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; var currentUser = HttpContext.Items["CurrentUser"] as Account.Account;
@ -371,13 +371,13 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
public class ChatMemberRequest public class ChatMemberRequest
{ {
[Required] public Guid RelatedUserId { get; set; } [Required] public long RelatedUserId { get; set; }
[Required] public ChatMemberRole Role { get; set; } [Required] public ChatMemberRole Role { get; set; }
} }
[HttpPost("invites/{roomId:guid}")] [HttpPost("invites/{roomId:long}")]
[Authorize] [Authorize]
public async Task<ActionResult<ChatMember>> InviteMember(Guid roomId, public async Task<ActionResult<ChatMember>> InviteMember(long roomId,
[FromBody] ChatMemberRequest request) [FromBody] ChatMemberRequest request)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -448,9 +448,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return members.ToList(); return members.ToList();
} }
[HttpPost("invites/{roomId:guid}/accept")] [HttpPost("invites/{roomId:long}/accept")]
[Authorize] [Authorize]
public async Task<ActionResult<ChatRoom>> AcceptChatInvite(Guid roomId) public async Task<ActionResult<ChatRoom>> AcceptChatInvite(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
var userId = currentUser.Id; var userId = currentUser.Id;
@ -469,9 +469,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return Ok(member); return Ok(member);
} }
[HttpPost("invites/{roomId:guid}/decline")] [HttpPost("invites/{roomId:long}/decline")]
[Authorize] [Authorize]
public async Task<ActionResult> DeclineChatInvite(Guid roomId) public async Task<ActionResult> DeclineChatInvite(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
var userId = currentUser.Id; var userId = currentUser.Id;
@ -489,9 +489,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return NoContent(); return NoContent();
} }
[HttpPatch("{roomId:guid}/members/{memberId:guid}/role")] [HttpPatch("{roomId:long}/members/{memberId:long}/role")]
[Authorize] [Authorize]
public async Task<ActionResult<ChatMember>> UpdateChatMemberRole(Guid roomId, Guid memberId, public async Task<ActionResult<ChatMember>> UpdateChatMemberRole(long roomId, long memberId,
[FromBody] ChatMemberRequest request) [FromBody] ChatMemberRequest request)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -542,9 +542,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return BadRequest(); return BadRequest();
} }
[HttpDelete("{roomId:guid}/members/{memberId:guid}")] [HttpDelete("{roomId:long}/members/{memberId:long}")]
[Authorize] [Authorize]
public async Task<ActionResult> RemoveChatMember(Guid roomId, Guid memberId) public async Task<ActionResult> RemoveChatMember(long roomId, long memberId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -591,9 +591,9 @@ public class ChatRoomController(AppDatabase db, FileService fs, ChatRoomService
return BadRequest(); return BadRequest();
} }
[HttpDelete("{roomId:guid}/members/me")] [HttpDelete("{roomId:long}/members/me")]
[Authorize] [Authorize]
public async Task<ActionResult> LeaveChat(Guid roomId) public async Task<ActionResult> LeaveChat(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();

View File

@ -59,7 +59,7 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
await Task.WhenAll(tasks); await Task.WhenAll(tasks);
} }
public async Task MarkMessageAsReadAsync(Guid messageId, Guid roomId, Guid userId) public async Task MarkMessageAsReadAsync(Guid messageId, long roomId, long userId)
{ {
var existingStatus = await db.ChatStatuses var existingStatus = await db.ChatStatuses
.FirstOrDefaultAsync(x => x.MessageId == messageId && x.Sender.AccountId == userId); .FirstOrDefaultAsync(x => x.MessageId == messageId && x.Sender.AccountId == userId);
@ -81,13 +81,13 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
await db.SaveChangesAsync(); await db.SaveChangesAsync();
} }
public async Task<bool> GetMessageReadStatus(Guid messageId, Guid userId) public async Task<bool> GetMessageReadStatus(Guid messageId, long userId)
{ {
return await db.ChatStatuses return await db.ChatStatuses
.AnyAsync(x => x.MessageId == messageId && x.Sender.AccountId == userId); .AnyAsync(x => x.MessageId == messageId && x.Sender.AccountId == userId);
} }
public async Task<int> CountUnreadMessage(Guid userId, Guid chatRoomId) public async Task<int> CountUnreadMessage(long userId, long chatRoomId)
{ {
var messages = await db.ChatMessages var messages = await db.ChatMessages
.Where(m => m.ChatRoomId == chatRoomId) .Where(m => m.ChatRoomId == chatRoomId)
@ -101,7 +101,7 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
return messages.Count(m => !m.IsRead); return messages.Count(m => !m.IsRead);
} }
public async Task<Dictionary<Guid, int>> CountUnreadMessagesForJoinedRoomsAsync(Guid userId) public async Task<Dictionary<long, int>> CountUnreadMessagesForJoinedRoomsAsync(long userId)
{ {
var userRooms = await db.ChatMembers var userRooms = await db.ChatMembers
.Where(m => m.AccountId == userId) .Where(m => m.AccountId == userId)
@ -149,7 +149,7 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
return call; return call;
} }
public async Task EndCallAsync(Guid roomId) public async Task EndCallAsync(long roomId)
{ {
var call = await GetCallOngoingAsync(roomId); var call = await GetCallOngoingAsync(roomId);
if (call is null) throw new InvalidOperationException("No ongoing call was not found."); if (call is null) throw new InvalidOperationException("No ongoing call was not found.");
@ -170,7 +170,7 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
}, call.Sender, call.Room); }, call.Sender, call.Room);
} }
public async Task<RealtimeCall?> GetCallOngoingAsync(Guid roomId) public async Task<RealtimeCall?> GetCallOngoingAsync(long roomId)
{ {
return await db.ChatRealtimeCall return await db.ChatRealtimeCall
.Where(c => c.RoomId == roomId) .Where(c => c.RoomId == roomId)
@ -180,7 +180,7 @@ public class ChatService(AppDatabase db, IServiceScopeFactory scopeFactory)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
public async Task<SyncResponse> GetSyncDataAsync(Guid roomId, long lastSyncTimestamp) public async Task<SyncResponse> GetSyncDataAsync(long roomId, long lastSyncTimestamp)
{ {
var timestamp = Instant.FromUnixTimeMilliseconds(lastSyncTimestamp); var timestamp = Instant.FromUnixTimeMilliseconds(lastSyncTimestamp);
var changes = await db.ChatMessages var changes = await db.ChatMessages

View File

@ -27,7 +27,7 @@ public class Message : ModelBase
public Guid SenderId { get; set; } public Guid SenderId { get; set; }
public ChatMember Sender { get; set; } = null!; public ChatMember Sender { get; set; } = null!;
public Guid ChatRoomId { get; set; } public long ChatRoomId { get; set; }
[JsonIgnore] public ChatRoom ChatRoom { get; set; } = null!; [JsonIgnore] public ChatRoom ChatRoom { get; set; } = null!;
public Message Clone() public Message Clone()

View File

@ -10,6 +10,6 @@ public class RealtimeCall : ModelBase
public Guid SenderId { get; set; } public Guid SenderId { get; set; }
public ChatMember Sender { get; set; } = null!; public ChatMember Sender { get; set; } = null!;
public Guid RoomId { get; set; } public long RoomId { get; set; }
public ChatRoom Room { get; set; } = null!; public ChatRoom Room { get; set; } = null!;
} }

View File

@ -32,9 +32,9 @@ public class RealtimeCallController(IConfiguration configuration, AppDatabase db
public string Token { get; set; } = null!; public string Token { get; set; } = null!;
} }
[HttpGet("{roomId:guid}")] [HttpGet("{roomId:long}")]
[Authorize] [Authorize]
public async Task<ActionResult<RealtimeChatToken>> GetToken(Guid roomId) public async Task<ActionResult<RealtimeChatToken>> GetToken(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -60,9 +60,9 @@ public class RealtimeCallController(IConfiguration configuration, AppDatabase db
}); });
} }
[HttpPost("{roomId:guid}")] [HttpPost("{roomId:long}")]
[Authorize] [Authorize]
public async Task<IActionResult> StartCall(Guid roomId) public async Task<IActionResult> StartCall(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -79,9 +79,9 @@ public class RealtimeCallController(IConfiguration configuration, AppDatabase db
return Ok(call); return Ok(call);
} }
[HttpDelete("{roomId:guid}")] [HttpDelete("{roomId:long}")]
[Authorize] [Authorize]
public async Task<IActionResult> EndCall(Guid roomId) public async Task<IActionResult> EndCall(long roomId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();

View File

@ -13,12 +13,12 @@ public class WebSocketService
} }
private static readonly ConcurrentDictionary< private static readonly ConcurrentDictionary<
(Guid AccountId, string DeviceId), (long AccountId, string DeviceId),
(WebSocket Socket, CancellationTokenSource Cts) (WebSocket Socket, CancellationTokenSource Cts)
> ActiveConnections = new(); > ActiveConnections = new();
public bool TryAdd( public bool TryAdd(
(Guid AccountId, string DeviceId) key, (long AccountId, string DeviceId) key,
WebSocket socket, WebSocket socket,
CancellationTokenSource cts CancellationTokenSource cts
) )
@ -29,7 +29,7 @@ public class WebSocketService
return ActiveConnections.TryAdd(key, (socket, cts)); return ActiveConnections.TryAdd(key, (socket, cts));
} }
public void Disconnect((Guid AccountId, string DeviceId) key, string? reason = null) public void Disconnect((long AccountId, string DeviceId) key, string? reason = null)
{ {
if (!ActiveConnections.TryGetValue(key, out var data)) return; if (!ActiveConnections.TryGetValue(key, out var data)) return;
data.Socket.CloseAsync( data.Socket.CloseAsync(
@ -41,12 +41,12 @@ public class WebSocketService
ActiveConnections.TryRemove(key, out _); ActiveConnections.TryRemove(key, out _);
} }
public bool GetAccountIsConnected(Guid accountId) public bool GetAccountIsConnected(long accountId)
{ {
return ActiveConnections.Any(c => c.Key.AccountId == accountId); return ActiveConnections.Any(c => c.Key.AccountId == accountId);
} }
public void SendPacketToAccount(Guid userId, WebSocketPacket packet) public void SendPacketToAccount(long userId, WebSocketPacket packet)
{ {
var connections = ActiveConnections.Where(c => c.Key.AccountId == userId); var connections = ActiveConnections.Where(c => c.Key.AccountId == userId);
var packetBytes = packet.ToBytes(); var packetBytes = packet.ToBytes();

View File

@ -55,6 +55,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Uploads\" /> <Folder Include="Uploads\" />
</ItemGroup> </ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using DysonNetwork.Sphere.Account;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime; using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes; using NpgsqlTypes;
#nullable disable #nullable disable
@ -20,7 +20,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "accounts", name: "accounts",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false), name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
nick = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false), nick = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
language = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false), language = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
@ -54,7 +55,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_categories", name: "post_categories",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false), slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
@ -70,7 +72,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_tags", name: "post_tags",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false), slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
@ -86,10 +89,11 @@ namespace DysonNetwork.Sphere.Migrations
name: "account_auth_factors", name: "account_auth_factors",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
type = table.Column<int>(type: "integer", nullable: false), type = table.Column<int>(type: "integer", nullable: false),
secret = table.Column<string>(type: "character varying(8196)", maxLength: 8196, nullable: true), secret = table.Column<string>(type: "text", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -105,38 +109,16 @@ namespace DysonNetwork.Sphere.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "account_check_in_results",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
tips = table.Column<ICollection<FortuneTip>>(type: "jsonb", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_account_check_in_results", x => x.id);
table.ForeignKey(
name: "fk_account_check_in_results_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "account_contacts", name: "account_contacts",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
type = table.Column<int>(type: "integer", nullable: false), type = table.Column<int>(type: "integer", nullable: false),
verified_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), verified_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
content = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), content = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -156,8 +138,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "account_relationships", name: "account_relationships",
columns: table => new columns: table => new
{ {
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
related_id = table.Column<Guid>(type: "uuid", nullable: false), related_id = table.Column<long>(type: "bigint", nullable: false),
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
status = table.Column<int>(type: "integer", nullable: false), status = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
@ -181,32 +163,6 @@ namespace DysonNetwork.Sphere.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "account_statuses",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
attitude = table.Column<int>(type: "integer", nullable: false),
is_invisible = table.Column<bool>(type: "boolean", nullable: false),
is_not_disturb = table.Column<bool>(type: "boolean", nullable: false),
label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
cleared_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_account_statuses", x => x.id);
table.ForeignKey(
name: "fk_account_statuses_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "activities", name: "activities",
columns: table => new columns: table => new
@ -215,9 +171,7 @@ namespace DysonNetwork.Sphere.Migrations
type = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), type = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
resource_identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false), resource_identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
visibility = table.Column<int>(type: "integer", nullable: false), visibility = table.Column<int>(type: "integer", nullable: false),
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
users_visible = table.Column<ICollection<Guid>>(type: "jsonb", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -244,14 +198,14 @@ namespace DysonNetwork.Sphere.Migrations
failed_attempts = table.Column<int>(type: "integer", nullable: false), failed_attempts = table.Column<int>(type: "integer", nullable: false),
platform = table.Column<int>(type: "integer", nullable: false), platform = table.Column<int>(type: "integer", nullable: false),
type = table.Column<int>(type: "integer", nullable: false), type = table.Column<int>(type: "integer", nullable: false),
blacklist_factors = table.Column<List<Guid>>(type: "jsonb", nullable: false), blacklist_factors = table.Column<List<long>>(type: "jsonb", nullable: false),
audiences = table.Column<List<string>>(type: "jsonb", nullable: false), audiences = table.Column<List<string>>(type: "jsonb", nullable: false),
scopes = table.Column<List<string>>(type: "jsonb", nullable: false), scopes = table.Column<List<string>>(type: "jsonb", nullable: false),
ip_address = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true), ip_address = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
user_agent = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true), user_agent = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: true),
device_id = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), device_id = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
nonce = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true), nonce = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -267,32 +221,6 @@ namespace DysonNetwork.Sphere.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "badges",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
type = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
caption = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_badges", x => x.id);
table.ForeignKey(
name: "fk_badges_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "magic_spells", name: "magic_spells",
columns: table => new columns: table => new
@ -303,7 +231,7 @@ namespace DysonNetwork.Sphere.Migrations
expires_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), expires_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
affected_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), affected_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false), meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: true), account_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -327,7 +255,7 @@ namespace DysonNetwork.Sphere.Migrations
device_token = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false), device_token = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
provider = table.Column<int>(type: "integer", nullable: false), provider = table.Column<int>(type: "integer", nullable: false),
last_used_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), last_used_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -355,7 +283,7 @@ namespace DysonNetwork.Sphere.Migrations
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true), meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
priority = table.Column<int>(type: "integer", nullable: false), priority = table.Column<int>(type: "integer", nullable: false),
viewed_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), viewed_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -428,7 +356,7 @@ namespace DysonNetwork.Sphere.Migrations
label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true), label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
last_granted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), last_granted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
challenge_id = table.Column<Guid>(type: "uuid", nullable: false), challenge_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
@ -455,7 +383,7 @@ namespace DysonNetwork.Sphere.Migrations
name: "account_profiles", name: "account_profiles",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false),
first_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), first_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
middle_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), middle_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
last_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), last_name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
@ -482,8 +410,8 @@ namespace DysonNetwork.Sphere.Migrations
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<Guid>(type: "uuid", nullable: false),
chat_room_id = table.Column<Guid>(type: "uuid", nullable: false), chat_room_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
nick = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true), nick = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
role = table.Column<int>(type: "integer", nullable: false), role = table.Column<int>(type: "integer", nullable: false),
notify = table.Column<int>(type: "integer", nullable: false), notify = table.Column<int>(type: "integer", nullable: false),
@ -510,8 +438,7 @@ namespace DysonNetwork.Sphere.Migrations
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<Guid>(type: "uuid", nullable: false),
type = table.Column<string>(type: "text", nullable: false), content = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
content = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true), meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
members_mentioned = table.Column<List<Guid>>(type: "jsonb", nullable: true), members_mentioned = table.Column<List<Guid>>(type: "jsonb", nullable: true),
nonce = table.Column<string>(type: "character varying(36)", maxLength: 36, nullable: false), nonce = table.Column<string>(type: "character varying(36)", maxLength: 36, nullable: false),
@ -519,7 +446,7 @@ namespace DysonNetwork.Sphere.Migrations
replied_message_id = table.Column<Guid>(type: "uuid", nullable: true), replied_message_id = table.Column<Guid>(type: "uuid", nullable: true),
forwarded_message_id = table.Column<Guid>(type: "uuid", nullable: true), forwarded_message_id = table.Column<Guid>(type: "uuid", nullable: true),
sender_id = table.Column<Guid>(type: "uuid", nullable: false), sender_id = table.Column<Guid>(type: "uuid", nullable: false),
chat_room_id = table.Column<Guid>(type: "uuid", nullable: false), chat_room_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -547,36 +474,6 @@ namespace DysonNetwork.Sphere.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "chat_reactions",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
message_id = table.Column<Guid>(type: "uuid", nullable: false),
sender_id = table.Column<Guid>(type: "uuid", nullable: false),
symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
attitude = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_chat_reactions", x => x.id);
table.ForeignKey(
name: "fk_chat_reactions_chat_members_sender_id",
column: x => x.sender_id,
principalTable: "chat_members",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_chat_reactions_chat_messages_message_id",
column: x => x.message_id,
principalTable: "chat_messages",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "chat_statuses", name: "chat_statuses",
columns: table => new columns: table => new
@ -606,41 +503,48 @@ namespace DysonNetwork.Sphere.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "chat_realtime_call", name: "message_reaction",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<Guid>(type: "uuid", nullable: false),
title = table.Column<string>(type: "text", nullable: true), message_id = table.Column<Guid>(type: "uuid", nullable: false),
ended_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
sender_id = table.Column<Guid>(type: "uuid", nullable: false), sender_id = table.Column<Guid>(type: "uuid", nullable: false),
room_id = table.Column<Guid>(type: "uuid", nullable: false), symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
attitude = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("pk_chat_realtime_call", x => x.id); table.PrimaryKey("pk_message_reaction", x => x.id);
table.ForeignKey( table.ForeignKey(
name: "fk_chat_realtime_call_chat_members_sender_id", name: "fk_message_reaction_chat_members_sender_id",
column: x => x.sender_id, column: x => x.sender_id,
principalTable: "chat_members", principalTable: "chat_members",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_message_reaction_chat_messages_message_id",
column: x => x.message_id,
principalTable: "chat_messages",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "chat_rooms", name: "chat_rooms",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false), description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
type = table.Column<int>(type: "integer", nullable: false), type = table.Column<int>(type: "integer", nullable: false),
is_public = table.Column<bool>(type: "boolean", nullable: false), is_public = table.Column<bool>(type: "boolean", nullable: false),
picture_id = table.Column<string>(type: "character varying(128)", nullable: true), picture_id = table.Column<string>(type: "character varying(128)", nullable: true),
background_id = table.Column<string>(type: "character varying(128)", nullable: true), background_id = table.Column<string>(type: "character varying(128)", nullable: true),
realm_id = table.Column<Guid>(type: "uuid", nullable: true), realm_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -667,9 +571,9 @@ namespace DysonNetwork.Sphere.Migrations
uploaded_to = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true), uploaded_to = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
has_compression = table.Column<bool>(type: "boolean", nullable: false), has_compression = table.Column<bool>(type: "boolean", nullable: false),
used_count = table.Column<int>(type: "integer", nullable: false), used_count = table.Column<int>(type: "integer", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
message_id = table.Column<Guid>(type: "uuid", nullable: true), message_id = table.Column<Guid>(type: "uuid", nullable: true),
post_id = table.Column<Guid>(type: "uuid", nullable: true), post_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -690,11 +594,49 @@ namespace DysonNetwork.Sphere.Migrations
principalColumn: "id"); principalColumn: "id");
}); });
migrationBuilder.CreateTable(
name: "publishers",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
publisher_type = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
nick = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
bio = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
picture_id = table.Column<string>(type: "character varying(128)", nullable: true),
background_id = table.Column<string>(type: "character varying(128)", nullable: true),
account_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_publishers", x => x.id);
table.ForeignKey(
name: "fk_publishers_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id");
table.ForeignKey(
name: "fk_publishers_files_background_id",
column: x => x.background_id,
principalTable: "files",
principalColumn: "id");
table.ForeignKey(
name: "fk_publishers_files_picture_id",
column: x => x.picture_id,
principalTable: "files",
principalColumn: "id");
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "realms", name: "realms",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
slug = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), slug = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false), name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false), description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
@ -704,7 +646,7 @@ namespace DysonNetwork.Sphere.Migrations
is_public = table.Column<bool>(type: "boolean", nullable: false), is_public = table.Column<bool>(type: "boolean", nullable: false),
picture_id = table.Column<string>(type: "character varying(128)", nullable: true), picture_id = table.Column<string>(type: "character varying(128)", nullable: true),
background_id = table.Column<string>(type: "character varying(128)", nullable: true), background_id = table.Column<string>(type: "character varying(128)", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -730,86 +672,16 @@ namespace DysonNetwork.Sphere.Migrations
principalColumn: "id"); principalColumn: "id");
}); });
migrationBuilder.CreateTable(
name: "publishers",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
publisher_type = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
nick = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
bio = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
picture_id = table.Column<string>(type: "character varying(128)", nullable: true),
background_id = table.Column<string>(type: "character varying(128)", nullable: true),
account_id = table.Column<Guid>(type: "uuid", nullable: true),
realm_id = table.Column<Guid>(type: "uuid", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_publishers", x => x.id);
table.ForeignKey(
name: "fk_publishers_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id");
table.ForeignKey(
name: "fk_publishers_files_background_id",
column: x => x.background_id,
principalTable: "files",
principalColumn: "id");
table.ForeignKey(
name: "fk_publishers_files_picture_id",
column: x => x.picture_id,
principalTable: "files",
principalColumn: "id");
table.ForeignKey(
name: "fk_publishers_realms_realm_id",
column: x => x.realm_id,
principalTable: "realms",
principalColumn: "id");
});
migrationBuilder.CreateTable(
name: "realm_members",
columns: table => new
{
realm_id = table.Column<Guid>(type: "uuid", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false),
role = table.Column<int>(type: "integer", nullable: false),
joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_realm_members", x => new { x.realm_id, x.account_id });
table.ForeignKey(
name: "fk_realm_members_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_realm_members_realms_realm_id",
column: x => x.realm_id,
principalTable: "realms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "post_collections", name: "post_collections",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false), slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true), description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
publisher_id = table.Column<Guid>(type: "uuid", nullable: false), publisher_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -829,7 +701,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "posts", name: "posts",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true), title = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true), description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
language = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true), language = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
@ -843,13 +716,13 @@ namespace DysonNetwork.Sphere.Migrations
views_total = table.Column<int>(type: "integer", nullable: false), views_total = table.Column<int>(type: "integer", nullable: false),
upvotes = table.Column<int>(type: "integer", nullable: false), upvotes = table.Column<int>(type: "integer", nullable: false),
downvotes = table.Column<int>(type: "integer", nullable: false), downvotes = table.Column<int>(type: "integer", nullable: false),
threaded_post_id = table.Column<Guid>(type: "uuid", nullable: true), threaded_post_id = table.Column<long>(type: "bigint", nullable: true),
replied_post_id = table.Column<Guid>(type: "uuid", nullable: true), replied_post_id = table.Column<long>(type: "bigint", nullable: true),
forwarded_post_id = table.Column<Guid>(type: "uuid", nullable: true), forwarded_post_id = table.Column<long>(type: "bigint", nullable: true),
search_vector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false) search_vector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
.Annotation("Npgsql:TsVectorConfig", "simple") .Annotation("Npgsql:TsVectorConfig", "simple")
.Annotation("Npgsql:TsVectorProperties", new[] { "title", "description", "content" }), .Annotation("Npgsql:TsVectorProperties", new[] { "title", "description", "content" }),
publisher_id = table.Column<Guid>(type: "uuid", nullable: false), publisher_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -886,8 +759,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "publisher_members", name: "publisher_members",
columns: table => new columns: table => new
{ {
publisher_id = table.Column<Guid>(type: "uuid", nullable: false), publisher_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
role = table.Column<int>(type: "integer", nullable: false), role = table.Column<int>(type: "integer", nullable: false),
joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true), joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
@ -912,55 +785,30 @@ namespace DysonNetwork.Sphere.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "publisher_subscriptions", name: "realm_members",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), realm_id = table.Column<long>(type: "bigint", nullable: false),
publisher_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), role = table.Column<int>(type: "integer", nullable: false),
status = table.Column<int>(type: "integer", nullable: false), joined_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
tier = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("pk_publisher_subscriptions", x => x.id); table.PrimaryKey("pk_realm_members", x => new { x.realm_id, x.account_id });
table.ForeignKey( table.ForeignKey(
name: "fk_publisher_subscriptions_accounts_account_id", name: "fk_realm_members_accounts_account_id",
column: x => x.account_id, column: x => x.account_id,
principalTable: "accounts", principalTable: "accounts",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "fk_publisher_subscriptions_publishers_publisher_id", name: "fk_realm_members_realms_realm_id",
column: x => x.publisher_id, column: x => x.realm_id,
principalTable: "publishers", principalTable: "realms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "sticker_packs",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
prefix = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_sticker_packs", x => x.id);
table.ForeignKey(
name: "fk_sticker_packs_publishers_publisher_id",
column: x => x.publisher_id,
principalTable: "publishers",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -969,8 +817,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_category_links", name: "post_category_links",
columns: table => new columns: table => new
{ {
categories_id = table.Column<Guid>(type: "uuid", nullable: false), categories_id = table.Column<long>(type: "bigint", nullable: false),
posts_id = table.Column<Guid>(type: "uuid", nullable: false) posts_id = table.Column<long>(type: "bigint", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -993,8 +841,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_collection_links", name: "post_collection_links",
columns: table => new columns: table => new
{ {
collections_id = table.Column<Guid>(type: "uuid", nullable: false), collections_id = table.Column<long>(type: "bigint", nullable: false),
posts_id = table.Column<Guid>(type: "uuid", nullable: false) posts_id = table.Column<long>(type: "bigint", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -1017,11 +865,12 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_reactions", name: "post_reactions",
columns: table => new columns: table => new
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false), symbol = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
attitude = table.Column<int>(type: "integer", nullable: false), attitude = table.Column<int>(type: "integer", nullable: false),
post_id = table.Column<Guid>(type: "uuid", nullable: false), post_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<Guid>(type: "uuid", nullable: false), account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false), updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true) deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
@ -1047,8 +896,8 @@ namespace DysonNetwork.Sphere.Migrations
name: "post_tag_links", name: "post_tag_links",
columns: table => new columns: table => new
{ {
posts_id = table.Column<Guid>(type: "uuid", nullable: false), posts_id = table.Column<long>(type: "bigint", nullable: false),
tags_id = table.Column<Guid>(type: "uuid", nullable: false) tags_id = table.Column<long>(type: "bigint", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -1067,45 +916,11 @@ namespace DysonNetwork.Sphere.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "stickers",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
image_id = table.Column<string>(type: "character varying(128)", nullable: false),
pack_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_stickers", x => x.id);
table.ForeignKey(
name: "fk_stickers_files_image_id",
column: x => x.image_id,
principalTable: "files",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_stickers_sticker_packs_pack_id",
column: x => x.pack_id,
principalTable: "sticker_packs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_account_auth_factors_account_id", name: "ix_account_auth_factors_account_id",
table: "account_auth_factors", table: "account_auth_factors",
column: "account_id"); column: "account_id");
migrationBuilder.CreateIndex(
name: "ix_account_check_in_results_account_id",
table: "account_check_in_results",
column: "account_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_account_contacts_account_id", name: "ix_account_contacts_account_id",
table: "account_contacts", table: "account_contacts",
@ -1126,11 +941,6 @@ namespace DysonNetwork.Sphere.Migrations
table: "account_relationships", table: "account_relationships",
column: "related_id"); column: "related_id");
migrationBuilder.CreateIndex(
name: "ix_account_statuses_account_id",
table: "account_statuses",
column: "account_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_accounts_name", name: "ix_accounts_name",
table: "accounts", table: "accounts",
@ -1157,11 +967,6 @@ namespace DysonNetwork.Sphere.Migrations
table: "auth_sessions", table: "auth_sessions",
column: "challenge_id"); column: "challenge_id");
migrationBuilder.CreateIndex(
name: "ix_badges_account_id",
table: "badges",
column: "account_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_chat_members_account_id", name: "ix_chat_members_account_id",
table: "chat_members", table: "chat_members",
@ -1187,26 +992,6 @@ namespace DysonNetwork.Sphere.Migrations
table: "chat_messages", table: "chat_messages",
column: "sender_id"); column: "sender_id");
migrationBuilder.CreateIndex(
name: "ix_chat_reactions_message_id",
table: "chat_reactions",
column: "message_id");
migrationBuilder.CreateIndex(
name: "ix_chat_reactions_sender_id",
table: "chat_reactions",
column: "sender_id");
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_room_id",
table: "chat_realtime_call",
column: "room_id");
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_sender_id",
table: "chat_realtime_call",
column: "sender_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_chat_rooms_background_id", name: "ix_chat_rooms_background_id",
table: "chat_rooms", table: "chat_rooms",
@ -1253,6 +1038,16 @@ namespace DysonNetwork.Sphere.Migrations
column: "spell", column: "spell",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "ix_message_reaction_message_id",
table: "message_reaction",
column: "message_id");
migrationBuilder.CreateIndex(
name: "ix_message_reaction_sender_id",
table: "message_reaction",
column: "sender_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_notification_push_subscriptions_account_id", name: "ix_notification_push_subscriptions_account_id",
table: "notification_push_subscriptions", table: "notification_push_subscriptions",
@ -1347,16 +1142,6 @@ namespace DysonNetwork.Sphere.Migrations
table: "publisher_members", table: "publisher_members",
column: "account_id"); column: "account_id");
migrationBuilder.CreateIndex(
name: "ix_publisher_subscriptions_account_id",
table: "publisher_subscriptions",
column: "account_id");
migrationBuilder.CreateIndex(
name: "ix_publisher_subscriptions_publisher_id",
table: "publisher_subscriptions",
column: "publisher_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_publishers_account_id", name: "ix_publishers_account_id",
table: "publishers", table: "publishers",
@ -1378,11 +1163,6 @@ namespace DysonNetwork.Sphere.Migrations
table: "publishers", table: "publishers",
column: "picture_id"); column: "picture_id");
migrationBuilder.CreateIndex(
name: "ix_publishers_realm_id",
table: "publishers",
column: "realm_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_realm_members_account_id", name: "ix_realm_members_account_id",
table: "realm_members", table: "realm_members",
@ -1409,21 +1189,6 @@ namespace DysonNetwork.Sphere.Migrations
column: "slug", column: "slug",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "ix_sticker_packs_publisher_id",
table: "sticker_packs",
column: "publisher_id");
migrationBuilder.CreateIndex(
name: "ix_stickers_image_id",
table: "stickers",
column: "image_id");
migrationBuilder.CreateIndex(
name: "ix_stickers_pack_id",
table: "stickers",
column: "pack_id");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "fk_account_profiles_files_background_id", name: "fk_account_profiles_files_background_id",
table: "account_profiles", table: "account_profiles",
@ -1454,14 +1219,6 @@ namespace DysonNetwork.Sphere.Migrations
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_chat_realtime_call_chat_rooms_room_id",
table: "chat_realtime_call",
column: "room_id",
principalTable: "chat_rooms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "fk_chat_rooms_files_background_id", name: "fk_chat_rooms_files_background_id",
table: "chat_rooms", table: "chat_rooms",
@ -1537,9 +1294,6 @@ namespace DysonNetwork.Sphere.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "account_auth_factors"); name: "account_auth_factors");
migrationBuilder.DropTable(
name: "account_check_in_results");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "account_contacts"); name: "account_contacts");
@ -1549,30 +1303,21 @@ namespace DysonNetwork.Sphere.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "account_relationships"); name: "account_relationships");
migrationBuilder.DropTable(
name: "account_statuses");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "activities"); name: "activities");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "auth_sessions"); name: "auth_sessions");
migrationBuilder.DropTable(
name: "badges");
migrationBuilder.DropTable(
name: "chat_reactions");
migrationBuilder.DropTable(
name: "chat_realtime_call");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "chat_statuses"); name: "chat_statuses");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "magic_spells"); name: "magic_spells");
migrationBuilder.DropTable(
name: "message_reaction");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "notification_push_subscriptions"); name: "notification_push_subscriptions");
@ -1600,15 +1345,9 @@ namespace DysonNetwork.Sphere.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "publisher_members"); name: "publisher_members");
migrationBuilder.DropTable(
name: "publisher_subscriptions");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "realm_members"); name: "realm_members");
migrationBuilder.DropTable(
name: "stickers");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "auth_challenges"); name: "auth_challenges");
@ -1624,9 +1363,6 @@ namespace DysonNetwork.Sphere.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "post_tags"); name: "post_tags");
migrationBuilder.DropTable(
name: "sticker_packs");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "accounts"); name: "accounts");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class NoIdeaHowToNameThis : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_message_reaction_chat_members_sender_id",
table: "message_reaction");
migrationBuilder.DropForeignKey(
name: "fk_message_reaction_chat_messages_message_id",
table: "message_reaction");
migrationBuilder.DropPrimaryKey(
name: "pk_message_reaction",
table: "message_reaction");
migrationBuilder.RenameTable(
name: "message_reaction",
newName: "chat_reactions");
migrationBuilder.RenameIndex(
name: "ix_message_reaction_sender_id",
table: "chat_reactions",
newName: "ix_chat_reactions_sender_id");
migrationBuilder.RenameIndex(
name: "ix_message_reaction_message_id",
table: "chat_reactions",
newName: "ix_chat_reactions_message_id");
migrationBuilder.AddPrimaryKey(
name: "pk_chat_reactions",
table: "chat_reactions",
column: "id");
migrationBuilder.AddForeignKey(
name: "fk_chat_reactions_chat_members_sender_id",
table: "chat_reactions",
column: "sender_id",
principalTable: "chat_members",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_chat_reactions_chat_messages_message_id",
table: "chat_reactions",
column: "message_id",
principalTable: "chat_messages",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_chat_reactions_chat_members_sender_id",
table: "chat_reactions");
migrationBuilder.DropForeignKey(
name: "fk_chat_reactions_chat_messages_message_id",
table: "chat_reactions");
migrationBuilder.DropPrimaryKey(
name: "pk_chat_reactions",
table: "chat_reactions");
migrationBuilder.RenameTable(
name: "chat_reactions",
newName: "message_reaction");
migrationBuilder.RenameIndex(
name: "ix_chat_reactions_sender_id",
table: "message_reaction",
newName: "ix_message_reaction_sender_id");
migrationBuilder.RenameIndex(
name: "ix_chat_reactions_message_id",
table: "message_reaction",
newName: "ix_message_reaction_message_id");
migrationBuilder.AddPrimaryKey(
name: "pk_message_reaction",
table: "message_reaction",
column: "id");
migrationBuilder.AddForeignKey(
name: "fk_message_reaction_chat_members_sender_id",
table: "message_reaction",
column: "sender_id",
principalTable: "chat_members",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_message_reaction_chat_messages_message_id",
table: "message_reaction",
column: "message_id",
principalTable: "chat_messages",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddChatRealtimeCall : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "content",
table: "chat_messages",
type: "character varying(4096)",
maxLength: 4096,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(4096)",
oldMaxLength: 4096);
migrationBuilder.AddColumn<string>(
name: "type",
table: "chat_messages",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "chat_realtime_call",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
title = table.Column<string>(type: "text", nullable: true),
ended_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
sender_id = table.Column<Guid>(type: "uuid", nullable: false),
room_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_chat_realtime_call", x => x.id);
table.ForeignKey(
name: "fk_chat_realtime_call_chat_members_sender_id",
column: x => x.sender_id,
principalTable: "chat_members",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_chat_realtime_call_chat_rooms_room_id",
column: x => x.room_id,
principalTable: "chat_rooms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_room_id",
table: "chat_realtime_call",
column: "room_id");
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_sender_id",
table: "chat_realtime_call",
column: "sender_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "chat_realtime_call");
migrationBuilder.DropColumn(
name: "type",
table: "chat_messages");
migrationBuilder.AlterColumn<string>(
name: "content",
table: "chat_messages",
type: "character varying(4096)",
maxLength: 4096,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(4096)",
oldMaxLength: 4096,
oldNullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddAccountStatuses : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "account_statuses",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
attitude = table.Column<int>(type: "integer", nullable: false),
is_invisible = table.Column<bool>(type: "boolean", nullable: false),
is_not_disturb = table.Column<bool>(type: "boolean", nullable: false),
label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
cleared_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_account_statuses", x => x.id);
table.ForeignKey(
name: "fk_account_statuses_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_account_statuses_account_id",
table: "account_statuses",
column: "account_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "account_statuses");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using DysonNetwork.Sphere.Account;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddAccountCheckIn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "account_check_in_results",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
level = table.Column<int>(type: "integer", nullable: false),
tips = table.Column<ICollection<FortuneTip>>(type: "jsonb", nullable: false),
account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_account_check_in_results", x => x.id);
table.ForeignKey(
name: "fk_account_check_in_results_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_account_check_in_results_account_id",
table: "account_check_in_results",
column: "account_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "account_check_in_results");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class DontKnowHowToNameThing : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Dictionary<string, object>>(
name: "meta",
table: "activities",
type: "jsonb",
nullable: false);
migrationBuilder.AddColumn<ICollection<long>>(
name: "users_visible",
table: "activities",
type: "jsonb",
nullable: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "meta",
table: "activities");
migrationBuilder.DropColumn(
name: "users_visible",
table: "activities");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddStickerAndPacks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "sticker_packs",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
prefix = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
publisher_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_sticker_packs", x => x.id);
table.ForeignKey(
name: "fk_sticker_packs_publishers_publisher_id",
column: x => x.publisher_id,
principalTable: "publishers",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "stickers",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
slug = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
image_id = table.Column<string>(type: "character varying(128)", nullable: false),
pack_id = table.Column<Guid>(type: "uuid", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_stickers", x => x.id);
table.ForeignKey(
name: "fk_stickers_files_image_id",
column: x => x.image_id,
principalTable: "files",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_stickers_sticker_packs_pack_id",
column: x => x.pack_id,
principalTable: "sticker_packs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_sticker_packs_publisher_id",
table: "sticker_packs",
column: "publisher_id");
migrationBuilder.CreateIndex(
name: "ix_stickers_image_id",
table: "stickers",
column: "image_id");
migrationBuilder.CreateIndex(
name: "ix_stickers_pack_id",
table: "stickers",
column: "pack_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "stickers");
migrationBuilder.DropTable(
name: "sticker_packs");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddPublisherSubscription : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "publisher_subscriptions",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
publisher_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<long>(type: "bigint", nullable: false),
status = table.Column<int>(type: "integer", nullable: false),
tier = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_publisher_subscriptions", x => x.id);
table.ForeignKey(
name: "fk_publisher_subscriptions_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_publisher_subscriptions_publishers_publisher_id",
column: x => x.publisher_id,
principalTable: "publishers",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_publisher_subscriptions_account_id",
table: "publisher_subscriptions",
column: "account_id");
migrationBuilder.CreateIndex(
name: "ix_publisher_subscriptions_publisher_id",
table: "publisher_subscriptions",
column: "publisher_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "publisher_subscriptions");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class PublisherWithOrganization : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "realm_id",
table: "publishers",
type: "bigint",
nullable: true);
migrationBuilder.CreateIndex(
name: "ix_publishers_realm_id",
table: "publishers",
column: "realm_id");
migrationBuilder.AddForeignKey(
name: "fk_publishers_realms_realm_id",
table: "publishers",
column: "realm_id",
principalTable: "realms",
principalColumn: "id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_publishers_realms_realm_id",
table: "publishers");
migrationBuilder.DropIndex(
name: "ix_publishers_realm_id",
table: "publishers");
migrationBuilder.DropColumn(
name: "realm_id",
table: "publishers");
}
}
}

View File

@ -17,8 +17,8 @@ using NpgsqlTypes;
namespace DysonNetwork.Sphere.Migrations namespace DysonNetwork.Sphere.Migrations
{ {
[DbContext(typeof(AppDatabase))] [DbContext(typeof(AppDatabase))]
[Migration("20250514115228_InitialMigration")] [Migration("20250512160008_AddAccountBadges")]
partial class InitialMigration partial class AddAccountBadges
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -32,11 +32,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant?>("ActivatedAt") b.Property<Instant?>("ActivatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("activated_at"); .HasColumnName("activated_at");
@ -87,13 +89,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -105,8 +109,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<string>("Secret") b.Property<string>("Secret")
.HasMaxLength(8196) .HasColumnType("text")
.HasColumnType("character varying(8196)")
.HasColumnName("secret"); .HasColumnName("secret");
b.Property<int>("Type") b.Property<int>("Type")
@ -128,13 +131,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -179,8 +184,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Caption") b.Property<string>("Caption")
@ -236,8 +241,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -277,8 +282,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid?>("AccountId") b.Property<long?>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant?>("AffectedAt") b.Property<Instant?>("AffectedAt")
@ -336,8 +341,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -401,8 +406,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -456,8 +461,8 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -514,12 +519,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b =>
{ {
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("RelatedId") b.Property<long>("RelatedId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("related_id"); .HasColumnName("related_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -558,8 +563,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<int>("Attitude") b.Property<int>("Attitude")
@ -611,8 +616,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -644,7 +649,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("updated_at"); .HasColumnName("updated_at");
b.Property<ICollection<Guid>>("UsersVisible") b.Property<ICollection<long>>("UsersVisible")
.IsRequired() .IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("users_visible"); .HasColumnName("users_visible");
@ -669,8 +674,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<List<string>>("Audiences") b.Property<List<string>>("Audiences")
@ -678,7 +683,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("audiences"); .HasColumnName("audiences");
b.Property<List<Guid>>("BlacklistFactors") b.Property<List<long>>("BlacklistFactors")
.IsRequired() .IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("blacklist_factors"); .HasColumnName("blacklist_factors");
@ -760,8 +765,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("ChallengeId") b.Property<Guid>("ChallengeId")
@ -812,12 +817,12 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("ChatRoomId") b.Property<long>("ChatRoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("chat_room_id"); .HasColumnName("chat_room_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -867,11 +872,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("background_id"); .HasColumnName("background_id");
@ -904,8 +911,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("picture_id"); .HasColumnName("picture_id");
b.Property<Guid?>("RealmId") b.Property<long?>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<int>("Type") b.Property<int>("Type")
@ -938,8 +945,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("ChatRoomId") b.Property<long>("ChatRoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("chat_room_id"); .HasColumnName("chat_room_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -1115,8 +1122,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("ended_at"); .HasColumnName("ended_at");
b.Property<Guid>("RoomId") b.Property<long>("RoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("room_id"); .HasColumnName("room_id");
b.Property<Guid>("SenderId") b.Property<Guid>("SenderId")
@ -1279,11 +1286,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Content") b.Property<string>("Content")
.HasColumnType("text") .HasColumnType("text")
.HasColumnName("content"); .HasColumnName("content");
@ -1309,8 +1318,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("edited_at"); .HasColumnName("edited_at");
b.Property<Guid?>("ForwardedPostId") b.Property<long?>("ForwardedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("forwarded_post_id"); .HasColumnName("forwarded_post_id");
b.Property<string>("Language") b.Property<string>("Language")
@ -1326,12 +1335,12 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("published_at"); .HasColumnName("published_at");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Guid?>("RepliedPostId") b.Property<long?>("RepliedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("replied_post_id"); .HasColumnName("replied_post_id");
b.Property<NpgsqlTsVector>("SearchVector") b.Property<NpgsqlTsVector>("SearchVector")
@ -1342,8 +1351,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasAnnotation("Npgsql:TsVectorConfig", "simple") .HasAnnotation("Npgsql:TsVectorConfig", "simple")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" });
b.Property<Guid?>("ThreadedPostId") b.Property<long?>("ThreadedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("threaded_post_id"); .HasColumnName("threaded_post_id");
b.Property<string>("Title") b.Property<string>("Title")
@ -1401,11 +1410,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1437,11 +1448,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1460,8 +1473,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(256)") .HasColumnType("character varying(256)")
.HasColumnName("name"); .HasColumnName("name");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<string>("Slug") b.Property<string>("Slug")
@ -1485,13 +1498,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<int>("Attitude") b.Property<int>("Attitude")
@ -1506,8 +1521,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<Guid>("PostId") b.Property<long>("PostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("post_id"); .HasColumnName("post_id");
b.Property<string>("Symbol") b.Property<string>("Symbol")
@ -1534,11 +1549,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1570,13 +1587,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid?>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long?>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -1616,8 +1635,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("publisher_type"); .HasColumnName("publisher_type");
b.Property<Guid?>("RealmId") b.Property<long?>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<Instant>("UpdatedAt") b.Property<Instant>("UpdatedAt")
@ -1648,12 +1667,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b =>
{ {
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1692,8 +1711,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1704,8 +1723,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<int>("Status") b.Property<int>("Status")
@ -1734,13 +1753,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -1819,12 +1840,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b =>
{ {
b.Property<Guid>("RealmId") b.Property<long>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1935,8 +1956,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("prefix"); .HasColumnName("prefix");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Instant>("UpdatedAt") b.Property<Instant>("UpdatedAt")
@ -1959,8 +1980,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -2008,8 +2029,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(1024)") .HasColumnType("character varying(1024)")
.HasColumnName("name"); .HasColumnName("name");
b.Property<Guid?>("PostId") b.Property<long?>("PostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("post_id"); .HasColumnName("post_id");
b.Property<long>("Size") b.Property<long>("Size")
@ -2054,12 +2075,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostCategory", b => modelBuilder.Entity("PostPostCategory", b =>
{ {
b.Property<Guid>("CategoriesId") b.Property<long>("CategoriesId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("categories_id"); .HasColumnName("categories_id");
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.HasKey("CategoriesId", "PostsId") b.HasKey("CategoriesId", "PostsId")
@ -2073,12 +2094,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostCollection", b => modelBuilder.Entity("PostPostCollection", b =>
{ {
b.Property<Guid>("CollectionsId") b.Property<long>("CollectionsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("collections_id"); .HasColumnName("collections_id");
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.HasKey("CollectionsId", "PostsId") b.HasKey("CollectionsId", "PostsId")
@ -2092,12 +2113,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostTag", b => modelBuilder.Entity("PostPostTag", b =>
{ {
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.Property<Guid>("TagsId") b.Property<long>("TagsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("tags_id"); .HasColumnName("tags_id");
b.HasKey("PostsId", "TagsId") b.HasKey("PostsId", "TagsId")

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddAccountBadges : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "badges",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
type = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
label = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
caption = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
account_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_badges", x => x.id);
table.ForeignKey(
name: "fk_badges_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_badges_account_id",
table: "badges",
column: "account_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "badges");
}
}
}

View File

@ -29,11 +29,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant?>("ActivatedAt") b.Property<Instant?>("ActivatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("activated_at"); .HasColumnName("activated_at");
@ -84,13 +86,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -102,8 +106,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<string>("Secret") b.Property<string>("Secret")
.HasMaxLength(8196) .HasColumnType("text")
.HasColumnType("character varying(8196)")
.HasColumnName("secret"); .HasColumnName("secret");
b.Property<int>("Type") b.Property<int>("Type")
@ -125,13 +128,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -176,8 +181,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Caption") b.Property<string>("Caption")
@ -233,8 +238,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -274,8 +279,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid?>("AccountId") b.Property<long?>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant?>("AffectedAt") b.Property<Instant?>("AffectedAt")
@ -333,8 +338,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -398,8 +403,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -453,8 +458,8 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -511,12 +516,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b =>
{ {
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("RelatedId") b.Property<long>("RelatedId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("related_id"); .HasColumnName("related_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -555,8 +560,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<int>("Attitude") b.Property<int>("Attitude")
@ -608,8 +613,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -641,7 +646,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("updated_at"); .HasColumnName("updated_at");
b.Property<ICollection<Guid>>("UsersVisible") b.Property<ICollection<long>>("UsersVisible")
.IsRequired() .IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("users_visible"); .HasColumnName("users_visible");
@ -666,8 +671,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<List<string>>("Audiences") b.Property<List<string>>("Audiences")
@ -675,7 +680,7 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("audiences"); .HasColumnName("audiences");
b.Property<List<Guid>>("BlacklistFactors") b.Property<List<long>>("BlacklistFactors")
.IsRequired() .IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("blacklist_factors"); .HasColumnName("blacklist_factors");
@ -757,8 +762,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("ChallengeId") b.Property<Guid>("ChallengeId")
@ -809,12 +814,12 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Guid>("ChatRoomId") b.Property<long>("ChatRoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("chat_room_id"); .HasColumnName("chat_room_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -864,11 +869,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("background_id"); .HasColumnName("background_id");
@ -901,8 +908,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("picture_id"); .HasColumnName("picture_id");
b.Property<Guid?>("RealmId") b.Property<long?>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<int>("Type") b.Property<int>("Type")
@ -935,8 +942,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("ChatRoomId") b.Property<long>("ChatRoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("chat_room_id"); .HasColumnName("chat_room_id");
b.Property<string>("Content") b.Property<string>("Content")
@ -1112,8 +1119,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("ended_at"); .HasColumnName("ended_at");
b.Property<Guid>("RoomId") b.Property<long>("RoomId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("room_id"); .HasColumnName("room_id");
b.Property<Guid>("SenderId") b.Property<Guid>("SenderId")
@ -1276,11 +1283,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("Content") b.Property<string>("Content")
.HasColumnType("text") .HasColumnType("text")
.HasColumnName("content"); .HasColumnName("content");
@ -1306,8 +1315,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("edited_at"); .HasColumnName("edited_at");
b.Property<Guid?>("ForwardedPostId") b.Property<long?>("ForwardedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("forwarded_post_id"); .HasColumnName("forwarded_post_id");
b.Property<string>("Language") b.Property<string>("Language")
@ -1323,12 +1332,12 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("published_at"); .HasColumnName("published_at");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Guid?>("RepliedPostId") b.Property<long?>("RepliedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("replied_post_id"); .HasColumnName("replied_post_id");
b.Property<NpgsqlTsVector>("SearchVector") b.Property<NpgsqlTsVector>("SearchVector")
@ -1339,8 +1348,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasAnnotation("Npgsql:TsVectorConfig", "simple") .HasAnnotation("Npgsql:TsVectorConfig", "simple")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" });
b.Property<Guid?>("ThreadedPostId") b.Property<long?>("ThreadedPostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("threaded_post_id"); .HasColumnName("threaded_post_id");
b.Property<string>("Title") b.Property<string>("Title")
@ -1398,11 +1407,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1434,11 +1445,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1457,8 +1470,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(256)") .HasColumnType("character varying(256)")
.HasColumnName("name"); .HasColumnName("name");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<string>("Slug") b.Property<string>("Slug")
@ -1482,13 +1495,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<int>("Attitude") b.Property<int>("Attitude")
@ -1503,8 +1518,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<Guid>("PostId") b.Property<long>("PostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("post_id"); .HasColumnName("post_id");
b.Property<string>("Symbol") b.Property<string>("Symbol")
@ -1531,11 +1546,13 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("created_at"); .HasColumnName("created_at");
@ -1567,13 +1584,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.Publisher", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid?>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long?>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -1613,8 +1632,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("publisher_type"); .HasColumnName("publisher_type");
b.Property<Guid?>("RealmId") b.Property<long?>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<Instant>("UpdatedAt") b.Property<Instant>("UpdatedAt")
@ -1645,12 +1664,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b => modelBuilder.Entity("DysonNetwork.Sphere.Post.PublisherMember", b =>
{ {
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1689,8 +1708,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1701,8 +1720,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at"); .HasColumnName("deleted_at");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<int>("Status") b.Property<int>("Status")
@ -1731,13 +1750,15 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b =>
{ {
b.Property<Guid>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
.HasColumnType("uuid")
b.Property<long>("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<string>("BackgroundId") b.Property<string>("BackgroundId")
@ -1816,12 +1837,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b =>
{ {
b.Property<Guid>("RealmId") b.Property<long>("RealmId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("realm_id"); .HasColumnName("realm_id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -1932,8 +1953,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("prefix"); .HasColumnName("prefix");
b.Property<Guid>("PublisherId") b.Property<long>("PublisherId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("publisher_id"); .HasColumnName("publisher_id");
b.Property<Instant>("UpdatedAt") b.Property<Instant>("UpdatedAt")
@ -1956,8 +1977,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("id"); .HasColumnName("id");
b.Property<Guid>("AccountId") b.Property<long>("AccountId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("account_id"); .HasColumnName("account_id");
b.Property<Instant>("CreatedAt") b.Property<Instant>("CreatedAt")
@ -2005,8 +2026,8 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("character varying(1024)") .HasColumnType("character varying(1024)")
.HasColumnName("name"); .HasColumnName("name");
b.Property<Guid?>("PostId") b.Property<long?>("PostId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("post_id"); .HasColumnName("post_id");
b.Property<long>("Size") b.Property<long>("Size")
@ -2051,12 +2072,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostCategory", b => modelBuilder.Entity("PostPostCategory", b =>
{ {
b.Property<Guid>("CategoriesId") b.Property<long>("CategoriesId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("categories_id"); .HasColumnName("categories_id");
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.HasKey("CategoriesId", "PostsId") b.HasKey("CategoriesId", "PostsId")
@ -2070,12 +2091,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostCollection", b => modelBuilder.Entity("PostPostCollection", b =>
{ {
b.Property<Guid>("CollectionsId") b.Property<long>("CollectionsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("collections_id"); .HasColumnName("collections_id");
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.HasKey("CollectionsId", "PostsId") b.HasKey("CollectionsId", "PostsId")
@ -2089,12 +2110,12 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("PostPostTag", b => modelBuilder.Entity("PostPostTag", b =>
{ {
b.Property<Guid>("PostsId") b.Property<long>("PostsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("posts_id"); .HasColumnName("posts_id");
b.Property<Guid>("TagsId") b.Property<long>("TagsId")
.HasColumnType("uuid") .HasColumnType("bigint")
.HasColumnName("tags_id"); .HasColumnName("tags_id");
b.HasKey("PostsId", "TagsId") b.HasKey("PostsId", "TagsId")

View File

@ -25,7 +25,7 @@ public enum PostVisibility
public class Post : ModelBase public class Post : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(1024)] public string? Title { get; set; } [MaxLength(1024)] public string? Title { get; set; }
[MaxLength(4096)] public string? Description { get; set; } [MaxLength(4096)] public string? Description { get; set; }
[MaxLength(128)] public string? Language { get; set; } [MaxLength(128)] public string? Language { get; set; }
@ -45,11 +45,11 @@ public class Post : ModelBase
public int Downvotes { get; set; } public int Downvotes { get; set; }
[NotMapped] public Dictionary<string, int> ReactionsCount { get; set; } = new(); [NotMapped] public Dictionary<string, int> ReactionsCount { get; set; } = new();
public Guid? ThreadedPostId { get; set; } public long? ThreadedPostId { get; set; }
public Post? ThreadedPost { get; set; } public Post? ThreadedPost { get; set; }
public Guid? RepliedPostId { get; set; } public long? RepliedPostId { get; set; }
public Post? RepliedPost { get; set; } public Post? RepliedPost { get; set; }
public Guid? ForwardedPostId { get; set; } public long? ForwardedPostId { get; set; }
public Post? ForwardedPost { get; set; } public Post? ForwardedPost { get; set; }
public ICollection<CloudFile> Attachments { get; set; } = new List<CloudFile>(); public ICollection<CloudFile> Attachments { get; set; } = new List<CloudFile>();
@ -67,7 +67,7 @@ public class Post : ModelBase
public class PostTag : ModelBase public class PostTag : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(128)] public string Slug { get; set; } = null!; [MaxLength(128)] public string Slug { get; set; } = null!;
[MaxLength(256)] public string? Name { get; set; } [MaxLength(256)] public string? Name { get; set; }
public ICollection<Post> Posts { get; set; } = new List<Post>(); public ICollection<Post> Posts { get; set; } = new List<Post>();
@ -75,7 +75,7 @@ public class PostTag : ModelBase
public class PostCategory : ModelBase public class PostCategory : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(128)] public string Slug { get; set; } = null!; [MaxLength(128)] public string Slug { get; set; } = null!;
[MaxLength(256)] public string? Name { get; set; } [MaxLength(256)] public string? Name { get; set; }
public ICollection<Post> Posts { get; set; } = new List<Post>(); public ICollection<Post> Posts { get; set; } = new List<Post>();
@ -83,7 +83,7 @@ public class PostCategory : ModelBase
public class PostCollection : ModelBase public class PostCollection : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(128)] public string Slug { get; set; } = null!; [MaxLength(128)] public string Slug { get; set; } = null!;
[MaxLength(256)] public string? Name { get; set; } [MaxLength(256)] public string? Name { get; set; }
[MaxLength(4096)] public string? Description { get; set; } [MaxLength(4096)] public string? Description { get; set; }
@ -102,12 +102,12 @@ public enum PostReactionAttitude
public class PostReaction : ModelBase public class PostReaction : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(256)] public string Symbol { get; set; } = null!; [MaxLength(256)] public string Symbol { get; set; } = null!;
public PostReactionAttitude Attitude { get; set; } public PostReactionAttitude Attitude { get; set; }
public Guid PostId { get; set; } public long PostId { get; set; }
[JsonIgnore] public Post Post { get; set; } = null!; [JsonIgnore] public Post Post { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account.Account Account { get; set; } = null!; public Account.Account Account { get; set; } = null!;
} }

View File

@ -58,8 +58,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
return Ok(posts); return Ok(posts);
} }
[HttpGet("{id:guid}")] [HttpGet("{id:long}")]
public async Task<ActionResult<Post>> GetPost(Guid id) public async Task<ActionResult<Post>> GetPost(long id)
{ {
HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue);
var currentUser = currentUserValue as Account.Account; var currentUser = currentUserValue as Account.Account;
@ -83,8 +83,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
return Ok(post); return Ok(post);
} }
[HttpGet("{id:guid}/replies")] [HttpGet("{id:long}/replies")]
public async Task<ActionResult<List<Post>>> ListReplies(Guid id, [FromQuery] int offset = 0, public async Task<ActionResult<List<Post>>> ListReplies(long id, [FromQuery] int offset = 0,
[FromQuery] int take = 20) [FromQuery] int take = 20)
{ {
HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue);
@ -137,8 +137,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
[MaxLength(32)] public List<string>? Attachments { get; set; } [MaxLength(32)] public List<string>? Attachments { get; set; }
public Dictionary<string, object>? Meta { get; set; } public Dictionary<string, object>? Meta { get; set; }
public Instant? PublishedAt { get; set; } public Instant? PublishedAt { get; set; }
public Guid? RepliedPostId { get; set; } public long? RepliedPostId { get; set; }
public Guid? ForwardedPostId { get; set; } public long? ForwardedPostId { get; set; }
} }
[HttpPost] [HttpPost]
@ -230,10 +230,10 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
public PostReactionAttitude Attitude { get; set; } public PostReactionAttitude Attitude { get; set; }
} }
[HttpPost("{id:guid}/reactions")] [HttpPost("{id:long}/reactions")]
[Authorize] [Authorize]
[RequiredPermission("global", "posts.react")] [RequiredPermission("global", "posts.react")]
public async Task<ActionResult<PostReaction>> ReactPost(Guid id, [FromBody] PostReactionRequest request) public async Task<ActionResult<PostReaction>> ReactPost(long id, [FromBody] PostReactionRequest request)
{ {
HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue);
if (currentUserValue is not Account.Account currentUser) return Unauthorized(); if (currentUserValue is not Account.Account currentUser) return Unauthorized();
@ -265,8 +265,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
return Ok(reaction); return Ok(reaction);
} }
[HttpPatch("{id:guid}")] [HttpPatch("{id:long}")]
public async Task<ActionResult<Post>> UpdatePost(Guid id, [FromBody] PostRequest request) public async Task<ActionResult<Post>> UpdatePost(long id, [FromBody] PostRequest request)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
@ -312,8 +312,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
return Ok(post); return Ok(post);
} }
[HttpDelete("{id:guid}")] [HttpDelete("{id:long}")]
public async Task<ActionResult<Post>> DeletePost(Guid id) public async Task<ActionResult<Post>> DeletePost(long id)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();

View File

@ -215,7 +215,7 @@ public class PostService(AppDatabase db, FileService fs, ActivityService act)
return isRemoving; return isRemoving;
} }
public async Task<Dictionary<string, int>> GetPostReactionMap(Guid postId) public async Task<Dictionary<string, int>> GetPostReactionMap(long postId)
{ {
return await db.Set<PostReaction>() return await db.Set<PostReaction>()
.Where(r => r.PostId == postId) .Where(r => r.PostId == postId)
@ -226,7 +226,7 @@ public class PostService(AppDatabase db, FileService fs, ActivityService act)
); );
} }
public async Task<Dictionary<Guid, Dictionary<string, int>>> GetPostReactionMapBatch(List<Guid> postIds) public async Task<Dictionary<long, Dictionary<string, int>>> GetPostReactionMapBatch(List<long> postIds)
{ {
return await db.Set<PostReaction>() return await db.Set<PostReaction>()
.Where(r => postIds.Contains(r.PostId)) .Where(r => postIds.Contains(r.PostId))
@ -245,7 +245,7 @@ public class PostService(AppDatabase db, FileService fs, ActivityService act)
public static class PostQueryExtensions public static class PostQueryExtensions
{ {
public static IQueryable<Post> FilterWithVisibility(this IQueryable<Post> source, Account.Account? currentUser, public static IQueryable<Post> FilterWithVisibility(this IQueryable<Post> source, Account.Account? currentUser,
List<Guid> userFriends, bool isListing = false) List<long> userFriends, bool isListing = false)
{ {
var now = Instant.FromDateTimeUtc(DateTime.UtcNow); var now = Instant.FromDateTimeUtc(DateTime.UtcNow);

View File

@ -16,7 +16,7 @@ public enum PublisherType
[Index(nameof(Name), IsUnique = true)] [Index(nameof(Name), IsUnique = true)]
public class Publisher : ModelBase public class Publisher : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
public PublisherType PublisherType { get; set; } public PublisherType PublisherType { get; set; }
[MaxLength(256)] public string Name { get; set; } = string.Empty; [MaxLength(256)] public string Name { get; set; } = string.Empty;
[MaxLength(256)] public string Nick { get; set; } = string.Empty; [MaxLength(256)] public string Nick { get; set; } = string.Empty;
@ -34,9 +34,9 @@ public class Publisher : ModelBase
[JsonIgnore] [JsonIgnore]
public ICollection<PublisherSubscription> Subscriptions { get; set; } = new List<PublisherSubscription>(); public ICollection<PublisherSubscription> Subscriptions { get; set; } = new List<PublisherSubscription>();
public Guid? AccountId { get; set; } public long? AccountId { get; set; }
[JsonIgnore] public Account.Account? Account { get; set; } [JsonIgnore] public Account.Account? Account { get; set; }
public Guid? RealmId { get; set; } public long? RealmId { get; set; }
[JsonIgnore] public Realm.Realm? Realm { get; set; } [JsonIgnore] public Realm.Realm? Realm { get; set; }
} }
@ -50,9 +50,9 @@ public enum PublisherMemberRole
public class PublisherMember : ModelBase public class PublisherMember : ModelBase
{ {
public Guid PublisherId { get; set; } public long PublisherId { get; set; }
[JsonIgnore] public Publisher Publisher { get; set; } = null!; [JsonIgnore] public Publisher Publisher { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account.Account Account { get; set; } = null!; [JsonIgnore] public Account.Account Account { get; set; } = null!;
public PublisherMemberRole Role { get; set; } = PublisherMemberRole.Viewer; public PublisherMemberRole Role { get; set; } = PublisherMemberRole.Viewer;
@ -70,9 +70,9 @@ public class PublisherSubscription : ModelBase
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid PublisherId { get; set; } public long PublisherId { get; set; }
[JsonIgnore] public Publisher Publisher { get; set; } = null!; [JsonIgnore] public Publisher Publisher { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account.Account Account { get; set; } = null!; [JsonIgnore] public Account.Account Account { get; set; } = null!;
public SubscriptionStatus Status { get; set; } = SubscriptionStatus.Active; public SubscriptionStatus Status { get; set; } = SubscriptionStatus.Active;

View File

@ -1,11 +1,10 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace DysonNetwork.Sphere.Post; namespace DysonNetwork.Sphere.Post;
[ApiController] [ApiController]
[Route("/publishers")] [Route("api/[controller]")]
public class PublisherSubscriptionController( public class PublisherSubscriptionController(
PublisherSubscriptionService subs, PublisherSubscriptionService subs,
AppDatabase db, AppDatabase db,
@ -16,7 +15,7 @@ public class PublisherSubscriptionController(
public class SubscriptionStatusResponse public class SubscriptionStatusResponse
{ {
public bool IsSubscribed { get; set; } public bool IsSubscribed { get; set; }
public Guid PublisherId { get; set; } public long PublisherId { get; set; }
public string PublisherName { get; set; } = string.Empty; public string PublisherName { get; set; } = string.Empty;
} }
@ -25,37 +24,48 @@ public class PublisherSubscriptionController(
public int? Tier { get; set; } public int? Tier { get; set; }
} }
[HttpGet("{name}/subscription")] /// <summary>
/// Check if the current user is subscribed to a publisher
/// </summary>
/// <param name="publisherId">Publisher ID to check</param>
/// <returns>Subscription status</returns>
[HttpGet("{publisherId}/status")]
[Authorize] [Authorize]
public async Task<ActionResult<SubscriptionStatusResponse>> CheckSubscriptionStatus(string name) public async Task<ActionResult<SubscriptionStatusResponse>> CheckSubscriptionStatus(long publisherId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
// Check if the publisher exists // Check if the publisher exists
var publisher = await db.Publishers.FirstOrDefaultAsync(p => p.Name == name); var publisher = await db.Publishers.FindAsync(publisherId);
if (publisher == null) if (publisher == null)
return NotFound("Publisher not found"); return NotFound("Publisher not found");
var isSubscribed = await subs.SubscriptionExistsAsync(currentUser.Id, publisher.Id); var isSubscribed = await subs.SubscriptionExistsAsync(currentUser.Id, publisherId);
return new SubscriptionStatusResponse return new SubscriptionStatusResponse
{ {
IsSubscribed = isSubscribed, IsSubscribed = isSubscribed,
PublisherId = publisher.Id, PublisherId = publisherId,
PublisherName = publisher.Name PublisherName = publisher.Name
}; };
} }
[HttpPost("{name}/subscribe")] /// <summary>
/// Create or activate a subscription to a publisher
/// </summary>
/// <param name="publisherId">Publisher ID to subscribe to</param>
/// <param name="request">Subscription details</param>
/// <returns>The created or activated subscription</returns>
[HttpPost("{publisherId}/subscribe")]
[Authorize] [Authorize]
public async Task<ActionResult<PublisherSubscription>> Subscribe( public async Task<ActionResult<PublisherSubscription>> Subscribe(
string name, long publisherId,
[FromBody] SubscribeRequest request) [FromBody] SubscribeRequest request)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
// Check if the publisher exists // Check if the publisher exists
var publisher = await db.Publishers.FirstOrDefaultAsync(p => p.Name == name); var publisher = await db.Publishers.FindAsync(publisherId);
if (publisher == null) if (publisher == null)
return NotFound("Publisher not found"); return NotFound("Publisher not found");
@ -63,7 +73,7 @@ public class PublisherSubscriptionController(
{ {
var subscription = await subs.CreateSubscriptionAsync( var subscription = await subs.CreateSubscriptionAsync(
currentUser.Id, currentUser.Id,
publisher.Id, publisherId,
request.Tier ?? 0 request.Tier ?? 0
); );
@ -71,23 +81,28 @@ public class PublisherSubscriptionController(
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.LogError(ex, "Error subscribing to publisher {PublisherName}", name); logger.LogError(ex, "Error subscribing to publisher {PublisherId}", publisherId);
return StatusCode(500, "Failed to create subscription"); return StatusCode(500, "Failed to create subscription");
} }
} }
[HttpPost("{name}/unsubscribe")] /// <summary>
/// Cancel a subscription to a publisher
/// </summary>
/// <param name="publisherId">Publisher ID to unsubscribe from</param>
/// <returns>Success status</returns>
[HttpPost("{publisherId}/unsubscribe")]
[Authorize] [Authorize]
public async Task<ActionResult> Unsubscribe(string name) public async Task<ActionResult> Unsubscribe(long publisherId)
{ {
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
// Check if the publisher exists // Check if the publisher exists
var publisher = await db.Publishers.FirstOrDefaultAsync(e => e.Name == name); var publisher = await db.Publishers.FindAsync(publisherId);
if (publisher == null) if (publisher == null)
return NotFound("Publisher not found"); return NotFound("Publisher not found");
var success = await subs.CancelSubscriptionAsync(currentUser.Id, publisher.Id); var success = await subs.CancelSubscriptionAsync(currentUser.Id, publisherId);
if (success) if (success)
return Ok(new { message = "Subscription cancelled successfully" }); return Ok(new { message = "Subscription cancelled successfully" });
@ -99,7 +114,7 @@ public class PublisherSubscriptionController(
/// Get all subscriptions for the current user /// Get all subscriptions for the current user
/// </summary> /// </summary>
/// <returns>List of active subscriptions</returns> /// <returns>List of active subscriptions</returns>
[HttpGet("subscriptions")] [HttpGet("current")]
[Authorize] [Authorize]
public async Task<ActionResult<List<PublisherSubscription>>> GetCurrentSubscriptions() public async Task<ActionResult<List<PublisherSubscription>>> GetCurrentSubscriptions()
{ {

View File

@ -12,7 +12,7 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// <param name="accountId">The account ID</param> /// <param name="accountId">The account ID</param>
/// <param name="publisherId">The publisher ID</param> /// <param name="publisherId">The publisher ID</param>
/// <returns>True if a subscription exists, false otherwise</returns> /// <returns>True if a subscription exists, false otherwise</returns>
public async Task<bool> SubscriptionExistsAsync(Guid accountId, Guid publisherId) public async Task<bool> SubscriptionExistsAsync(long accountId, long publisherId)
{ {
return await db.PublisherSubscriptions return await db.PublisherSubscriptions
.AnyAsync(ps => ps.AccountId == accountId && .AnyAsync(ps => ps.AccountId == accountId &&
@ -26,7 +26,7 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// <param name="accountId">The account ID</param> /// <param name="accountId">The account ID</param>
/// <param name="publisherId">The publisher ID</param> /// <param name="publisherId">The publisher ID</param>
/// <returns>The subscription or null if not found</returns> /// <returns>The subscription or null if not found</returns>
public async Task<PublisherSubscription?> GetSubscriptionAsync(Guid accountId, Guid publisherId) public async Task<PublisherSubscription?> GetSubscriptionAsync(long accountId, long publisherId)
{ {
return await db.PublisherSubscriptions return await db.PublisherSubscriptions
.Include(ps => ps.Publisher) .Include(ps => ps.Publisher)
@ -95,7 +95,7 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// </summary> /// </summary>
/// <param name="accountId">The account ID</param> /// <param name="accountId">The account ID</param>
/// <returns>A list of active subscriptions</returns> /// <returns>A list of active subscriptions</returns>
public async Task<List<PublisherSubscription>> GetAccountSubscriptionsAsync(Guid accountId) public async Task<List<PublisherSubscription>> GetAccountSubscriptionsAsync(long accountId)
{ {
return await db.PublisherSubscriptions return await db.PublisherSubscriptions
.Include(ps => ps.Publisher) .Include(ps => ps.Publisher)
@ -108,7 +108,7 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// </summary> /// </summary>
/// <param name="publisherId">The publisher ID</param> /// <param name="publisherId">The publisher ID</param>
/// <returns>A list of active subscriptions</returns> /// <returns>A list of active subscriptions</returns>
public async Task<List<PublisherSubscription>> GetPublisherSubscribersAsync(Guid publisherId) public async Task<List<PublisherSubscription>> GetPublisherSubscribersAsync(long publisherId)
{ {
return await db.PublisherSubscriptions return await db.PublisherSubscriptions
.Include(ps => ps.Account) .Include(ps => ps.Account)
@ -124,8 +124,8 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// <param name="tier">Optional subscription tier</param> /// <param name="tier">Optional subscription tier</param>
/// <returns>The created subscription</returns> /// <returns>The created subscription</returns>
public async Task<PublisherSubscription> CreateSubscriptionAsync( public async Task<PublisherSubscription> CreateSubscriptionAsync(
Guid accountId, long accountId,
Guid publisherId, long publisherId,
int tier = 0 int tier = 0
) )
{ {
@ -166,7 +166,7 @@ public class PublisherSubscriptionService(AppDatabase db, NotificationService nt
/// <param name="accountId">The account ID</param> /// <param name="accountId">The account ID</param>
/// <param name="publisherId">The publisher ID</param> /// <param name="publisherId">The publisher ID</param>
/// <returns>True if the subscription was cancelled, false if it wasn't found</returns> /// <returns>True if the subscription was cancelled, false if it wasn't found</returns>
public async Task<bool> CancelSubscriptionAsync(Guid accountId, Guid publisherId) public async Task<bool> CancelSubscriptionAsync(long accountId, long publisherId)
{ {
var subscription = await GetSubscriptionAsync(accountId, publisherId); var subscription = await GetSubscriptionAsync(accountId, publisherId);
if (subscription is not { Status: SubscriptionStatus.Active }) if (subscription is not { Status: SubscriptionStatus.Active })

View File

@ -10,7 +10,7 @@ namespace DysonNetwork.Sphere.Realm;
[Index(nameof(Slug), IsUnique = true)] [Index(nameof(Slug), IsUnique = true)]
public class Realm : ModelBase public class Realm : ModelBase
{ {
public Guid Id { get; set; } public long Id { get; set; }
[MaxLength(1024)] public string Slug { get; set; } = string.Empty; [MaxLength(1024)] public string Slug { get; set; } = string.Empty;
[MaxLength(1024)] public string Name { get; set; } = string.Empty; [MaxLength(1024)] public string Name { get; set; } = string.Empty;
[MaxLength(4096)] public string Description { get; set; } = string.Empty; [MaxLength(4096)] public string Description { get; set; } = string.Empty;
@ -27,7 +27,7 @@ public class Realm : ModelBase
[JsonIgnore] public ICollection<RealmMember> Members { get; set; } = new List<RealmMember>(); [JsonIgnore] public ICollection<RealmMember> Members { get; set; } = new List<RealmMember>();
[JsonIgnore] public ICollection<ChatRoom> ChatRooms { get; set; } = new List<ChatRoom>(); [JsonIgnore] public ICollection<ChatRoom> ChatRooms { get; set; } = new List<ChatRoom>();
public Guid AccountId { get; set; } public long AccountId { get; set; }
[JsonIgnore] public Account.Account Account { get; set; } = null!; [JsonIgnore] public Account.Account Account { get; set; } = null!;
} }
@ -40,9 +40,9 @@ public enum RealmMemberRole
public class RealmMember : ModelBase public class RealmMember : ModelBase
{ {
public Guid RealmId { get; set; } public long RealmId { get; set; }
public Realm Realm { get; set; } = null!; public Realm Realm { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
public Account.Account Account { get; set; } = null!; public Account.Account Account { get; set; } = null!;
public RealmMemberRole Role { get; set; } = RealmMemberRole.Normal; public RealmMemberRole Role { get; set; } = RealmMemberRole.Normal;

View File

@ -58,7 +58,7 @@ public class RealmController(AppDatabase db, RealmService rs, FileService fs) :
public class RealmMemberRequest public class RealmMemberRequest
{ {
[Required] public Guid RelatedUserId { get; set; } [Required] public long RelatedUserId { get; set; }
[Required] public RealmMemberRole Role { get; set; } [Required] public RealmMemberRole Role { get; set; }
} }

View File

@ -22,7 +22,7 @@ public class StickerPack : ModelBase
[MaxLength(4096)] public string Description { get; set; } = string.Empty; [MaxLength(4096)] public string Description { get; set; } = string.Empty;
[MaxLength(128)] public string Prefix { get; set; } = null!; [MaxLength(128)] public string Prefix { get; set; } = null!;
public Guid PublisherId { get; set; } public long PublisherId { get; set; }
public Post.Publisher Publisher { get; set; } = null!; public Post.Publisher Publisher { get; set; } = null!;
} }

View File

@ -41,7 +41,7 @@ public class CloudFile : ModelBase
public int UsedCount { get; set; } = 0; public int UsedCount { get; set; } = 0;
[JsonIgnore] public Account.Account Account { get; set; } = null!; [JsonIgnore] public Account.Account Account { get; set; } = null!;
public Guid AccountId { get; set; } public long AccountId { get; set; }
} }
public enum CloudFileSensitiveMark public enum CloudFileSensitiveMark

View File

@ -55,7 +55,7 @@ public class FileService(
case "image": case "image":
stream.Position = 0; stream.Position = 0;
// We still need ImageSharp for blurhash calculation // We still need ImageSharp for blurhash calculation
using (var imageSharp = await Image.LoadAsync<Rgba32>(stream)) using (var imageSharp = await SixLabors.ImageSharp.Image.LoadAsync<Rgba32>(stream))
{ {
var blurhash = Blurhasher.Encode(imageSharp, 3, 3); var blurhash = Blurhasher.Encode(imageSharp, 3, 3);