diff --git a/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.Designer.cs b/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.Designer.cs index cdcbf47..6a7a144 100644 --- a/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.Designer.cs +++ b/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.Designer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using DysonNetwork.Drive; using DysonNetwork.Drive.Storage; +using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.cs b/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.cs index 48977cd..54aa9f2 100644 --- a/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.cs +++ b/DysonNetwork.Drive/Migrations/20250713121317_InitialMigration.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using DysonNetwork.Drive.Storage; +using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; diff --git a/DysonNetwork.Drive/Migrations/AppDatabaseModelSnapshot.cs b/DysonNetwork.Drive/Migrations/AppDatabaseModelSnapshot.cs index e8d6e77..62b7a87 100644 --- a/DysonNetwork.Drive/Migrations/AppDatabaseModelSnapshot.cs +++ b/DysonNetwork.Drive/Migrations/AppDatabaseModelSnapshot.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using DysonNetwork.Drive; using DysonNetwork.Drive.Storage; +using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/DysonNetwork.Drive/Storage/CloudFile.cs b/DysonNetwork.Drive/Storage/CloudFile.cs index 81d9239..8ec116d 100644 --- a/DysonNetwork.Drive/Storage/CloudFile.cs +++ b/DysonNetwork.Drive/Storage/CloudFile.cs @@ -95,7 +95,7 @@ public class CloudFile : ModelBase, ICloudFile, IIdentifiedResource }; } - public string ResourceIdentifier => $"file/{Id}"; + public string ResourceIdentifier => $"file:{Id}"; /// /// Converts the CloudFile to a protobuf message @@ -138,23 +138,6 @@ public class CloudFile : ModelBase, ICloudFile, IIdentifiedResource } } -public enum ContentSensitiveMark -{ - Language, - SexualContent, - Violence, - Profanity, - HateSpeech, - Racism, - AdultContent, - DrugAbuse, - AlcoholAbuse, - Gambling, - SelfHarm, - ChildAbuse, - Other -} - public class CloudFileReference : ModelBase { public Guid Id { get; set; } = Guid.NewGuid(); diff --git a/DysonNetwork.Drive/Storage/FileReferenceService.cs b/DysonNetwork.Drive/Storage/FileReferenceService.cs index 94a704a..24d1de3 100644 --- a/DysonNetwork.Drive/Storage/FileReferenceService.cs +++ b/DysonNetwork.Drive/Storage/FileReferenceService.cs @@ -1,4 +1,5 @@ using DysonNetwork.Shared.Cache; +using EFCore.BulkExtensions; using Microsoft.EntityFrameworkCore; using NodaTime; @@ -19,11 +20,12 @@ public class FileReferenceService(AppDatabase db, FileService fileService, ICach /// Optional duration after which the file expires (alternative to expiredAt) /// The created file reference public async Task CreateReferenceAsync( - string fileId, - string usage, - string resourceId, - Instant? expiredAt = null, - Duration? duration = null) + string fileId, + string usage, + string resourceId, + Instant? expiredAt = null, + Duration? duration = null + ) { // Calculate expiration time if needed var finalExpiration = expiredAt; @@ -46,6 +48,25 @@ public class FileReferenceService(AppDatabase db, FileService fileService, ICach return reference; } + public async Task> CreateReferencesAsync( + List fileId, + string usage, + string resourceId, + Instant? expiredAt = null, + Duration? duration = null + ) + { + var data = fileId.Select(id => new CloudFileReference + { + FileId = id, + Usage = usage, + ResourceId = resourceId, + ExpiredAt = expiredAt ?? SystemClock.Instance.GetCurrentInstant() + duration + }).ToList(); + await db.BulkInsertAsync(data); + return data; + } + /// /// Gets all references to a file /// @@ -274,8 +295,8 @@ public class FileReferenceService(AppDatabase db, FileService fileService, ICach // Update newly added references with the expiration time var referenceIds = await db.FileReferences - .Where(r => toAdd.Select(a => a.FileId).Contains(r.FileId) && - r.ResourceId == resourceId && + .Where(r => toAdd.Select(a => a.FileId).Contains(r.FileId) && + r.ResourceId == resourceId && r.Usage == usage) .Select(r => r.Id) .ToListAsync(); @@ -431,4 +452,4 @@ public class FileReferenceService(AppDatabase db, FileService fileService, ICach return await SetReferenceExpirationAsync(referenceId, expiredAt); } -} +} \ No newline at end of file diff --git a/DysonNetwork.Drive/Storage/FileReferenceServiceGrpc.cs b/DysonNetwork.Drive/Storage/FileReferenceServiceGrpc.cs index 2a1459e..386b982 100644 --- a/DysonNetwork.Drive/Storage/FileReferenceServiceGrpc.cs +++ b/DysonNetwork.Drive/Storage/FileReferenceServiceGrpc.cs @@ -27,6 +27,27 @@ namespace DysonNetwork.Drive.Storage return reference.ToProtoValue(); } + public override async Task CreateReferenceBatch(CreateReferenceBatchRequest request, + ServerCallContext context) + { + Instant? expiredAt = null; + if (request.ExpiredAt != null) + expiredAt = Instant.FromUnixTimeSeconds(request.ExpiredAt.Seconds); + else if (request.Duration != null) + expiredAt = SystemClock.Instance.GetCurrentInstant() + + Duration.FromTimeSpan(request.Duration.ToTimeSpan()); + + var references = await fileReferenceService.CreateReferencesAsync( + request.FilesId.ToList(), + request.Usage, + request.ResourceId, + expiredAt + ); + var response = new CreateReferenceBatchResponse(); + response.References.AddRange(references.Select(r => r.ToProtoValue())); + return response; + } + public override async Task GetReferences(GetReferencesRequest request, ServerCallContext context) { diff --git a/DysonNetwork.Drive/Storage/FileService.cs b/DysonNetwork.Drive/Storage/FileService.cs index d18868d..6131a18 100644 --- a/DysonNetwork.Drive/Storage/FileService.cs +++ b/DysonNetwork.Drive/Storage/FileService.cs @@ -50,6 +50,51 @@ public class FileService( return file; } + + public async Task> GetFilesAsync(List fileIds) + { + var cachedFiles = new Dictionary(); + var uncachedIds = new List(); + + // Check cache first + foreach (var fileId in fileIds) + { + var cacheKey = $"{CacheKeyPrefix}{fileId}"; + var cachedFile = await cache.GetAsync(cacheKey); + + if (cachedFile != null) + { + cachedFiles[fileId] = cachedFile; + } + else + { + uncachedIds.Add(fileId); + } + } + + // Load uncached files from database + if (uncachedIds.Count > 0) + { + var dbFiles = await db.Files + .Where(f => uncachedIds.Contains(f.Id)) + .ToListAsync(); + + // Add to cache + foreach (var file in dbFiles) + { + var cacheKey = $"{CacheKeyPrefix}{file.Id}"; + await cache.SetAsync(cacheKey, file, CacheDuration); + cachedFiles[file.Id] = file; + } + } + + // Preserve original order + return fileIds + .Select(f => cachedFiles.GetValueOrDefault(f)) + .Where(f => f != null) + .Cast() + .ToList(); + } private static readonly string TempFilePrefix = "dyn-cloudfile"; @@ -155,7 +200,7 @@ public class FileService( try { var mediaInfo = await FFProbe.AnalyseAsync(ogFilePath); - file.FileMeta = new Dictionary + file.FileMeta = new Dictionary { ["duration"] = mediaInfo.Duration.TotalSeconds, ["format_name"] = mediaInfo.Format.FormatName, diff --git a/DysonNetwork.Drive/Storage/FileServiceGrpc.cs b/DysonNetwork.Drive/Storage/FileServiceGrpc.cs index 4b62afb..ba4c212 100644 --- a/DysonNetwork.Drive/Storage/FileServiceGrpc.cs +++ b/DysonNetwork.Drive/Storage/FileServiceGrpc.cs @@ -12,6 +12,12 @@ namespace DysonNetwork.Drive.Storage return file?.ToProtoValue() ?? throw new RpcException(new Status(StatusCode.NotFound, "File not found")); } + public override async Task GetFileBatch(GetFileBatchRequest request, ServerCallContext context) + { + var files = await fileService.GetFilesAsync(request.Ids.ToList()); + return new GetFileBatchResponse { Files = { files.Select(f => f.ToProtoValue()) } }; + } + public override async Task UpdateFile(UpdateFileRequest request, ServerCallContext context) { diff --git a/DysonNetwork.Pass/Account/AccountServiceGrpc.cs b/DysonNetwork.Pass/Account/AccountServiceGrpc.cs index d79d8ac..c94ae1d 100644 --- a/DysonNetwork.Pass/Account/AccountServiceGrpc.cs +++ b/DysonNetwork.Pass/Account/AccountServiceGrpc.cs @@ -9,6 +9,7 @@ namespace DysonNetwork.Pass.Account; public class AccountServiceGrpc( AppDatabase db, + RelationshipService relationships, IClock clock, ILogger logger ) @@ -19,7 +20,7 @@ public class AccountServiceGrpc( private readonly ILogger _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - + public override async Task GetAccount(GetAccountRequest request, ServerCallContext context) { if (!Guid.TryParse(request.Id, out var accountId)) @@ -36,7 +37,8 @@ public class AccountServiceGrpc( return account.ToProtoValue(); } - public override async Task GetAccountBatch(GetAccountBatchRequest request, ServerCallContext context) + public override async Task GetAccountBatch(GetAccountBatchRequest request, + ServerCallContext context) { var accountIds = request.Id .Select(id => Guid.TryParse(id, out var accountId) ? accountId : (Guid?)null) @@ -245,7 +247,8 @@ public class AccountServiceGrpc( return new Empty(); } - public override async Task ListContacts(ListContactsRequest request, ServerCallContext context) + public override async Task ListContacts(ListContactsRequest request, + ServerCallContext context) { if (!Guid.TryParse(request.AccountId, out var accountId)) throw new RpcException(new Grpc.Core.Status(StatusCode.InvalidArgument, "Invalid account ID format")); @@ -263,7 +266,8 @@ public class AccountServiceGrpc( return response; } - public override async Task VerifyContact(VerifyContactRequest request, ServerCallContext context) + public override async Task VerifyContact(VerifyContactRequest request, + ServerCallContext context) { // This is a placeholder implementation. In a real-world scenario, you would // have a more robust verification mechanism (e.g., sending a code to the @@ -343,7 +347,8 @@ public class AccountServiceGrpc( return response; } - public override async Task SetActiveBadge(SetActiveBadgeRequest request, ServerCallContext context) + public override async Task SetActiveBadge(SetActiveBadgeRequest request, + ServerCallContext context) { if (!Guid.TryParse(request.AccountId, out var accountId)) throw new RpcException(new Grpc.Core.Status(StatusCode.InvalidArgument, "Invalid account ID format")); @@ -359,4 +364,55 @@ public class AccountServiceGrpc( return profile.ToProtoValue(); } + + public override async Task ListFriends( + ListUserRelationshipSimpleRequest request, ServerCallContext context) + { + var accountId = Guid.Parse(request.AccountId); + var relationship = await relationships.ListAccountFriends(accountId); + var resp = new ListUserRelationshipSimpleResponse(); + resp.AccountsId.AddRange(relationship.Select(x => x.ToString())); + return resp; + } + + public override async Task ListBlocked( + ListUserRelationshipSimpleRequest request, ServerCallContext context) + { + var accountId = Guid.Parse(request.AccountId); + var relationship = await relationships.ListAccountBlocked(accountId); + var resp = new ListUserRelationshipSimpleResponse(); + resp.AccountsId.AddRange(relationship.Select(x => x.ToString())); + return resp; + } + + public override async Task GetRelationship(GetRelationshipRequest request, + ServerCallContext context) + { + var relationship = await relationships.GetRelationship( + Guid.Parse(request.AccountId), + Guid.Parse(request.RelatedId), + status: (RelationshipStatus?)request.Status + ); + return new GetRelationshipResponse + { + Relationship = relationship?.ToProtoValue() + }; + } + + public override async Task HasRelationship(GetRelationshipRequest request, ServerCallContext context) + { + var hasRelationship = false; + if (!request.HasStatus) + hasRelationship = await relationships.HasExistingRelationship( + Guid.Parse(request.AccountId), + Guid.Parse(request.RelatedId) + ); + else + hasRelationship = await relationships.HasRelationshipWithStatus( + Guid.Parse(request.AccountId), + Guid.Parse(request.RelatedId), + (RelationshipStatus)request.Status + ); + return new BoolValue { Value = hasRelationship }; + } } \ No newline at end of file diff --git a/DysonNetwork.Pass/Account/Relationship.cs b/DysonNetwork.Pass/Account/Relationship.cs index 9131b78..0b169b7 100644 --- a/DysonNetwork.Pass/Account/Relationship.cs +++ b/DysonNetwork.Pass/Account/Relationship.cs @@ -1,5 +1,7 @@ using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using NodaTime; +using NodaTime.Serialization.Protobuf; namespace DysonNetwork.Pass.Account; @@ -20,4 +22,15 @@ public class Relationship : ModelBase public Instant? ExpiredAt { get; set; } public RelationshipStatus Status { get; set; } = RelationshipStatus.Pending; + + public Shared.Proto.Relationship ToProtoValue() => new() + { + AccountId = AccountId.ToString(), + RelatedId = RelatedId.ToString(), + Account = Account.ToProtoValue(), + Related = Related.ToProtoValue(), + Type = (int)Status, + CreatedAt = CreatedAt.ToTimestamp(), + UpdatedAt = UpdatedAt.ToTimestamp() + }; } \ No newline at end of file diff --git a/DysonNetwork.Pass/Account/RelationshipService.cs b/DysonNetwork.Pass/Account/RelationshipService.cs index 20be861..0b2bc03 100644 --- a/DysonNetwork.Pass/Account/RelationshipService.cs +++ b/DysonNetwork.Pass/Account/RelationshipService.cs @@ -154,13 +154,18 @@ public class RelationshipService(AppDatabase db, ICacheService cache) public async Task> ListAccountFriends(Account account) { - var cacheKey = $"{UserFriendsCacheKeyPrefix}{account.Id}"; + return await ListAccountFriends(account.Id); + } + + public async Task> ListAccountFriends(Guid accountId) + { + var cacheKey = $"{UserFriendsCacheKeyPrefix}{accountId}"; var friends = await cache.GetAsync>(cacheKey); if (friends == null) { friends = await db.AccountRelationships - .Where(r => r.RelatedId == account.Id) + .Where(r => r.RelatedId == accountId) .Where(r => r.Status == RelationshipStatus.Friends) .Select(r => r.AccountId) .ToListAsync(); @@ -173,13 +178,18 @@ public class RelationshipService(AppDatabase db, ICacheService cache) public async Task> ListAccountBlocked(Account account) { - var cacheKey = $"{UserBlockedCacheKeyPrefix}{account.Id}"; + return await ListAccountBlocked(account.Id); + } + + public async Task> ListAccountBlocked(Guid accountId) + { + var cacheKey = $"{UserBlockedCacheKeyPrefix}{accountId}"; var blocked = await cache.GetAsync>(cacheKey); if (blocked == null) { blocked = await db.AccountRelationships - .Where(r => r.RelatedId == account.Id) + .Where(r => r.RelatedId == accountId) .Where(r => r.Status == RelationshipStatus.Blocked) .Select(r => r.AccountId) .ToListAsync(); diff --git a/DysonNetwork.Pass/Auth/AuthServiceGrpc.cs b/DysonNetwork.Pass/Auth/AuthServiceGrpc.cs index 996dab4..b3e956c 100644 --- a/DysonNetwork.Pass/Auth/AuthServiceGrpc.cs +++ b/DysonNetwork.Pass/Auth/AuthServiceGrpc.cs @@ -20,7 +20,7 @@ public class AuthServiceGrpc( { if (!authService.ValidateToken(request.Token, out var sessionId)) return new AuthenticateResponse { Valid = false, Message = "Invalid token." }; - + var session = await cache.GetAsync($"{DysonTokenAuthHandler.AuthCachePrefix}{sessionId}"); if (session is not null) return new AuthenticateResponse { Valid = true, Session = session.ToProtoValue() }; @@ -36,7 +36,7 @@ public class AuthServiceGrpc( var now = SystemClock.Instance.GetCurrentInstant(); if (session.ExpiredAt.HasValue && session.ExpiredAt < now) return new AuthenticateResponse { Valid = false, Message = "Session has been expired." }; - + await cache.SetWithGroupsAsync( $"auth:{sessionId}", session, @@ -46,4 +46,17 @@ public class AuthServiceGrpc( return new AuthenticateResponse { Valid = true, Session = session.ToProtoValue() }; } + + public override async Task ValidatePin(ValidatePinRequest request, ServerCallContext context) + { + var accountId = Guid.Parse(request.AccountId); + var valid = await authService.ValidatePinCode(accountId, request.Pin); + return new ValidateResponse { Valid = valid }; + } + + public override async Task ValidateCaptcha(ValidateCaptchaRequest request, ServerCallContext context) + { + var valid = await authService.ValidateCaptcha(request.Token); + return new ValidateResponse { Valid = valid }; + } } \ No newline at end of file diff --git a/DysonNetwork.Pass/Developer/CustomApp.cs b/DysonNetwork.Pass/Developer/CustomApp.cs index 731d8cc..2910dac 100644 --- a/DysonNetwork.Pass/Developer/CustomApp.cs +++ b/DysonNetwork.Pass/Developer/CustomApp.cs @@ -34,7 +34,7 @@ public class CustomApp : ModelBase, IIdentifiedResource // TODO: Publisher - [NotMapped] public string ResourceIdentifier => "custom-app/" + Id; + [NotMapped] public string ResourceIdentifier => "custom-app:" + Id; } public class CustomAppLinks diff --git a/DysonNetwork.Pass/DysonNetwork.Pass.csproj b/DysonNetwork.Pass/DysonNetwork.Pass.csproj index b781b58..bf6bab7 100644 --- a/DysonNetwork.Pass/DysonNetwork.Pass.csproj +++ b/DysonNetwork.Pass/DysonNetwork.Pass.csproj @@ -100,12 +100,16 @@ + + + + diff --git a/DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml b/DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml similarity index 97% rename from DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml rename to DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml index cd392bc..ebb8e27 100644 --- a/DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml +++ b/DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml @@ -1,5 +1,5 @@ @page "/auth/captcha" -@model DysonNetwork.Sphere.Pages.Checkpoint.CheckpointPage +@model DysonNetwork.Pass.Pages.Checkpoint.CheckpointPage @{ ViewData["Title"] = "Security Checkpoint"; @@ -99,7 +99,7 @@
Hosted by - DysonNetwork.Sphere + DysonNetwork.Pass diff --git a/DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml.cs b/DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml.cs similarity index 86% rename from DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml.cs rename to DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml.cs index 69f53e9..ac561ce 100644 --- a/DysonNetwork.Sphere/Pages/Checkpoint/CheckpointPage.cshtml.cs +++ b/DysonNetwork.Pass/Pages/Checkpoint/CheckpointPage.cshtml.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -namespace DysonNetwork.Sphere.Pages.Checkpoint; +namespace DysonNetwork.Pass.Pages.Checkpoint; public class CheckpointPage(IConfiguration configuration) : PageModel { diff --git a/DysonNetwork.Pass/Pages/Shared/_Layout.cshtml b/DysonNetwork.Pass/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..7f063bf --- /dev/null +++ b/DysonNetwork.Pass/Pages/Shared/_Layout.cshtml @@ -0,0 +1,62 @@ +@using DysonNetwork.Pass.Auth + + + + + + + @ViewData["Title"] + + + + + + + @await RenderSectionAsync("Head", required: false) + + + + +
+ @RenderBody() +
+ +@await RenderSectionAsync("Scripts", required: false) + + \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml b/DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml similarity index 97% rename from DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml rename to DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml index 1828549..bd92e93 100644 --- a/DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml +++ b/DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml @@ -1,6 +1,6 @@ @page "/spells/{spellWord}" -@using DysonNetwork.Sphere.Account -@model DysonNetwork.Sphere.Pages.Spell.MagicSpellPage +@using DysonNetwork.Pass.Account +@model DysonNetwork.Pass.Pages.Spell.MagicSpellPage @{ ViewData["Title"] = "Magic Spell"; @@ -82,7 +82,7 @@
Powered by - DysonNetwork.Sphere + DysonNetwork.Pass diff --git a/DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml.cs b/DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml.cs similarity index 95% rename from DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml.cs rename to DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml.cs index 45dc2b7..14d57a9 100644 --- a/DysonNetwork.Sphere/Pages/Spell/MagicSpellPage.cshtml.cs +++ b/DysonNetwork.Pass/Pages/Spell/MagicSpellPage.cshtml.cs @@ -1,10 +1,10 @@ -using DysonNetwork.Sphere.Account; +using DysonNetwork.Pass.Account; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using NodaTime; -namespace DysonNetwork.Sphere.Pages.Spell; +namespace DysonNetwork.Pass.Pages.Spell; public class MagicSpellPage(AppDatabase db, MagicSpellService spells) : PageModel { diff --git a/DysonNetwork.Pass/Pages/_ViewImports.cshtml b/DysonNetwork.Pass/Pages/_ViewImports.cshtml new file mode 100644 index 0000000..4b4ce1d --- /dev/null +++ b/DysonNetwork.Pass/Pages/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@namespace DysonNetwork.Pass.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/DysonNetwork.Pass/Pages/_ViewStart.cshtml b/DysonNetwork.Pass/Pages/_ViewStart.cshtml new file mode 100644 index 0000000..40c70bc --- /dev/null +++ b/DysonNetwork.Pass/Pages/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/DysonNetwork.Shared/Content/TextSanitizer.cs b/DysonNetwork.Shared/Content/TextSanitizer.cs new file mode 100644 index 0000000..6092a31 --- /dev/null +++ b/DysonNetwork.Shared/Content/TextSanitizer.cs @@ -0,0 +1,40 @@ +using System.Text; +using System.Globalization; +using System.Text.RegularExpressions; + +namespace DysonNetwork.Shared.Content; + +public abstract partial class TextSanitizer +{ + [GeneratedRegex(@"[\u0000-\u001F\u007F\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFFF0-\uFFFF]")] + private static partial Regex WeirdUnicodeRegex(); + + [GeneratedRegex(@"[\r\n]+")] + private static partial Regex NewlineRegex(); + + public static string? Sanitize(string? text) + { + if (text is null) return null; + + // Normalize weird Unicode characters + var cleaned = WeirdUnicodeRegex().Replace(text, ""); + + // Normalize bold/italic/fancy unicode letters to ASCII + cleaned = NormalizeFancyUnicode(cleaned); + + // Replace multiple newlines with a single newline + cleaned = NewlineRegex().Replace(cleaned, "\n"); + + return cleaned; + } + + private static string NormalizeFancyUnicode(string input) + { + var sb = new StringBuilder(input.Length); + foreach (var c in input.Normalize(NormalizationForm.FormKC).Where(c => + char.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)) + sb.Append(c); + + return sb.ToString(); + } +} \ No newline at end of file diff --git a/DysonNetwork.Shared/CultureService.cs b/DysonNetwork.Shared/CultureService.cs new file mode 100644 index 0000000..2c6db7d --- /dev/null +++ b/DysonNetwork.Shared/CultureService.cs @@ -0,0 +1,19 @@ +using System.Globalization; +using DysonNetwork.Shared.Proto; + +namespace DysonNetwork.Shared; + +public static class CultureService +{ + public static void SetCultureInfo(string? languageCode) + { + var info = new CultureInfo(languageCode ?? "en-us", false); + CultureInfo.CurrentCulture = info; + CultureInfo.CurrentUICulture = info; + } + + public static void SetCultureInfo(Account account) + { + SetCultureInfo(account.Language); + } +} \ No newline at end of file diff --git a/DysonNetwork.Shared/Data/CloudFileReferenceObject.cs b/DysonNetwork.Shared/Data/CloudFileReferenceObject.cs index 4866115..ec69d00 100644 --- a/DysonNetwork.Shared/Data/CloudFileReferenceObject.cs +++ b/DysonNetwork.Shared/Data/CloudFileReferenceObject.cs @@ -3,6 +3,23 @@ using Google.Protobuf.WellKnownTypes; namespace DysonNetwork.Shared.Data; +public enum ContentSensitiveMark +{ + Language, + SexualContent, + Violence, + Profanity, + HateSpeech, + Racism, + AdultContent, + DrugAbuse, + AlcoholAbuse, + Gambling, + SelfHarm, + ChildAbuse, + Other +} + /// /// The class that used in jsonb columns which referenced the cloud file. /// The aim of this class is to store some properties that won't change to a file to reduce the database load. diff --git a/DysonNetwork.Pass/Account/VerificationMark.cs b/DysonNetwork.Shared/Data/VerificationMark.cs similarity index 97% rename from DysonNetwork.Pass/Account/VerificationMark.cs rename to DysonNetwork.Shared/Data/VerificationMark.cs index dbd4159..f22febd 100644 --- a/DysonNetwork.Pass/Account/VerificationMark.cs +++ b/DysonNetwork.Shared/Data/VerificationMark.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace DysonNetwork.Pass.Account; +namespace DysonNetwork.Shared.Data; /// /// The verification info of a resource diff --git a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs index 49ce2c6..f254575 100644 --- a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs +++ b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs @@ -73,4 +73,28 @@ public static class GrpcClientHelper return new PusherService.PusherServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, clientCertPassword)); } + + public static async Task CreateFileServiceClient( + IEtcdClient etcdClient, + string clientCertPath, + string clientKeyPath, + string? clientCertPassword = null + ) + { + var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.File"); + return new FileService.FileServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, + clientCertPassword)); + } + + public static async Task CreateFileReferenceServiceClient( + IEtcdClient etcdClient, + string clientCertPath, + string clientKeyPath, + string? clientCertPassword = null + ) + { + var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.FileReference"); + return new FileReferenceService.FileReferenceServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, + clientCertPassword)); + } } \ No newline at end of file diff --git a/DysonNetwork.Shared/Proto/account.proto b/DysonNetwork.Shared/Proto/account.proto index dd332e6..c66e304 100644 --- a/DysonNetwork.Shared/Proto/account.proto +++ b/DysonNetwork.Shared/Proto/account.proto @@ -20,7 +20,7 @@ message Account { string language = 4; google.protobuf.Timestamp activated_at = 5; bool is_superuser = 6; - + AccountProfile profile = 7; repeated AccountContact contacts = 8; repeated AccountBadge badges = 9; @@ -43,17 +43,17 @@ message AccountProfile { google.protobuf.StringValue location = 9; google.protobuf.Timestamp birthday = 10; google.protobuf.Timestamp last_seen_at = 11; - + VerificationMark verification = 12; BadgeReferenceObject active_badge = 13; - + int32 experience = 14; int32 level = 15; double leveling_progress = 16; - + CloudFile picture = 19; CloudFile background = 20; - + string account_id = 21; } @@ -155,24 +155,15 @@ message BadgeReferenceObject { // Relationship represents a connection between two accounts message Relationship { - string id = 1; - string from_account_id = 2; - string to_account_id = 3; - RelationshipType type = 4; - string note = 5; + string account_id = 1; + string related_id = 2; + optional Account account = 3; + optional Account related = 4; + int32 type = 5; google.protobuf.Timestamp created_at = 6; google.protobuf.Timestamp updated_at = 7; } -// Enum for relationship types -enum RelationshipType { - RELATIONSHIP_TYPE_UNSPECIFIED = 0; - FRIEND = 1; - BLOCKED = 2; - PENDING_INCOMING = 3; - PENDING_OUTGOING = 4; -} - // Leveling information message LevelingInfo { int32 current_level = 1; @@ -192,43 +183,30 @@ service AccountService { // Account Operations rpc GetAccount(GetAccountRequest) returns (Account) {} rpc GetAccountBatch(GetAccountBatchRequest) returns (GetAccountBatchResponse) {} - rpc CreateAccount(CreateAccountRequest) returns (Account) {} - rpc UpdateAccount(UpdateAccountRequest) returns (Account) {} - rpc DeleteAccount(DeleteAccountRequest) returns (google.protobuf.Empty) {} rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) {} - + // Profile Operations rpc GetProfile(GetProfileRequest) returns (AccountProfile) {} - rpc UpdateProfile(UpdateProfileRequest) returns (AccountProfile) {} - + // Contact Operations - rpc AddContact(AddContactRequest) returns (AccountContact) {} - rpc UpdateContact(UpdateContactRequest) returns (AccountContact) {} - rpc RemoveContact(RemoveContactRequest) returns (google.protobuf.Empty) {} rpc ListContacts(ListContactsRequest) returns (ListContactsResponse) {} - rpc VerifyContact(VerifyContactRequest) returns (AccountContact) {} - + // Badge Operations - rpc AddBadge(AddBadgeRequest) returns (AccountBadge) {} - rpc RemoveBadge(RemoveBadgeRequest) returns (google.protobuf.Empty) {} rpc ListBadges(ListBadgesRequest) returns (ListBadgesResponse) {} - rpc SetActiveBadge(SetActiveBadgeRequest) returns (AccountProfile) {} - + // Authentication Factor Operations - rpc AddAuthFactor(AddAuthFactorRequest) returns (AccountAuthFactor) {} - rpc RemoveAuthFactor(RemoveAuthFactorRequest) returns (google.protobuf.Empty) {} rpc ListAuthFactors(ListAuthFactorsRequest) returns (ListAuthFactorsResponse) {} - + // Connection Operations - rpc AddConnection(AddConnectionRequest) returns (AccountConnection) {} - rpc RemoveConnection(RemoveConnectionRequest) returns (google.protobuf.Empty) {} rpc ListConnections(ListConnectionsRequest) returns (ListConnectionsResponse) {} - + // Relationship Operations - rpc CreateRelationship(CreateRelationshipRequest) returns (Relationship) {} - rpc UpdateRelationship(UpdateRelationshipRequest) returns (Relationship) {} - rpc DeleteRelationship(DeleteRelationshipRequest) returns (google.protobuf.Empty) {} rpc ListRelationships(ListRelationshipsRequest) returns (ListRelationshipsResponse) {} + + rpc GetRelationship(GetRelationshipRequest) returns (GetRelationshipResponse) {} + rpc HasRelationship(GetRelationshipRequest) returns (google.protobuf.BoolValue) {} + rpc ListFriends(ListUserRelationshipSimpleRequest) returns (ListUserRelationshipSimpleResponse) {} + rpc ListBlocked(ListUserRelationshipSimpleRequest) returns (ListUserRelationshipSimpleResponse) {} } // ==================================== @@ -301,18 +279,6 @@ message AddContactRequest { bool is_primary = 4; // If this should be the primary contact } -message UpdateContactRequest { - string id = 1; // Contact ID to update - string account_id = 2; // Account ID (for validation) - google.protobuf.StringValue content = 3; // New contact content - google.protobuf.BoolValue is_primary = 4; // New primary status -} - -message RemoveContactRequest { - string id = 1; // Contact ID to remove - string account_id = 2; // Account ID (for validation) -} - message ListContactsRequest { string account_id = 1; // Account ID to list contacts for AccountContactType type = 2; // Optional: filter by type @@ -330,20 +296,6 @@ message VerifyContactRequest { } // Badge Requests/Responses -message AddBadgeRequest { - string account_id = 1; // Account to add badge to - string type = 2; // Type of badge - google.protobuf.StringValue label = 3; // Display label - google.protobuf.StringValue caption = 4; // Description - map meta = 5; // Additional metadata - google.protobuf.Timestamp expired_at = 6; // Optional expiration -} - -message RemoveBadgeRequest { - string id = 1; // Badge ID to remove - string account_id = 2; // Account ID (for validation) -} - message ListBadgesRequest { string account_id = 1; // Account to list badges for string type = 2; // Optional: filter by type @@ -354,26 +306,6 @@ message ListBadgesResponse { repeated AccountBadge badges = 1; // List of badges } -message SetActiveBadgeRequest { - string account_id = 1; // Account to update - string badge_id = 2; // Badge ID to set as active (empty to clear) -} - -// Authentication Factor Requests/Responses -message AddAuthFactorRequest { - string account_id = 1; // Account to add factor to - AccountAuthFactorType type = 2; // Type of factor - string secret = 3; // Factor secret (hashed on server) - map config = 4; // Configuration - int32 trustworthy = 5; // Trust level - google.protobuf.Timestamp expired_at = 6; // Optional expiration -} - -message RemoveAuthFactorRequest { - string id = 1; // Factor ID to remove - string account_id = 2; // Account ID (for validation) -} - message ListAuthFactorsRequest { string account_id = 1; // Account to list factors for bool active_only = 2; // Only return active (non-expired) factors @@ -383,21 +315,6 @@ message ListAuthFactorsResponse { repeated AccountAuthFactor factors = 1; // List of auth factors } -// Connection Requests/Responses -message AddConnectionRequest { - string account_id = 1; // Account to add connection to - string provider = 2; // Provider name (e.g., "google", "github") - string provided_identifier = 3; // Provider's user ID - map meta = 4; // Additional metadata - google.protobuf.StringValue access_token = 5; // OAuth access token - google.protobuf.StringValue refresh_token = 6; // OAuth refresh token -} - -message RemoveConnectionRequest { - string id = 1; // Connection ID to remove - string account_id = 2; // Account ID (for validation) -} - message ListConnectionsRequest { string account_id = 1; // Account to list connections for string provider = 2; // Optional: filter by provider @@ -408,30 +325,9 @@ message ListConnectionsResponse { } // Relationship Requests/Responses -message CreateRelationshipRequest { - string from_account_id = 1; // Source account ID - string to_account_id = 2; // Target account ID - RelationshipType type = 3; // Type of relationship - string note = 4; // Optional note -} - -message UpdateRelationshipRequest { - string id = 1; // Relationship ID to update - string account_id = 2; // Account ID (for validation) - RelationshipType type = 3; // New relationship type - google.protobuf.StringValue note = 4; // New note -} - -message DeleteRelationshipRequest { - string id = 1; // Relationship ID to delete - string account_id = 2; // Account ID (for validation) -} - message ListRelationshipsRequest { string account_id = 1; // Account to list relationships for - RelationshipType type = 2; // Optional: filter by type - bool incoming = 3; // If true, list incoming relationships - bool outgoing = 4; // If true, list outgoing relationships + optional int32 status = 2; // Filter by status int32 page_size = 5; // Number of results per page string page_token = 6; // Token for pagination } @@ -442,3 +338,20 @@ message ListRelationshipsResponse { int32 total_size = 3; // Total number of relationships } +message GetRelationshipRequest { + string account_id = 1; + string related_id = 2; + optional int32 status = 3; +} + +message GetRelationshipResponse { + optional Relationship relationship = 1; +} + +message ListUserRelationshipSimpleRequest { + string account_id = 1; +} + +message ListUserRelationshipSimpleResponse { + repeated string accounts_id = 1; +} \ No newline at end of file diff --git a/DysonNetwork.Shared/Proto/auth.proto b/DysonNetwork.Shared/Proto/auth.proto index 2b70f8c..6c4216f 100644 --- a/DysonNetwork.Shared/Proto/auth.proto +++ b/DysonNetwork.Shared/Proto/auth.proto @@ -65,6 +65,9 @@ enum ChallengePlatform { service AuthService { rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {} + + rpc ValidatePin(ValidatePinRequest) returns (ValidateResponse) {} + rpc ValidateCaptcha(ValidateCaptchaRequest) returns (ValidateResponse) {} } message AuthenticateRequest { @@ -77,6 +80,19 @@ message AuthenticateResponse { optional AuthSession session = 3; } +message ValidatePinRequest { + string account_id = 1; + string pin = 2; +} + +message ValidateCaptchaRequest { + string token = 1; +} + +message ValidateResponse { + bool valid = 1; +} + // Permission related messages and services message PermissionNode { string id = 1; diff --git a/DysonNetwork.Shared/Proto/file.proto b/DysonNetwork.Shared/Proto/file.proto index 8ba4d8e..1040410 100644 --- a/DysonNetwork.Shared/Proto/file.proto +++ b/DysonNetwork.Shared/Proto/file.proto @@ -51,6 +51,7 @@ message CloudFile { service FileService { // Get file reference by ID rpc GetFile(GetFileRequest) returns (CloudFile); + rpc GetFileBatch(GetFileBatchRequest) returns (GetFileBatchResponse); // Update an existing file reference rpc UpdateFile(UpdateFileRequest) returns (CloudFile); @@ -73,6 +74,14 @@ message GetFileRequest { string id = 1; } +message GetFileBatchRequest { + repeated string ids = 1; +} + +message GetFileBatchResponse { + repeated CloudFile files = 1; +} + // Request message for UpdateFile message UpdateFileRequest { CloudFile file = 1; @@ -157,6 +166,18 @@ message CreateReferenceRequest { optional google.protobuf.Duration duration = 5; // Alternative to expired_at } +message CreateReferenceBatchRequest { + repeated string files_id = 1; + string usage = 2; + string resource_id = 3; + optional google.protobuf.Timestamp expired_at = 4; + optional google.protobuf.Duration duration = 5; // Alternative to expired_at +} + +message CreateReferenceBatchResponse { + repeated CloudFileReference references = 1; +} + message GetReferencesRequest { string file_id = 1; } @@ -239,6 +260,7 @@ message HasFileReferencesResponse { service FileReferenceService { // Creates a new reference to a file for a specific resource rpc CreateReference(CreateReferenceRequest) returns (CloudFileReference); + rpc CreateReferenceBatch(CreateReferenceBatchRequest) returns (CreateReferenceBatchResponse); // Gets all references to a file rpc GetReferences(GetReferencesRequest) returns (GetReferencesResponse); diff --git a/DysonNetwork.Shared/Registry/ServiceHelper.cs b/DysonNetwork.Shared/Registry/ServiceHelper.cs index 6b2f18b..cf67ccb 100644 --- a/DysonNetwork.Shared/Registry/ServiceHelper.cs +++ b/DysonNetwork.Shared/Registry/ServiceHelper.cs @@ -44,4 +44,37 @@ public static class ServiceHelper return services; } + + public static IServiceCollection AddDriveService(this IServiceCollection services) + { + services.AddSingleton(sp => + { + var etcdClient = sp.GetRequiredService(); + var config = sp.GetRequiredService(); + var clientCertPath = config["Service:ClientCert"]!; + var clientKeyPath = config["Service:ClientKey"]!; + var clientCertPassword = config["Service:CertPassword"]; + + return GrpcClientHelper + .CreateFileServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword) + .GetAwaiter() + .GetResult(); + }); + + services.AddSingleton(sp => + { + var etcdClient = sp.GetRequiredService(); + var config = sp.GetRequiredService(); + var clientCertPath = config["Service:ClientCert"]!; + var clientKeyPath = config["Service:ClientKey"]!; + var clientCertPassword = config["Service:CertPassword"]; + + return GrpcClientHelper + .CreateFileReferenceServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword) + .GetAwaiter() + .GetResult(); + }); + + return services; + } } \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AbuseReport.cs b/DysonNetwork.Sphere/Account/AbuseReport.cs deleted file mode 100644 index 87c1be1..0000000 --- a/DysonNetwork.Sphere/Account/AbuseReport.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public enum AbuseReportType -{ - Copyright, - Harassment, - Impersonation, - OffensiveContent, - Spam, - PrivacyViolation, - IllegalContent, - Other -} - -public class AbuseReport : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(4096)] public string ResourceIdentifier { get; set; } = null!; - public AbuseReportType Type { get; set; } - [MaxLength(8192)] public string Reason { get; set; } = null!; - - public Instant? ResolvedAt { get; set; } - [MaxLength(8192)] public string? Resolution { get; set; } - - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/Account.cs b/DysonNetwork.Sphere/Account/Account.cs deleted file mode 100644 index 5d05364..0000000 --- a/DysonNetwork.Sphere/Account/Account.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using NodaTime; -using OtpNet; - -namespace DysonNetwork.Sphere.Account; - -[Index(nameof(Name), IsUnique = true)] -public class Account : ModelBase -{ - public Guid Id { get; set; } - [MaxLength(256)] public string Name { get; set; } = string.Empty; - [MaxLength(256)] public string Nick { get; set; } = string.Empty; - [MaxLength(32)] public string Language { get; set; } = string.Empty; - public Instant? ActivatedAt { get; set; } - public bool IsSuperuser { get; set; } = false; - - public Profile Profile { get; set; } = null!; - public ICollection Contacts { get; set; } = new List(); - public ICollection Badges { get; set; } = new List(); - - [JsonIgnore] public ICollection AuthFactors { get; set; } = new List(); - [JsonIgnore] public ICollection Connections { get; set; } = new List(); - [JsonIgnore] public ICollection Sessions { get; set; } = new List(); - [JsonIgnore] public ICollection Challenges { get; set; } = new List(); - - [JsonIgnore] public ICollection OutgoingRelationships { get; set; } = new List(); - [JsonIgnore] public ICollection IncomingRelationships { get; set; } = new List(); - - [JsonIgnore] public ICollection Subscriptions { get; set; } = new List(); -} - -public abstract class Leveling -{ - public static readonly List ExperiencePerLevel = - [ - 0, // Level 0 - 100, // Level 1 - 250, // Level 2 - 500, // Level 3 - 1000, // Level 4 - 2000, // Level 5 - 4000, // Level 6 - 8000, // Level 7 - 16000, // Level 8 - 32000, // Level 9 - 64000, // Level 10 - 128000, // Level 11 - 256000, // Level 12 - 512000, // Level 13 - 1024000 // Level 14 - ]; -} - -public class Profile : ModelBase -{ - public Guid Id { get; set; } - [MaxLength(256)] public string? FirstName { get; set; } - [MaxLength(256)] public string? MiddleName { get; set; } - [MaxLength(256)] public string? LastName { get; set; } - [MaxLength(4096)] public string? Bio { get; set; } - [MaxLength(1024)] public string? Gender { get; set; } - [MaxLength(1024)] public string? Pronouns { get; set; } - [MaxLength(1024)] public string? TimeZone { get; set; } - [MaxLength(1024)] public string? Location { get; set; } - public Instant? Birthday { get; set; } - public Instant? LastSeenAt { get; set; } - - [Column(TypeName = "jsonb")] public VerificationMark? Verification { get; set; } - [Column(TypeName = "jsonb")] public BadgeReferenceObject? ActiveBadge { get; set; } - [Column(TypeName = "jsonb")] public SubscriptionReferenceObject? StellarMembership { get; set; } - - public int Experience { get; set; } = 0; - [NotMapped] public int Level => Leveling.ExperiencePerLevel.Count(xp => Experience >= xp) - 1; - - [NotMapped] - public double LevelingProgress => Level >= Leveling.ExperiencePerLevel.Count - 1 - ? 100 - : (Experience - Leveling.ExperiencePerLevel[Level]) * 100.0 / - (Leveling.ExperiencePerLevel[Level + 1] - Leveling.ExperiencePerLevel[Level]); - - // Outdated fields, for backward compability - [MaxLength(32)] public string? PictureId { get; set; } - [MaxLength(32)] public string? BackgroundId { get; set; } - - [Column(TypeName = "jsonb")] public CloudFileReferenceObject? Picture { get; set; } - [Column(TypeName = "jsonb")] public CloudFileReferenceObject? Background { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; -} - -public class AccountContact : ModelBase -{ - public Guid Id { get; set; } - public AccountContactType Type { get; set; } - public Instant? VerifiedAt { get; set; } - public bool IsPrimary { get; set; } = false; - [MaxLength(1024)] public string Content { get; set; } = string.Empty; - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; -} - -public enum AccountContactType -{ - Email, - PhoneNumber, - Address -} - -public class AccountAuthFactor : ModelBase -{ - public Guid Id { get; set; } - public AccountAuthFactorType Type { get; set; } - [JsonIgnore] [MaxLength(8196)] public string? Secret { get; set; } - - [JsonIgnore] - [Column(TypeName = "jsonb")] - public Dictionary? Config { get; set; } = new(); - - /// - /// The trustworthy stands for how safe is this auth factor. - /// Basically, it affects how many steps it can complete in authentication. - /// Besides, users may need to use some high-trustworthy level auth factors when confirming some dangerous operations. - /// - public int Trustworthy { get; set; } = 1; - - public Instant? EnabledAt { get; set; } - public Instant? ExpiredAt { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; - - public AccountAuthFactor HashSecret(int cost = 12) - { - if (Secret == null) return this; - Secret = BCrypt.Net.BCrypt.HashPassword(Secret, workFactor: cost); - return this; - } - - public bool VerifyPassword(string password) - { - if (Secret == null) - throw new InvalidOperationException("Auth factor with no secret cannot be verified with password."); - switch (Type) - { - case AccountAuthFactorType.Password: - case AccountAuthFactorType.PinCode: - return BCrypt.Net.BCrypt.Verify(password, Secret); - case AccountAuthFactorType.TimedCode: - var otp = new Totp(Base32Encoding.ToBytes(Secret)); - return otp.VerifyTotp(DateTime.UtcNow, password, out _, new VerificationWindow(previous: 5, future: 5)); - case AccountAuthFactorType.EmailCode: - case AccountAuthFactorType.InAppCode: - default: - throw new InvalidOperationException("Unsupported verification type, use CheckDeliveredCode instead."); - } - } - - /// - /// This dictionary will be returned to the client and should only be set when it just created. - /// Useful for passing the client some data to finishing setup and recovery code. - /// - [NotMapped] - public Dictionary? CreatedResponse { get; set; } -} - -public enum AccountAuthFactorType -{ - Password, - EmailCode, - InAppCode, - TimedCode, - PinCode, -} - -public class AccountConnection : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(4096)] public string Provider { get; set; } = null!; - [MaxLength(8192)] public string ProvidedIdentifier { get; set; } = null!; - [Column(TypeName = "jsonb")] public Dictionary? Meta { get; set; } = new(); - - [JsonIgnore] [MaxLength(4096)] public string? AccessToken { get; set; } - [JsonIgnore] [MaxLength(4096)] public string? RefreshToken { get; set; } - public Instant? LastUsedAt { get; set; } - - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AccountController.cs b/DysonNetwork.Sphere/Account/AccountController.cs deleted file mode 100644 index 1e68f22..0000000 --- a/DysonNetwork.Sphere/Account/AccountController.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Permission; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NodaTime; -using NodaTime.Extensions; -using System.Collections.Generic; - -namespace DysonNetwork.Sphere.Account; - -[ApiController] -[Route("/api/accounts")] -public class AccountController( - AppDatabase db, - AuthService auth, - AccountService accounts, - AccountEventService events -) : ControllerBase -{ - [HttpGet("{name}")] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> GetByName(string name) - { - var account = await db.Accounts - .Include(e => e.Badges) - .Include(e => e.Profile) - .Where(a => a.Name == name) - .FirstOrDefaultAsync(); - return account is null ? new NotFoundResult() : account; - } - - [HttpGet("{name}/badges")] - [ProducesResponseType>(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task>> 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 - { - [Required] - [MinLength(2)] - [MaxLength(256)] - [RegularExpression(@"^[A-Za-z0-9_-]+$", - ErrorMessage = "Name can only contain letters, numbers, underscores, and hyphens.") - ] - public string Name { get; set; } = string.Empty; - - [Required] [MaxLength(256)] public string Nick { get; set; } = string.Empty; - - [EmailAddress] - [RegularExpression(@"^[^+]+@[^@]+\.[^@]+$", ErrorMessage = "Email address cannot contain '+' symbol.")] - [Required] - [MaxLength(1024)] - public string Email { get; set; } = string.Empty; - - [Required] - [MinLength(4)] - [MaxLength(128)] - public string Password { get; set; } = string.Empty; - - [MaxLength(128)] public string Language { get; set; } = "en-us"; - - [Required] public string CaptchaToken { get; set; } = string.Empty; - } - - [HttpPost] - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task> CreateAccount([FromBody] AccountCreateRequest request) - { - if (!await auth.ValidateCaptcha(request.CaptchaToken)) return BadRequest("Invalid captcha token."); - - try - { - var account = await accounts.CreateAccount( - request.Name, - request.Nick, - request.Email, - request.Password, - request.Language - ); - return Ok(account); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - public class RecoveryPasswordRequest - { - [Required] public string Account { get; set; } = null!; - [Required] public string CaptchaToken { get; set; } = null!; - } - - [HttpPost("recovery/password")] - public async Task RequestResetPassword([FromBody] RecoveryPasswordRequest request) - { - if (!await auth.ValidateCaptcha(request.CaptchaToken)) return BadRequest("Invalid captcha token."); - - var account = await accounts.LookupAccount(request.Account); - if (account is null) return BadRequest("Unable to find the account."); - - try - { - await accounts.RequestPasswordReset(account); - } - catch (InvalidOperationException) - { - return BadRequest("You already requested password reset within 24 hours."); - } - - return Ok(); - } - - public class StatusRequest - { - public StatusAttitude Attitude { get; set; } - public bool IsInvisible { get; set; } - public bool IsNotDisturb { get; set; } - [MaxLength(1024)] public string? Label { get; set; } - public Instant? ClearedAt { get; set; } - } - - [HttpGet("{name}/statuses")] - public async Task> GetOtherStatus(string name) - { - var account = await db.Accounts.FirstOrDefaultAsync(a => a.Name == name); - if (account is null) return BadRequest(); - var status = await events.GetStatus(account.Id); - status.IsInvisible = false; // Keep the invisible field not available for other users - return Ok(status); - } - - [HttpGet("{name}/calendar")] - public async Task>> GetOtherEventCalendar( - string name, - [FromQuery] int? month, - [FromQuery] int? year - ) - { - var currentDate = SystemClock.Instance.GetCurrentInstant().InUtc().Date; - month ??= currentDate.Month; - year ??= currentDate.Year; - - if (month is < 1 or > 12) return BadRequest("Invalid month."); - if (year < 1) return BadRequest("Invalid year."); - - var account = await db.Accounts.FirstOrDefaultAsync(a => a.Name == name); - if (account is null) return BadRequest(); - - var calendar = await events.GetEventCalendar(account, month.Value, year.Value, replaceInvisible: true); - return Ok(calendar); - } - - [HttpGet("search")] - public async Task> Search([FromQuery] string query, [FromQuery] int take = 20) - { - if (string.IsNullOrWhiteSpace(query)) - return []; - return await db.Accounts - .Include(e => e.Profile) - .Where(a => EF.Functions.ILike(a.Name, $"%{query}%") || - EF.Functions.ILike(a.Nick, $"%{query}%")) - .Take(take) - .ToListAsync(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AccountCurrentController.cs b/DysonNetwork.Sphere/Account/AccountCurrentController.cs deleted file mode 100644 index 2230006..0000000 --- a/DysonNetwork.Sphere/Account/AccountCurrentController.cs +++ /dev/null @@ -1,703 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Storage; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Org.BouncyCastle.Utilities; - -namespace DysonNetwork.Sphere.Account; - -[Authorize] -[ApiController] -[Route("/api/accounts/me")] -public class AccountCurrentController( - AppDatabase db, - AccountService accounts, - FileReferenceService fileRefService, - AccountEventService events, - AuthService auth -) : ControllerBase -{ - [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] - public async Task> GetCurrentIdentity() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var userId = currentUser.Id; - - var account = await db.Accounts - .Include(e => e.Badges) - .Include(e => e.Profile) - .Where(e => e.Id == userId) - .FirstOrDefaultAsync(); - - return Ok(account); - } - - public class BasicInfoRequest - { - [MaxLength(256)] public string? Nick { get; set; } - [MaxLength(32)] public string? Language { get; set; } - } - - [HttpPatch] - public async Task> UpdateBasicInfo([FromBody] BasicInfoRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var account = await db.Accounts.FirstAsync(a => a.Id == currentUser.Id); - - if (request.Nick is not null) account.Nick = request.Nick; - if (request.Language is not null) account.Language = request.Language; - - await db.SaveChangesAsync(); - await accounts.PurgeAccountCache(currentUser); - return currentUser; - } - - public class ProfileRequest - { - [MaxLength(256)] public string? FirstName { get; set; } - [MaxLength(256)] public string? MiddleName { get; set; } - [MaxLength(256)] public string? LastName { get; set; } - [MaxLength(1024)] public string? Gender { get; set; } - [MaxLength(1024)] public string? Pronouns { get; set; } - [MaxLength(1024)] public string? TimeZone { get; set; } - [MaxLength(1024)] public string? Location { get; set; } - [MaxLength(4096)] public string? Bio { get; set; } - public Instant? Birthday { get; set; } - - [MaxLength(32)] public string? PictureId { get; set; } - [MaxLength(32)] public string? BackgroundId { get; set; } - } - - [HttpPatch("profile")] - public async Task> UpdateProfile([FromBody] ProfileRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var userId = currentUser.Id; - - var profile = await db.AccountProfiles - .Where(p => p.Account.Id == userId) - .FirstOrDefaultAsync(); - if (profile is null) return BadRequest("Unable to get your account."); - - if (request.FirstName is not null) profile.FirstName = request.FirstName; - if (request.MiddleName is not null) profile.MiddleName = request.MiddleName; - if (request.LastName is not null) profile.LastName = request.LastName; - if (request.Bio is not null) profile.Bio = request.Bio; - if (request.Gender is not null) profile.Gender = request.Gender; - if (request.Pronouns is not null) profile.Pronouns = request.Pronouns; - if (request.Birthday is not null) profile.Birthday = request.Birthday; - if (request.Location is not null) profile.Location = request.Location; - if (request.TimeZone is not null) profile.TimeZone = request.TimeZone; - - if (request.PictureId is not null) - { - var picture = await db.Files.Where(f => f.Id == request.PictureId).FirstOrDefaultAsync(); - if (picture is null) return BadRequest("Invalid picture id, unable to find the file on cloud."); - - var profileResourceId = $"profile:{profile.Id}"; - - // Remove old references for the profile picture - if (profile.Picture is not null) - { - var oldPictureRefs = - await fileRefService.GetResourceReferencesAsync(profileResourceId, "profile.picture"); - foreach (var oldRef in oldPictureRefs) - { - await fileRefService.DeleteReferenceAsync(oldRef.Id); - } - } - - profile.Picture = picture.ToReferenceObject(); - - // Create new reference - await fileRefService.CreateReferenceAsync( - picture.Id, - "profile.picture", - profileResourceId - ); - } - - if (request.BackgroundId is not null) - { - var background = await db.Files.Where(f => f.Id == request.BackgroundId).FirstOrDefaultAsync(); - if (background is null) return BadRequest("Invalid background id, unable to find the file on cloud."); - - var profileResourceId = $"profile:{profile.Id}"; - - // Remove old references for the profile background - if (profile.Background is not null) - { - var oldBackgroundRefs = - await fileRefService.GetResourceReferencesAsync(profileResourceId, "profile.background"); - foreach (var oldRef in oldBackgroundRefs) - { - await fileRefService.DeleteReferenceAsync(oldRef.Id); - } - } - - profile.Background = background.ToReferenceObject(); - - // Create new reference - await fileRefService.CreateReferenceAsync( - background.Id, - "profile.background", - profileResourceId - ); - } - - db.Update(profile); - await db.SaveChangesAsync(); - - await accounts.PurgeAccountCache(currentUser); - - return profile; - } - - [HttpDelete] - public async Task RequestDeleteAccount() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - await accounts.RequestAccountDeletion(currentUser); - } - catch (InvalidOperationException) - { - return BadRequest("You already requested account deletion within 24 hours."); - } - - return Ok(); - } - - [HttpGet("statuses")] - public async Task> GetCurrentStatus() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var status = await events.GetStatus(currentUser.Id); - return Ok(status); - } - - [HttpPatch("statuses")] - [RequiredPermission("global", "accounts.statuses.update")] - public async Task> UpdateStatus([FromBody] AccountController.StatusRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var now = SystemClock.Instance.GetCurrentInstant(); - var status = await db.AccountStatuses - .Where(e => e.AccountId == currentUser.Id) - .Where(e => e.ClearedAt == null || e.ClearedAt > now) - .OrderByDescending(e => e.CreatedAt) - .FirstOrDefaultAsync(); - if (status is null) return NotFound(); - - status.Attitude = request.Attitude; - status.IsInvisible = request.IsInvisible; - status.IsNotDisturb = request.IsNotDisturb; - status.Label = request.Label; - status.ClearedAt = request.ClearedAt; - - db.Update(status); - await db.SaveChangesAsync(); - events.PurgeStatusCache(currentUser.Id); - - return status; - } - - [HttpPost("statuses")] - [RequiredPermission("global", "accounts.statuses.create")] - public async Task> CreateStatus([FromBody] AccountController.StatusRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var status = new Status - { - AccountId = currentUser.Id, - Attitude = request.Attitude, - IsInvisible = request.IsInvisible, - IsNotDisturb = request.IsNotDisturb, - Label = request.Label, - ClearedAt = request.ClearedAt - }; - - return await events.CreateStatus(currentUser, status); - } - - [HttpDelete("me/statuses")] - public async Task DeleteStatus() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var now = SystemClock.Instance.GetCurrentInstant(); - var status = await db.AccountStatuses - .Where(s => s.AccountId == currentUser.Id) - .Where(s => s.ClearedAt == null || s.ClearedAt > now) - .OrderByDescending(s => s.CreatedAt) - .FirstOrDefaultAsync(); - if (status is null) return NotFound(); - - await events.ClearStatus(currentUser, status); - return NoContent(); - } - - [HttpGet("check-in")] - public async Task> GetCheckInResult() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var userId = currentUser.Id; - - var now = SystemClock.Instance.GetCurrentInstant(); - var today = now.InUtc().Date; - var startOfDay = today.AtStartOfDayInZone(DateTimeZone.Utc).ToInstant(); - var endOfDay = today.PlusDays(1).AtStartOfDayInZone(DateTimeZone.Utc).ToInstant(); - - var result = await db.AccountCheckInResults - .Where(x => x.AccountId == userId) - .Where(x => x.CreatedAt >= startOfDay && x.CreatedAt < endOfDay) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefaultAsync(); - - return result is null ? NotFound() : Ok(result); - } - - [HttpPost("check-in")] - public async Task> DoCheckIn([FromBody] string? captchaToken) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var isAvailable = await events.CheckInDailyIsAvailable(currentUser); - if (!isAvailable) - return BadRequest("Check-in is not available for today."); - - try - { - var needsCaptcha = await events.CheckInDailyDoAskCaptcha(currentUser); - return needsCaptcha switch - { - true when string.IsNullOrWhiteSpace(captchaToken) => StatusCode(423, - "Captcha is required for this check-in."), - true when !await auth.ValidateCaptcha(captchaToken!) => BadRequest("Invalid captcha token."), - _ => await events.CheckInDaily(currentUser) - }; - } - catch (InvalidOperationException ex) - { - return BadRequest(ex.Message); - } - } - - [HttpGet("calendar")] - public async Task>> GetEventCalendar([FromQuery] int? month, - [FromQuery] int? year) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var currentDate = SystemClock.Instance.GetCurrentInstant().InUtc().Date; - month ??= currentDate.Month; - year ??= currentDate.Year; - - if (month is < 1 or > 12) return BadRequest("Invalid month."); - if (year < 1) return BadRequest("Invalid year."); - - var calendar = await events.GetEventCalendar(currentUser, month.Value, year.Value); - return Ok(calendar); - } - - [HttpGet("actions")] - [ProducesResponseType>(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task>> GetActionLogs( - [FromQuery] int take = 20, - [FromQuery] int offset = 0 - ) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var query = db.ActionLogs - .Where(log => log.AccountId == currentUser.Id) - .OrderByDescending(log => log.CreatedAt); - - var total = await query.CountAsync(); - Response.Headers.Append("X-Total", total.ToString()); - - var logs = await query - .Skip(offset) - .Take(take) - .ToListAsync(); - - return Ok(logs); - } - - [HttpGet("factors")] - public async Task>> GetAuthFactors() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var factors = await db.AccountAuthFactors - .Include(f => f.Account) - .Where(f => f.Account.Id == currentUser.Id) - .ToListAsync(); - - return Ok(factors); - } - - public class AuthFactorRequest - { - public AccountAuthFactorType Type { get; set; } - public string? Secret { get; set; } - } - - [HttpPost("factors")] - [Authorize] - public async Task> CreateAuthFactor([FromBody] AuthFactorRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - if (await accounts.CheckAuthFactorExists(currentUser, request.Type)) - return BadRequest($"Auth factor with type {request.Type} is already exists."); - - var factor = await accounts.CreateAuthFactor(currentUser, request.Type, request.Secret); - return Ok(factor); - } - - [HttpPost("factors/{id:guid}/enable")] - [Authorize] - public async Task> EnableAuthFactor(Guid id, [FromBody] string? code) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var factor = await db.AccountAuthFactors - .Where(f => f.AccountId == currentUser.Id && f.Id == id) - .FirstOrDefaultAsync(); - if (factor is null) return NotFound(); - - try - { - factor = await accounts.EnableAuthFactor(factor, code); - return Ok(factor); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPost("factors/{id:guid}/disable")] - [Authorize] - public async Task> DisableAuthFactor(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var factor = await db.AccountAuthFactors - .Where(f => f.AccountId == currentUser.Id && f.Id == id) - .FirstOrDefaultAsync(); - if (factor is null) return NotFound(); - - try - { - factor = await accounts.DisableAuthFactor(factor); - return Ok(factor); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpDelete("factors/{id:guid}")] - [Authorize] - public async Task> DeleteAuthFactor(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var factor = await db.AccountAuthFactors - .Where(f => f.AccountId == currentUser.Id && f.Id == id) - .FirstOrDefaultAsync(); - if (factor is null) return NotFound(); - - try - { - await accounts.DeleteAuthFactor(factor); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - public class AuthorizedDevice - { - public string? Label { get; set; } - public string UserAgent { get; set; } = null!; - public string DeviceId { get; set; } = null!; - public ChallengePlatform Platform { get; set; } - public List Sessions { get; set; } = []; - } - - [HttpGet("devices")] - [Authorize] - public async Task>> GetDevices() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - Response.Headers.Append("X-Auth-Session", currentSession.Id.ToString()); - - // Group sessions by the related DeviceId, then create an AuthorizedDevice for each group. - var deviceGroups = await db.AuthSessions - .Where(s => s.Account.Id == currentUser.Id) - .Include(s => s.Challenge) - .GroupBy(s => s.Challenge.DeviceId!) - .Select(g => new AuthorizedDevice - { - DeviceId = g.Key!, - UserAgent = g.First(x => x.Challenge.UserAgent != null).Challenge.UserAgent!, - Platform = g.First().Challenge.Platform!, - Label = g.Where(x => !string.IsNullOrWhiteSpace(x.Label)).Select(x => x.Label).FirstOrDefault(), - Sessions = g - .OrderByDescending(x => x.LastGrantedAt) - .ToList() - }) - .ToListAsync(); - deviceGroups = deviceGroups - .OrderByDescending(s => s.Sessions.First().LastGrantedAt) - .ToList(); - - return Ok(deviceGroups); - } - - [HttpGet("sessions")] - [Authorize] - public async Task>> GetSessions( - [FromQuery] int take = 20, - [FromQuery] int offset = 0 - ) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - var query = db.AuthSessions - .Include(session => session.Account) - .Include(session => session.Challenge) - .Where(session => session.Account.Id == currentUser.Id); - - var total = await query.CountAsync(); - Response.Headers.Append("X-Total", total.ToString()); - Response.Headers.Append("X-Auth-Session", currentSession.Id.ToString()); - - var sessions = await query - .OrderByDescending(x => x.LastGrantedAt) - .Skip(offset) - .Take(take) - .ToListAsync(); - - return Ok(sessions); - } - - [HttpDelete("sessions/{id:guid}")] - [Authorize] - public async Task> DeleteSession(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - await accounts.DeleteSession(currentUser, id); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpDelete("sessions/current")] - [Authorize] - public async Task> DeleteCurrentSession() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - try - { - await accounts.DeleteSession(currentUser, currentSession.Id); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPatch("sessions/{id:guid}/label")] - public async Task> UpdateSessionLabel(Guid id, [FromBody] string label) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - await accounts.UpdateSessionLabel(currentUser, id, label); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPatch("sessions/current/label")] - public async Task> UpdateCurrentSessionLabel([FromBody] string label) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - try - { - await accounts.UpdateSessionLabel(currentUser, currentSession.Id, label); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpGet("contacts")] - [Authorize] - public async Task>> GetContacts() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var contacts = await db.AccountContacts - .Where(c => c.AccountId == currentUser.Id) - .ToListAsync(); - - return Ok(contacts); - } - - public class AccountContactRequest - { - [Required] public AccountContactType Type { get; set; } - [Required] public string Content { get; set; } = null!; - } - - [HttpPost("contacts")] - [Authorize] - public async Task> CreateContact([FromBody] AccountContactRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - var contact = await accounts.CreateContactMethod(currentUser, request.Type, request.Content); - return Ok(contact); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPost("contacts/{id:guid}/verify")] - [Authorize] - public async Task> VerifyContact(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var contact = await db.AccountContacts - .Where(c => c.AccountId == currentUser.Id && c.Id == id) - .FirstOrDefaultAsync(); - if (contact is null) return NotFound(); - - try - { - await accounts.VerifyContactMethod(currentUser, contact); - return Ok(contact); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPost("contacts/{id:guid}/primary")] - [Authorize] - public async Task> SetPrimaryContact(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var contact = await db.AccountContacts - .Where(c => c.AccountId == currentUser.Id && c.Id == id) - .FirstOrDefaultAsync(); - if (contact is null) return NotFound(); - - try - { - contact = await accounts.SetContactMethodPrimary(currentUser, contact); - return Ok(contact); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpDelete("contacts/{id:guid}")] - [Authorize] - public async Task> DeleteContact(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var contact = await db.AccountContacts - .Where(c => c.AccountId == currentUser.Id && c.Id == id) - .FirstOrDefaultAsync(); - if (contact is null) return NotFound(); - - try - { - await accounts.DeleteContactMethod(currentUser, contact); - return NoContent(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } - - [HttpGet("badges")] - [ProducesResponseType>(StatusCodes.Status200OK)] - [Authorize] - public async Task>> GetBadges() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var badges = await db.Badges - .Where(b => b.AccountId == currentUser.Id) - .ToListAsync(); - return Ok(badges); - } - - [HttpPost("badges/{id:guid}/active")] - [Authorize] - public async Task> ActivateBadge(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - await accounts.ActiveBadge(currentUser, id); - return Ok(); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AccountEventService.cs b/DysonNetwork.Sphere/Account/AccountEventService.cs deleted file mode 100644 index 87e5bb3..0000000 --- a/DysonNetwork.Sphere/Account/AccountEventService.cs +++ /dev/null @@ -1,339 +0,0 @@ -using System.Globalization; -using DysonNetwork.Sphere.Activity; -using DysonNetwork.Sphere.Connection; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Localization; -using NodaTime; -using Org.BouncyCastle.Asn1.X509; - -namespace DysonNetwork.Sphere.Account; - -public class AccountEventService( - AppDatabase db, - WebSocketService ws, - ICacheService cache, - PaymentService payment, - IStringLocalizer localizer -) -{ - private static readonly Random Random = new(); - private const string StatusCacheKey = "AccountStatus_"; - - public void PurgeStatusCache(Guid userId) - { - var cacheKey = $"{StatusCacheKey}{userId}"; - cache.RemoveAsync(cacheKey); - } - - public async Task GetStatus(Guid userId) - { - var cacheKey = $"{StatusCacheKey}{userId}"; - var cachedStatus = await cache.GetAsync(cacheKey); - if (cachedStatus is not null) - { - cachedStatus!.IsOnline = !cachedStatus.IsInvisible && ws.GetAccountIsConnected(userId); - return cachedStatus; - } - - var now = SystemClock.Instance.GetCurrentInstant(); - var status = await db.AccountStatuses - .Where(e => e.AccountId == userId) - .Where(e => e.ClearedAt == null || e.ClearedAt > now) - .OrderByDescending(e => e.CreatedAt) - .FirstOrDefaultAsync(); - var isOnline = ws.GetAccountIsConnected(userId); - if (status is not null) - { - status.IsOnline = !status.IsInvisible && isOnline; - await cache.SetWithGroupsAsync(cacheKey, status, [$"{AccountService.AccountCachePrefix}{status.AccountId}"], - TimeSpan.FromMinutes(5)); - return status; - } - - if (isOnline) - { - return new Status - { - Attitude = StatusAttitude.Neutral, - IsOnline = true, - IsCustomized = false, - Label = "Online", - AccountId = userId, - }; - } - - return new Status - { - Attitude = StatusAttitude.Neutral, - IsOnline = false, - IsCustomized = false, - Label = "Offline", - AccountId = userId, - }; - } - - public async Task> GetStatuses(List userIds) - { - var results = new Dictionary(); - var cacheMissUserIds = new List(); - - foreach (var userId in userIds) - { - var cacheKey = $"{StatusCacheKey}{userId}"; - var cachedStatus = await cache.GetAsync(cacheKey); - if (cachedStatus != null) - { - cachedStatus.IsOnline = !cachedStatus.IsInvisible && ws.GetAccountIsConnected(userId); - results[userId] = cachedStatus; - } - else - { - cacheMissUserIds.Add(userId); - } - } - - if (cacheMissUserIds.Any()) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var statusesFromDb = await db.AccountStatuses - .Where(e => cacheMissUserIds.Contains(e.AccountId)) - .Where(e => e.ClearedAt == null || e.ClearedAt > now) - .GroupBy(e => e.AccountId) - .Select(g => g.OrderByDescending(e => e.CreatedAt).First()) - .ToListAsync(); - - var foundUserIds = new HashSet(); - - foreach (var status in statusesFromDb) - { - var isOnline = ws.GetAccountIsConnected(status.AccountId); - status.IsOnline = !status.IsInvisible && isOnline; - results[status.AccountId] = status; - var cacheKey = $"{StatusCacheKey}{status.AccountId}"; - await cache.SetAsync(cacheKey, status, TimeSpan.FromMinutes(5)); - foundUserIds.Add(status.AccountId); - } - - var usersWithoutStatus = cacheMissUserIds.Except(foundUserIds).ToList(); - if (usersWithoutStatus.Any()) - { - foreach (var userId in usersWithoutStatus) - { - var isOnline = ws.GetAccountIsConnected(userId); - var defaultStatus = new Status - { - Attitude = StatusAttitude.Neutral, - IsOnline = isOnline, - IsCustomized = false, - Label = isOnline ? "Online" : "Offline", - AccountId = userId, - }; - results[userId] = defaultStatus; - } - } - } - - return results; - } - - public async Task CreateStatus(Account user, Status status) - { - var now = SystemClock.Instance.GetCurrentInstant(); - await db.AccountStatuses - .Where(x => x.AccountId == user.Id && (x.ClearedAt == null || x.ClearedAt > now)) - .ExecuteUpdateAsync(s => s.SetProperty(x => x.ClearedAt, now)); - - db.AccountStatuses.Add(status); - await db.SaveChangesAsync(); - - return status; - } - - public async Task ClearStatus(Account user, Status status) - { - status.ClearedAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(status); - await db.SaveChangesAsync(); - PurgeStatusCache(user.Id); - } - - private const int FortuneTipCount = 7; // This will be the max index for each type (positive/negative) - private const string CaptchaCacheKey = "CheckInCaptcha_"; - private const int CaptchaProbabilityPercent = 20; - - public async Task CheckInDailyDoAskCaptcha(Account user) - { - var cacheKey = $"{CaptchaCacheKey}{user.Id}"; - var needsCaptcha = await cache.GetAsync(cacheKey); - if (needsCaptcha is not null) - return needsCaptcha!.Value; - - var result = Random.Next(100) < CaptchaProbabilityPercent; - await cache.SetAsync(cacheKey, result, TimeSpan.FromHours(24)); - return result; - } - - public async Task CheckInDailyIsAvailable(Account user) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var lastCheckIn = await db.AccountCheckInResults - .Where(x => x.AccountId == user.Id) - .OrderByDescending(x => x.CreatedAt) - .FirstOrDefaultAsync(); - - if (lastCheckIn == null) - return true; - - var lastDate = lastCheckIn.CreatedAt.InUtc().Date; - var currentDate = now.InUtc().Date; - - return lastDate < currentDate; - } - - public const string CheckInLockKey = "CheckInLock_"; - - public async Task CheckInDaily(Account user) - { - var lockKey = $"{CheckInLockKey}{user.Id}"; - - try - { - var lk = await cache.AcquireLockAsync(lockKey, TimeSpan.FromMinutes(1), TimeSpan.FromMilliseconds(100)); - - if (lk != null) - await lk.ReleaseAsync(); - } - catch - { - // Ignore errors from this pre-check - } - - // Now try to acquire the lock properly - await using var lockObj = await cache.AcquireLockAsync(lockKey, TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(5)); - if (lockObj is null) throw new InvalidOperationException("Check-in was in progress."); - - var cultureInfo = new CultureInfo(user.Language, false); - CultureInfo.CurrentCulture = cultureInfo; - CultureInfo.CurrentUICulture = cultureInfo; - - // Generate 2 positive tips - var positiveIndices = Enumerable.Range(1, FortuneTipCount) - .OrderBy(_ => Random.Next()) - .Take(2) - .ToList(); - var tips = positiveIndices.Select(index => new FortuneTip - { - IsPositive = true, Title = localizer[$"FortuneTipPositiveTitle_{index}"].Value, - Content = localizer[$"FortuneTipPositiveContent_{index}"].Value - }).ToList(); - - // Generate 2 negative tips - var negativeIndices = Enumerable.Range(1, FortuneTipCount) - .Except(positiveIndices) - .OrderBy(_ => Random.Next()) - .Take(2) - .ToList(); - tips.AddRange(negativeIndices.Select(index => new FortuneTip - { - IsPositive = false, Title = localizer[$"FortuneTipNegativeTitle_{index}"].Value, - Content = localizer[$"FortuneTipNegativeContent_{index}"].Value - })); - - var result = new CheckInResult - { - Tips = tips, - Level = (CheckInResultLevel)Random.Next(Enum.GetValues().Length), - AccountId = user.Id, - RewardExperience = 100, - RewardPoints = 10, - }; - - var now = SystemClock.Instance.GetCurrentInstant().InUtc().Date; - try - { - if (result.RewardPoints.HasValue) - await payment.CreateTransactionWithAccountAsync( - null, - user.Id, - WalletCurrency.SourcePoint, - result.RewardPoints.Value, - $"Check-in reward on {now:yyyy/MM/dd}" - ); - } - catch - { - result.RewardPoints = null; - } - - await db.AccountProfiles - .Where(p => p.AccountId == user.Id) - .ExecuteUpdateAsync(s => - s.SetProperty(b => b.Experience, b => b.Experience + result.RewardExperience) - ); - db.AccountCheckInResults.Add(result); - await db.SaveChangesAsync(); // Don't forget to save changes to the database - - // The lock will be automatically released by the await using statement - return result; - } - - public async Task> GetEventCalendar(Account user, int month, int year = 0, - bool replaceInvisible = false) - { - if (year == 0) - year = SystemClock.Instance.GetCurrentInstant().InUtc().Date.Year; - - // Create start and end dates for the specified month - var startOfMonth = new LocalDate(year, month, 1).AtStartOfDayInZone(DateTimeZone.Utc).ToInstant(); - var endOfMonth = startOfMonth.Plus(Duration.FromDays(DateTime.DaysInMonth(year, month))); - - var statuses = await db.AccountStatuses - .AsNoTracking() - .TagWith("GetEventCalendar_Statuses") - .Where(x => x.AccountId == user.Id && x.CreatedAt >= startOfMonth && x.CreatedAt < endOfMonth) - .Select(x => new Status - { - Id = x.Id, - Attitude = x.Attitude, - IsInvisible = !replaceInvisible && x.IsInvisible, - IsNotDisturb = x.IsNotDisturb, - Label = x.Label, - ClearedAt = x.ClearedAt, - AccountId = x.AccountId, - CreatedAt = x.CreatedAt - }) - .OrderBy(x => x.CreatedAt) - .ToListAsync(); - - var checkIn = await db.AccountCheckInResults - .AsNoTracking() - .TagWith("GetEventCalendar_CheckIn") - .Where(x => x.AccountId == user.Id && x.CreatedAt >= startOfMonth && x.CreatedAt < endOfMonth) - .ToListAsync(); - - var dates = Enumerable.Range(1, DateTime.DaysInMonth(year, month)) - .Select(day => new LocalDate(year, month, day).AtStartOfDayInZone(DateTimeZone.Utc).ToInstant()) - .ToList(); - - var statusesByDate = statuses - .GroupBy(s => s.CreatedAt.InUtc().Date) - .ToDictionary(g => g.Key, g => g.ToList()); - - var checkInByDate = checkIn - .ToDictionary(c => c.CreatedAt.InUtc().Date); - - return dates.Select(date => - { - var utcDate = date.InUtc().Date; - return new DailyEventResponse - { - Date = date, - CheckInResult = checkInByDate.GetValueOrDefault(utcDate), - Statuses = statusesByDate.GetValueOrDefault(utcDate, new List()) - }; - }).ToList(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AccountService.cs b/DysonNetwork.Sphere/Account/AccountService.cs deleted file mode 100644 index db3b9e8..0000000 --- a/DysonNetwork.Sphere/Account/AccountService.cs +++ /dev/null @@ -1,657 +0,0 @@ -using System.Globalization; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Auth.OpenId; -using DysonNetwork.Sphere.Email; - -using DysonNetwork.Sphere.Localization; -using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Storage; -using EFCore.BulkExtensions; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Localization; -using NodaTime; -using Org.BouncyCastle.Utilities; -using OtpNet; - -namespace DysonNetwork.Sphere.Account; - -public class AccountService( - AppDatabase db, - MagicSpellService spells, - AccountUsernameService uname, - NotificationService nty, - EmailService mailer, - IStringLocalizer localizer, - ICacheService cache, - ILogger logger -) -{ - public static void SetCultureInfo(Account account) - { - SetCultureInfo(account.Language); - } - - public static void SetCultureInfo(string? languageCode) - { - var info = new CultureInfo(languageCode ?? "en-us", false); - CultureInfo.CurrentCulture = info; - CultureInfo.CurrentUICulture = info; - } - - public const string AccountCachePrefix = "account:"; - - public async Task PurgeAccountCache(Account account) - { - await cache.RemoveGroupAsync($"{AccountCachePrefix}{account.Id}"); - } - - public async Task LookupAccount(string probe) - { - var account = await db.Accounts.Where(a => a.Name == probe).FirstOrDefaultAsync(); - if (account is not null) return account; - - var contact = await db.AccountContacts - .Where(c => c.Content == probe) - .Include(c => c.Account) - .FirstOrDefaultAsync(); - return contact?.Account; - } - - public async Task LookupAccountByConnection(string identifier, string provider) - { - var connection = await db.AccountConnections - .Where(c => c.ProvidedIdentifier == identifier && c.Provider == provider) - .Include(c => c.Account) - .FirstOrDefaultAsync(); - return connection?.Account; - } - - public async Task GetAccountLevel(Guid accountId) - { - var profile = await db.AccountProfiles - .Where(a => a.AccountId == accountId) - .FirstOrDefaultAsync(); - return profile?.Level; - } - - public async Task CreateAccount( - string name, - string nick, - string email, - string? password, - string language = "en-US", - bool isEmailVerified = false, - bool isActivated = false - ) - { - await using var transaction = await db.Database.BeginTransactionAsync(); - try - { - var dupeNameCount = await db.Accounts.Where(a => a.Name == name).CountAsync(); - if (dupeNameCount > 0) - throw new InvalidOperationException("Account name has already been taken."); - - var account = new Account - { - Name = name, - Nick = nick, - Language = language, - Contacts = new List - { - new() - { - Type = AccountContactType.Email, - Content = email, - VerifiedAt = isEmailVerified ? SystemClock.Instance.GetCurrentInstant() : null, - IsPrimary = true - } - }, - AuthFactors = password is not null - ? new List - { - new AccountAuthFactor - { - Type = AccountAuthFactorType.Password, - Secret = password, - EnabledAt = SystemClock.Instance.GetCurrentInstant() - }.HashSecret() - } - : [], - Profile = new Profile() - }; - - if (isActivated) - { - account.ActivatedAt = SystemClock.Instance.GetCurrentInstant(); - var defaultGroup = await db.PermissionGroups.FirstOrDefaultAsync(g => g.Key == "default"); - if (defaultGroup is not null) - { - db.PermissionGroupMembers.Add(new PermissionGroupMember - { - Actor = $"user:{account.Id}", - Group = defaultGroup - }); - } - } - else - { - var spell = await spells.CreateMagicSpell( - account, - MagicSpellType.AccountActivation, - new Dictionary - { - { "contact_method", account.Contacts.First().Content } - } - ); - await spells.NotifyMagicSpell(spell, true); - } - - db.Accounts.Add(account); - await db.SaveChangesAsync(); - - await transaction.CommitAsync(); - return account; - } - catch - { - await transaction.RollbackAsync(); - throw; - } - } - - public async Task CreateAccount(OidcUserInfo userInfo) - { - if (string.IsNullOrEmpty(userInfo.Email)) - throw new ArgumentException("Email is required for account creation"); - - var displayName = !string.IsNullOrEmpty(userInfo.DisplayName) - ? userInfo.DisplayName - : $"{userInfo.FirstName} {userInfo.LastName}".Trim(); - - // Generate username from email - var username = await uname.GenerateUsernameFromEmailAsync(userInfo.Email); - - return await CreateAccount( - username, - displayName, - userInfo.Email, - null, - "en-US", - userInfo.EmailVerified, - userInfo.EmailVerified - ); - } - - public async Task RequestAccountDeletion(Account account) - { - var spell = await spells.CreateMagicSpell( - account, - MagicSpellType.AccountRemoval, - new Dictionary(), - SystemClock.Instance.GetCurrentInstant().Plus(Duration.FromHours(24)), - preventRepeat: true - ); - await spells.NotifyMagicSpell(spell); - } - - public async Task RequestPasswordReset(Account account) - { - var spell = await spells.CreateMagicSpell( - account, - MagicSpellType.AuthPasswordReset, - new Dictionary(), - SystemClock.Instance.GetCurrentInstant().Plus(Duration.FromHours(24)), - preventRepeat: true - ); - await spells.NotifyMagicSpell(spell); - } - - public async Task CheckAuthFactorExists(Account account, AccountAuthFactorType type) - { - var isExists = await db.AccountAuthFactors - .Where(x => x.AccountId == account.Id && x.Type == type) - .AnyAsync(); - return isExists; - } - - public async Task CreateAuthFactor(Account account, AccountAuthFactorType type, string? secret) - { - AccountAuthFactor? factor = null; - switch (type) - { - case AccountAuthFactorType.Password: - if (string.IsNullOrWhiteSpace(secret)) throw new ArgumentNullException(nameof(secret)); - factor = new AccountAuthFactor - { - Type = AccountAuthFactorType.Password, - Trustworthy = 1, - AccountId = account.Id, - Secret = secret, - EnabledAt = SystemClock.Instance.GetCurrentInstant(), - }.HashSecret(); - break; - case AccountAuthFactorType.EmailCode: - factor = new AccountAuthFactor - { - Type = AccountAuthFactorType.EmailCode, - Trustworthy = 2, - EnabledAt = SystemClock.Instance.GetCurrentInstant(), - }; - break; - case AccountAuthFactorType.InAppCode: - factor = new AccountAuthFactor - { - Type = AccountAuthFactorType.InAppCode, - Trustworthy = 1, - EnabledAt = SystemClock.Instance.GetCurrentInstant() - }; - break; - case AccountAuthFactorType.TimedCode: - var skOtp = KeyGeneration.GenerateRandomKey(20); - var skOtp32 = Base32Encoding.ToString(skOtp); - factor = new AccountAuthFactor - { - Secret = skOtp32, - Type = AccountAuthFactorType.TimedCode, - Trustworthy = 2, - EnabledAt = null, // It needs to be tired once to enable - CreatedResponse = new Dictionary - { - ["uri"] = new OtpUri( - OtpType.Totp, - skOtp32, - account.Id.ToString(), - "Solar Network" - ).ToString(), - } - }; - break; - case AccountAuthFactorType.PinCode: - if (string.IsNullOrWhiteSpace(secret)) throw new ArgumentNullException(nameof(secret)); - if (!secret.All(char.IsDigit) || secret.Length != 6) - throw new ArgumentException("PIN code must be exactly 6 digits"); - factor = new AccountAuthFactor - { - Type = AccountAuthFactorType.PinCode, - Trustworthy = 0, // Only for confirming, can't be used for login - Secret = secret, - EnabledAt = SystemClock.Instance.GetCurrentInstant(), - }.HashSecret(); - break; - default: - throw new ArgumentOutOfRangeException(nameof(type), type, null); - } - - if (factor is null) throw new InvalidOperationException("Unable to create auth factor."); - factor.AccountId = account.Id; - db.AccountAuthFactors.Add(factor); - await db.SaveChangesAsync(); - return factor; - } - - public async Task EnableAuthFactor(AccountAuthFactor factor, string? code) - { - if (factor.EnabledAt is not null) throw new ArgumentException("The factor has been enabled."); - if (factor.Type is AccountAuthFactorType.Password or AccountAuthFactorType.TimedCode) - { - if (code is null || !factor.VerifyPassword(code)) - throw new InvalidOperationException( - "Invalid code, you need to enter the correct code to enable the factor." - ); - } - - factor.EnabledAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(factor); - await db.SaveChangesAsync(); - - return factor; - } - - public async Task DisableAuthFactor(AccountAuthFactor factor) - { - if (factor.EnabledAt is null) throw new ArgumentException("The factor has been disabled."); - - var count = await db.AccountAuthFactors - .Where(f => f.AccountId == factor.AccountId && f.EnabledAt != null) - .CountAsync(); - if (count <= 1) - throw new InvalidOperationException( - "Disabling this auth factor will cause you have no active auth factors."); - - factor.EnabledAt = null; - db.Update(factor); - await db.SaveChangesAsync(); - - return factor; - } - - public async Task DeleteAuthFactor(AccountAuthFactor factor) - { - var count = await db.AccountAuthFactors - .Where(f => f.AccountId == factor.AccountId) - .If(factor.EnabledAt is not null, q => q.Where(f => f.EnabledAt != null)) - .CountAsync(); - if (count <= 1) - throw new InvalidOperationException("Deleting this auth factor will cause you have no auth factor."); - - db.AccountAuthFactors.Remove(factor); - await db.SaveChangesAsync(); - } - - /// - /// Send the auth factor verification code to users, for factors like in-app code and email. - /// Sometimes it requires a hint, like a part of the user's email address to ensure the user is who own the account. - /// - /// The owner of the auth factor - /// The auth factor needed to send code - /// The part of the contact method for verification - public async Task SendFactorCode(Account account, AccountAuthFactor factor, string? hint = null) - { - var code = new Random().Next(100000, 999999).ToString("000000"); - - switch (factor.Type) - { - case AccountAuthFactorType.InAppCode: - if (await _GetFactorCode(factor) is not null) - throw new InvalidOperationException("A factor code has been sent and in active duration."); - - await nty.SendNotification( - account, - "auth.verification", - localizer["AuthCodeTitle"], - null, - localizer["AuthCodeBody", code], - save: true - ); - await _SetFactorCode(factor, code, TimeSpan.FromMinutes(5)); - break; - case AccountAuthFactorType.EmailCode: - if (await _GetFactorCode(factor) is not null) - throw new InvalidOperationException("A factor code has been sent and in active duration."); - - ArgumentNullException.ThrowIfNull(hint); - hint = hint.Replace("@", "").Replace(".", "").Replace("+", "").Replace("%", ""); - if (string.IsNullOrWhiteSpace(hint)) - { - logger.LogWarning( - "Unable to send factor code to #{FactorId} with hint {Hint}, due to invalid hint...", - factor.Id, - hint - ); - return; - } - - var contact = await db.AccountContacts - .Where(c => c.Type == AccountContactType.Email) - .Where(c => c.VerifiedAt != null) - .Where(c => EF.Functions.ILike(c.Content, $"%{hint}%")) - .Include(c => c.Account) - .FirstOrDefaultAsync(); - if (contact is null) - { - logger.LogWarning( - "Unable to send factor code to #{FactorId} with hint {Hint}, due to no contact method found according to hint...", - factor.Id, - hint - ); - return; - } - - await mailer.SendTemplatedEmailAsync( - account.Nick, - contact.Content, - localizer["VerificationEmail"], - new VerificationEmailModel - { - Name = account.Name, - Code = code - } - ); - - await _SetFactorCode(factor, code, TimeSpan.FromMinutes(30)); - break; - case AccountAuthFactorType.Password: - case AccountAuthFactorType.TimedCode: - default: - // No need to send, such as password etc... - return; - } - } - - public async Task VerifyFactorCode(AccountAuthFactor factor, string code) - { - switch (factor.Type) - { - case AccountAuthFactorType.EmailCode: - case AccountAuthFactorType.InAppCode: - var correctCode = await _GetFactorCode(factor); - var isCorrect = correctCode is not null && - string.Equals(correctCode, code, StringComparison.OrdinalIgnoreCase); - await cache.RemoveAsync($"{AuthFactorCachePrefix}{factor.Id}:code"); - return isCorrect; - case AccountAuthFactorType.Password: - case AccountAuthFactorType.TimedCode: - default: - return factor.VerifyPassword(code); - } - } - - private const string AuthFactorCachePrefix = "authfactor:"; - - private async Task _SetFactorCode(AccountAuthFactor factor, string code, TimeSpan expires) - { - await cache.SetAsync( - $"{AuthFactorCachePrefix}{factor.Id}:code", - code, - expires - ); - } - - private async Task _GetFactorCode(AccountAuthFactor factor) - { - return await cache.GetAsync( - $"{AuthFactorCachePrefix}{factor.Id}:code" - ); - } - - public async Task UpdateSessionLabel(Account account, Guid sessionId, string label) - { - var session = await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.Id == sessionId && s.AccountId == account.Id) - .FirstOrDefaultAsync(); - if (session is null) throw new InvalidOperationException("Session was not found."); - - await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.Challenge.DeviceId == session.Challenge.DeviceId) - .ExecuteUpdateAsync(p => p.SetProperty(s => s.Label, label)); - - var sessions = await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.AccountId == session.Id && s.Challenge.DeviceId == session.Challenge.DeviceId) - .ToListAsync(); - foreach (var item in sessions) - await cache.RemoveAsync($"{DysonTokenAuthHandler.AuthCachePrefix}{item.Id}"); - - return session; - } - - public async Task DeleteSession(Account account, Guid sessionId) - { - var session = await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.Id == sessionId && s.AccountId == account.Id) - .FirstOrDefaultAsync(); - if (session is null) throw new InvalidOperationException("Session was not found."); - - var sessions = await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.AccountId == session.Id && s.Challenge.DeviceId == session.Challenge.DeviceId) - .ToListAsync(); - - if (session.Challenge.DeviceId is not null) - await nty.UnsubscribePushNotifications(session.Challenge.DeviceId); - - // The current session should be included in the sessions' list - await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.Challenge.DeviceId == session.Challenge.DeviceId) - .ExecuteDeleteAsync(); - - foreach (var item in sessions) - await cache.RemoveAsync($"{DysonTokenAuthHandler.AuthCachePrefix}{item.Id}"); - } - - public async Task CreateContactMethod(Account account, AccountContactType type, string content) - { - var contact = new AccountContact - { - Type = type, - Content = content, - AccountId = account.Id, - }; - - db.AccountContacts.Add(contact); - await db.SaveChangesAsync(); - - return contact; - } - - public async Task VerifyContactMethod(Account account, AccountContact contact) - { - var spell = await spells.CreateMagicSpell( - account, - MagicSpellType.ContactVerification, - new Dictionary { { "contact_method", contact.Content } }, - expiredAt: SystemClock.Instance.GetCurrentInstant().Plus(Duration.FromHours(24)), - preventRepeat: true - ); - await spells.NotifyMagicSpell(spell); - } - - public async Task SetContactMethodPrimary(Account account, AccountContact contact) - { - if (contact.AccountId != account.Id) - throw new InvalidOperationException("Contact method does not belong to this account."); - if (contact.VerifiedAt is null) - throw new InvalidOperationException("Cannot set unverified contact method as primary."); - - await using var transaction = await db.Database.BeginTransactionAsync(); - - try - { - await db.AccountContacts - .Where(c => c.AccountId == account.Id && c.Type == contact.Type) - .ExecuteUpdateAsync(s => s.SetProperty(x => x.IsPrimary, false)); - - contact.IsPrimary = true; - db.AccountContacts.Update(contact); - await db.SaveChangesAsync(); - - await transaction.CommitAsync(); - return contact; - } - catch - { - await transaction.RollbackAsync(); - throw; - } - } - - public async Task DeleteContactMethod(Account account, AccountContact contact) - { - if (contact.AccountId != account.Id) - throw new InvalidOperationException("Contact method does not belong to this account."); - if (contact.IsPrimary) - throw new InvalidOperationException("Cannot delete primary contact method."); - - db.AccountContacts.Remove(contact); - await db.SaveChangesAsync(); - } - - /// - /// This method will grant a badge to the account. - /// Shouldn't be exposed to normal user and the user itself. - /// - public async Task GrantBadge(Account account, Badge badge) - { - badge.AccountId = account.Id; - db.Badges.Add(badge); - await db.SaveChangesAsync(); - return badge; - } - - /// - /// This method will revoke a badge from the account. - /// Shouldn't be exposed to normal user and the user itself. - /// - public async Task RevokeBadge(Account account, Guid badgeId) - { - var badge = await db.Badges - .Where(b => b.AccountId == account.Id && b.Id == badgeId) - .OrderByDescending(b => b.CreatedAt) - .FirstOrDefaultAsync(); - if (badge is null) throw new InvalidOperationException("Badge was not found."); - - var profile = await db.AccountProfiles - .Where(p => p.AccountId == account.Id) - .FirstOrDefaultAsync(); - if (profile?.ActiveBadge is not null && profile.ActiveBadge.Id == badge.Id) - profile.ActiveBadge = null; - - db.Remove(badge); - await db.SaveChangesAsync(); - } - - public async Task ActiveBadge(Account account, Guid badgeId) - { - await using var transaction = await db.Database.BeginTransactionAsync(); - - try - { - var badge = await db.Badges - .Where(b => b.AccountId == account.Id && b.Id == badgeId) - .OrderByDescending(b => b.CreatedAt) - .FirstOrDefaultAsync(); - if (badge is null) throw new InvalidOperationException("Badge was not found."); - - await db.Badges - .Where(b => b.AccountId == account.Id && b.Id != badgeId) - .ExecuteUpdateAsync(s => s.SetProperty(p => p.ActivatedAt, p => null)); - - badge.ActivatedAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(badge); - await db.SaveChangesAsync(); - - await db.AccountProfiles - .Where(p => p.AccountId == account.Id) - .ExecuteUpdateAsync(s => s.SetProperty(p => p.ActiveBadge, badge.ToReference())); - await PurgeAccountCache(account); - - await transaction.CommitAsync(); - } - catch - { - await transaction.RollbackAsync(); - throw; - } - } - - /// - /// The maintenance method for server administrator. - /// To check every user has an account profile and to create them if it isn't having one. - /// - public async Task EnsureAccountProfileCreated() - { - var accountsId = await db.Accounts.Select(a => a.Id).ToListAsync(); - var existingId = await db.AccountProfiles.Select(p => p.AccountId).ToListAsync(); - var missingId = accountsId.Except(existingId).ToList(); - - if (missingId.Count != 0) - { - var newProfiles = missingId.Select(id => new Profile { Id = Guid.NewGuid(), AccountId = id }).ToList(); - await db.BulkInsertAsync(newProfiles); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/AccountUsernameService.cs b/DysonNetwork.Sphere/Account/AccountUsernameService.cs deleted file mode 100644 index 094f9f0..0000000 --- a/DysonNetwork.Sphere/Account/AccountUsernameService.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System.Text.RegularExpressions; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Account; - -/// -/// Service for handling username generation and validation -/// -public class AccountUsernameService(AppDatabase db) -{ - private readonly Random _random = new(); - - /// - /// Generates a unique username based on the provided base name - /// - /// The preferred username - /// A unique username - public async Task GenerateUniqueUsernameAsync(string baseName) - { - // Sanitize the base name - var sanitized = SanitizeUsername(baseName); - - // If the base name is empty after sanitization, use a default - if (string.IsNullOrEmpty(sanitized)) - { - sanitized = "user"; - } - - // Check if the sanitized name is available - if (!await IsUsernameExistsAsync(sanitized)) - { - return sanitized; - } - - // Try up to 10 times with random numbers - for (int i = 0; i < 10; i++) - { - var suffix = _random.Next(1000, 9999); - var candidate = $"{sanitized}{suffix}"; - - if (!await IsUsernameExistsAsync(candidate)) - { - return candidate; - } - } - - // If all attempts fail, use a timestamp - var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); - return $"{sanitized}{timestamp}"; - } - - /// - /// Sanitizes a username by removing invalid characters and converting to lowercase - /// - public string SanitizeUsername(string username) - { - if (string.IsNullOrEmpty(username)) - return string.Empty; - - // Replace spaces and special characters with underscores - var sanitized = Regex.Replace(username, @"[^a-zA-Z0-9_\-]", ""); - - // Convert to lowercase - sanitized = sanitized.ToLowerInvariant(); - - // Ensure it starts with a letter - if (sanitized.Length > 0 && !char.IsLetter(sanitized[0])) - { - sanitized = "u" + sanitized; - } - - // Truncate if too long - if (sanitized.Length > 30) - { - sanitized = sanitized[..30]; - } - - return sanitized; - } - - /// - /// Checks if a username already exists - /// - public async Task IsUsernameExistsAsync(string username) - { - return await db.Accounts.AnyAsync(a => a.Name == username); - } - - /// - /// Generates a username from an email address - /// - /// The email address to generate a username from - /// A unique username derived from the email - public async Task GenerateUsernameFromEmailAsync(string email) - { - if (string.IsNullOrEmpty(email)) - return await GenerateUniqueUsernameAsync("user"); - - // Extract the local part of the email (before the @) - var localPart = email.Split('@')[0]; - - // Use the local part as the base for username generation - return await GenerateUniqueUsernameAsync(localPart); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/ActionLog.cs b/DysonNetwork.Sphere/Account/ActionLog.cs deleted file mode 100644 index 19c5779..0000000 --- a/DysonNetwork.Sphere/Account/ActionLog.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Point = NetTopologySuite.Geometries.Point; - -namespace DysonNetwork.Sphere.Account; - -public abstract class ActionLogType -{ - public const string NewLogin = "login"; - public const string ChallengeAttempt = "challenges.attempt"; - public const string ChallengeSuccess = "challenges.success"; - public const string ChallengeFailure = "challenges.failure"; - public const string PostCreate = "posts.create"; - public const string PostUpdate = "posts.update"; - public const string PostDelete = "posts.delete"; - public const string PostReact = "posts.react"; - public const string MessageCreate = "messages.create"; - public const string MessageUpdate = "messages.update"; - public const string MessageDelete = "messages.delete"; - public const string MessageReact = "messages.react"; - public const string PublisherCreate = "publishers.create"; - public const string PublisherUpdate = "publishers.update"; - public const string PublisherDelete = "publishers.delete"; - public const string PublisherMemberInvite = "publishers.members.invite"; - public const string PublisherMemberJoin = "publishers.members.join"; - public const string PublisherMemberLeave = "publishers.members.leave"; - public const string PublisherMemberKick = "publishers.members.kick"; - public const string RealmCreate = "realms.create"; - public const string RealmUpdate = "realms.update"; - public const string RealmDelete = "realms.delete"; - public const string RealmInvite = "realms.invite"; - public const string RealmJoin = "realms.join"; - public const string RealmLeave = "realms.leave"; - public const string RealmKick = "realms.kick"; - public const string RealmAdjustRole = "realms.role.edit"; - public const string ChatroomCreate = "chatrooms.create"; - public const string ChatroomUpdate = "chatrooms.update"; - public const string ChatroomDelete = "chatrooms.delete"; - public const string ChatroomInvite = "chatrooms.invite"; - public const string ChatroomJoin = "chatrooms.join"; - public const string ChatroomLeave = "chatrooms.leave"; - public const string ChatroomKick = "chatrooms.kick"; - public const string ChatroomAdjustRole = "chatrooms.role.edit"; -} - -public class ActionLog : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(4096)] public string Action { get; set; } = null!; - [Column(TypeName = "jsonb")] public Dictionary Meta { get; set; } = new(); - [MaxLength(512)] public string? UserAgent { get; set; } - [MaxLength(128)] public string? IpAddress { get; set; } - public Point? Location { get; set; } - - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; - public Guid? SessionId { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/ActionLogService.cs b/DysonNetwork.Sphere/Account/ActionLogService.cs deleted file mode 100644 index 0b963f2..0000000 --- a/DysonNetwork.Sphere/Account/ActionLogService.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Quartz; -using DysonNetwork.Sphere.Connection; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Storage.Handlers; - -namespace DysonNetwork.Sphere.Account; - -public class ActionLogService(GeoIpService geo, FlushBufferService fbs) -{ - public void CreateActionLog(Guid accountId, string action, Dictionary meta) - { - var log = new ActionLog - { - Action = action, - AccountId = accountId, - Meta = meta, - }; - - fbs.Enqueue(log); - } - - public void CreateActionLogFromRequest(string action, Dictionary meta, HttpRequest request, - Account? account = null) - { - var log = new ActionLog - { - Action = action, - Meta = meta, - UserAgent = request.Headers.UserAgent, - IpAddress = request.HttpContext.Connection.RemoteIpAddress?.ToString(), - Location = geo.GetPointFromIp(request.HttpContext.Connection.RemoteIpAddress?.ToString()) - }; - - if (request.HttpContext.Items["CurrentUser"] is Account currentUser) - log.AccountId = currentUser.Id; - else if (account != null) - log.AccountId = account.Id; - else - throw new ArgumentException("No user context was found"); - - if (request.HttpContext.Items["CurrentSession"] is Auth.Session currentSession) - log.SessionId = currentSession.Id; - - fbs.Enqueue(log); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/Badge.cs b/DysonNetwork.Sphere/Account/Badge.cs deleted file mode 100644 index 11368c4..0000000 --- a/DysonNetwork.Sphere/Account/Badge.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public class Badge : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(1024)] public string Type { get; set; } = null!; - [MaxLength(1024)] public string? Label { get; set; } - [MaxLength(4096)] public string? Caption { get; set; } - [Column(TypeName = "jsonb")] public Dictionary Meta { get; set; } = new(); - public Instant? ActivatedAt { get; set; } - public Instant? ExpiredAt { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; - - public BadgeReferenceObject ToReference() - { - return new BadgeReferenceObject - { - Id = Id, - Type = Type, - Label = Label, - Caption = Caption, - Meta = Meta, - ActivatedAt = ActivatedAt, - ExpiredAt = ExpiredAt, - AccountId = AccountId - }; - } -} - -public class BadgeReferenceObject : ModelBase -{ - public Guid Id { get; set; } - public string Type { get; set; } = null!; - public string? Label { get; set; } - public string? Caption { get; set; } - public Dictionary? Meta { get; set; } - public Instant? ActivatedAt { get; set; } - public Instant? ExpiredAt { get; set; } - public Guid AccountId { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/Event.cs b/DysonNetwork.Sphere/Account/Event.cs deleted file mode 100644 index 57fca37..0000000 --- a/DysonNetwork.Sphere/Account/Event.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public enum StatusAttitude -{ - Positive, - Negative, - Neutral -} - -public class Status : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public StatusAttitude Attitude { get; set; } - [NotMapped] public bool IsOnline { get; set; } - [NotMapped] public bool IsCustomized { get; set; } = true; - public bool IsInvisible { get; set; } - public bool IsNotDisturb { get; set; } - [MaxLength(1024)] public string? Label { get; set; } - public Instant? ClearedAt { get; set; } - - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; -} - -public enum CheckInResultLevel -{ - Worst, - Worse, - Normal, - Better, - Best -} - -public class CheckInResult : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public CheckInResultLevel Level { get; set; } - public decimal? RewardPoints { get; set; } - public int? RewardExperience { get; set; } - [Column(TypeName = "jsonb")] public ICollection Tips { get; set; } = new List(); - - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; -} - -public class FortuneTip -{ - public bool IsPositive { get; set; } - public string Title { get; set; } = null!; - public string Content { get; set; } = null!; -} - -/// -/// This method should not be mapped. Used to generate the daily event calendar. -/// -public class DailyEventResponse -{ - public Instant Date { get; set; } - public CheckInResult? CheckInResult { get; set; } - public ICollection Statuses { get; set; } = new List(); -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/MagicSpell.cs b/DysonNetwork.Sphere/Account/MagicSpell.cs deleted file mode 100644 index 674809c..0000000 --- a/DysonNetwork.Sphere/Account/MagicSpell.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public enum MagicSpellType -{ - AccountActivation, - AccountDeactivation, - AccountRemoval, - AuthPasswordReset, - ContactVerification, -} - -[Index(nameof(Spell), IsUnique = true)] -public class MagicSpell : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [JsonIgnore] [MaxLength(1024)] public string Spell { get; set; } = null!; - public MagicSpellType Type { get; set; } - public Instant? ExpiresAt { get; set; } - public Instant? AffectedAt { get; set; } - [Column(TypeName = "jsonb")] public Dictionary Meta { get; set; } = new(); - - public Guid? AccountId { get; set; } - public Account? Account { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/MagicSpellController.cs b/DysonNetwork.Sphere/Account/MagicSpellController.cs deleted file mode 100644 index a98f882..0000000 --- a/DysonNetwork.Sphere/Account/MagicSpellController.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace DysonNetwork.Sphere.Account; - -[ApiController] -[Route("/api/spells")] -public class MagicSpellController(AppDatabase db, MagicSpellService sp) : ControllerBase -{ - [HttpPost("{spellId:guid}/resend")] - public async Task ResendMagicSpell(Guid spellId) - { - var spell = db.MagicSpells.FirstOrDefault(x => x.Id == spellId); - if (spell == null) - return NotFound(); - - await sp.NotifyMagicSpell(spell, true); - return Ok(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/MagicSpellService.cs b/DysonNetwork.Sphere/Account/MagicSpellService.cs deleted file mode 100644 index 4cf2521..0000000 --- a/DysonNetwork.Sphere/Account/MagicSpellService.cs +++ /dev/null @@ -1,252 +0,0 @@ -using System.Globalization; -using System.Security.Cryptography; -using System.Text.Json; -using DysonNetwork.Sphere.Email; -using DysonNetwork.Sphere.Pages.Emails; -using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Resources.Localization; -using DysonNetwork.Sphere.Resources.Pages.Emails; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Localization; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public class MagicSpellService( - AppDatabase db, - EmailService email, - IConfiguration configuration, - ILogger logger, - IStringLocalizer localizer -) -{ - public async Task CreateMagicSpell( - Account account, - MagicSpellType type, - Dictionary meta, - Instant? expiredAt = null, - Instant? affectedAt = null, - bool preventRepeat = false - ) - { - if (preventRepeat) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var existingSpell = await db.MagicSpells - .Where(s => s.AccountId == account.Id) - .Where(s => s.Type == type) - .Where(s => s.ExpiresAt == null || s.ExpiresAt > now) - .FirstOrDefaultAsync(); - - if (existingSpell != null) - { - throw new InvalidOperationException($"Account already has an active magic spell of type {type}"); - } - } - - var spellWord = _GenerateRandomString(128); - var spell = new MagicSpell - { - Spell = spellWord, - Type = type, - ExpiresAt = expiredAt, - AffectedAt = affectedAt, - AccountId = account.Id, - Meta = meta - }; - - db.MagicSpells.Add(spell); - await db.SaveChangesAsync(); - - return spell; - } - - public async Task NotifyMagicSpell(MagicSpell spell, bool bypassVerify = false) - { - var contact = await db.AccountContacts - .Where(c => c.Account.Id == spell.AccountId) - .Where(c => c.Type == AccountContactType.Email) - .Where(c => c.VerifiedAt != null || bypassVerify) - .OrderByDescending(c => c.IsPrimary) - .Include(c => c.Account) - .FirstOrDefaultAsync(); - if (contact is null) throw new ArgumentException("Account has no contact method that can use"); - - var link = $"{configuration.GetValue("BaseUrl")}/spells/{Uri.EscapeDataString(spell.Spell)}"; - - logger.LogInformation("Sending magic spell... {Link}", link); - - var accountLanguage = await db.Accounts - .Where(a => a.Id == spell.AccountId) - .Select(a => a.Language) - .FirstOrDefaultAsync(); - AccountService.SetCultureInfo(accountLanguage); - - try - { - switch (spell.Type) - { - case MagicSpellType.AccountActivation: - await email.SendTemplatedEmailAsync( - contact.Account.Nick, - contact.Content, - localizer["EmailLandingTitle"], - new LandingEmailModel - { - Name = contact.Account.Name, - Link = link - } - ); - break; - case MagicSpellType.AccountRemoval: - await email.SendTemplatedEmailAsync( - contact.Account.Nick, - contact.Content, - localizer["EmailAccountDeletionTitle"], - new AccountDeletionEmailModel - { - Name = contact.Account.Name, - Link = link - } - ); - break; - case MagicSpellType.AuthPasswordReset: - await email.SendTemplatedEmailAsync( - contact.Account.Nick, - contact.Content, - localizer["EmailAccountDeletionTitle"], - new PasswordResetEmailModel - { - Name = contact.Account.Name, - Link = link - } - ); - break; - case MagicSpellType.ContactVerification: - if (spell.Meta["contact_method"] is not string contactMethod) - throw new InvalidOperationException("Contact method is not found."); - await email.SendTemplatedEmailAsync( - contact.Account.Nick, - contactMethod!, - localizer["EmailContactVerificationTitle"], - new ContactVerificationEmailModel - { - Name = contact.Account.Name, - Link = link - } - ); - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - catch (Exception err) - { - logger.LogError($"Error sending magic spell (${spell.Spell})... {err}"); - } - } - - public async Task ApplyMagicSpell(MagicSpell spell) - { - switch (spell.Type) - { - case MagicSpellType.AuthPasswordReset: - throw new ArgumentException( - "For password reset spell, please use the ApplyPasswordReset method instead." - ); - case MagicSpellType.AccountRemoval: - var account = await db.Accounts.FirstOrDefaultAsync(c => c.Id == spell.AccountId); - if (account is null) break; - db.Accounts.Remove(account); - break; - case MagicSpellType.AccountActivation: - var contactMethod = (spell.Meta["contact_method"] as JsonElement? ?? default).ToString(); - var contact = await - db.AccountContacts.FirstOrDefaultAsync(c => - c.Content == contactMethod - ); - if (contact is not null) - { - contact.VerifiedAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(contact); - } - - account = await db.Accounts.FirstOrDefaultAsync(c => c.Id == spell.AccountId); - if (account is not null) - { - account.ActivatedAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(account); - } - - var defaultGroup = await db.PermissionGroups.FirstOrDefaultAsync(g => g.Key == "default"); - if (defaultGroup is not null && account is not null) - { - db.PermissionGroupMembers.Add(new PermissionGroupMember - { - Actor = $"user:{account.Id}", - Group = defaultGroup - }); - } - - break; - case MagicSpellType.ContactVerification: - var verifyContactMethod = (spell.Meta["contact_method"] as JsonElement? ?? default).ToString(); - var verifyContact = await db.AccountContacts - .FirstOrDefaultAsync(c => c.Content == verifyContactMethod); - if (verifyContact is not null) - { - verifyContact.VerifiedAt = SystemClock.Instance.GetCurrentInstant(); - db.Update(verifyContact); - } - - break; - default: - throw new ArgumentOutOfRangeException(); - } - - db.Remove(spell); - await db.SaveChangesAsync(); - } - - public async Task ApplyPasswordReset(MagicSpell spell, string newPassword) - { - if (spell.Type != MagicSpellType.AuthPasswordReset) - throw new ArgumentException("This spell is not a password reset spell."); - - var passwordFactor = await db.AccountAuthFactors - .Include(f => f.Account) - .Where(f => f.Type == AccountAuthFactorType.Password && f.Account.Id == spell.AccountId) - .FirstOrDefaultAsync(); - if (passwordFactor is null) - { - var account = await db.Accounts.FirstOrDefaultAsync(c => c.Id == spell.AccountId); - if (account is null) throw new InvalidOperationException("Both account and auth factor was not found."); - passwordFactor = new AccountAuthFactor - { - Type = AccountAuthFactorType.Password, - Account = account, - Secret = newPassword - }.HashSecret(); - db.AccountAuthFactors.Add(passwordFactor); - } - else - { - passwordFactor.Secret = newPassword; - passwordFactor.HashSecret(); - db.Update(passwordFactor); - } - - await db.SaveChangesAsync(); - } - - private static string _GenerateRandomString(int length) - { - using var rng = RandomNumberGenerator.Create(); - var randomBytes = new byte[length]; - rng.GetBytes(randomBytes); - - var base64String = Convert.ToBase64String(randomBytes); - - return base64String.Substring(0, length); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/Notification.cs b/DysonNetwork.Sphere/Account/Notification.cs deleted file mode 100644 index 5095f83..0000000 --- a/DysonNetwork.Sphere/Account/Notification.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public class Notification : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(1024)] public string Topic { get; set; } = null!; - [MaxLength(1024)] public string? Title { get; set; } - [MaxLength(2048)] public string? Subtitle { get; set; } - [MaxLength(4096)] public string? Content { get; set; } - [Column(TypeName = "jsonb")] public Dictionary? Meta { get; set; } - public int Priority { get; set; } = 10; - public Instant? ViewedAt { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; -} - -public enum NotificationPushProvider -{ - Apple, - Google -} - -[Index(nameof(DeviceToken), nameof(DeviceId), nameof(AccountId), IsUnique = true)] -public class NotificationPushSubscription : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(4096)] public string DeviceId { get; set; } = null!; - [MaxLength(4096)] public string DeviceToken { get; set; } = null!; - public NotificationPushProvider Provider { get; set; } - public Instant? LastUsedAt { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account Account { get; set; } = null!; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/NotificationController.cs b/DysonNetwork.Sphere/Account/NotificationController.cs deleted file mode 100644 index 01d9a58..0000000 --- a/DysonNetwork.Sphere/Account/NotificationController.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Permission; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -[ApiController] -[Route("/api/notifications")] -public class NotificationController(AppDatabase db, NotificationService nty) : ControllerBase -{ - [HttpGet("count")] - [Authorize] - public async Task> CountUnreadNotifications() - { - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - if (currentUserValue is not Account currentUser) return Unauthorized(); - - var count = await db.Notifications - .Where(s => s.AccountId == currentUser.Id && s.ViewedAt == null) - .CountAsync(); - return Ok(count); - } - - [HttpGet] - [Authorize] - public async Task>> ListNotifications( - [FromQuery] int offset = 0, - // The page size set to 5 is to avoid the client pulled the notification - // but didn't render it in the screen-viewable region. - [FromQuery] int take = 5 - ) - { - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - if (currentUserValue is not Account currentUser) return Unauthorized(); - - var totalCount = await db.Notifications - .Where(s => s.AccountId == currentUser.Id) - .CountAsync(); - var notifications = await db.Notifications - .Where(s => s.AccountId == currentUser.Id) - .OrderByDescending(e => e.CreatedAt) - .Skip(offset) - .Take(take) - .ToListAsync(); - - Response.Headers["X-Total"] = totalCount.ToString(); - await nty.MarkNotificationsViewed(notifications); - - return Ok(notifications); - } - - public class PushNotificationSubscribeRequest - { - [MaxLength(4096)] public string DeviceToken { get; set; } = null!; - public NotificationPushProvider Provider { get; set; } - } - - [HttpPut("subscription")] - [Authorize] - public async Task> SubscribeToPushNotification( - [FromBody] PushNotificationSubscribeRequest request - ) - { - HttpContext.Items.TryGetValue("CurrentSession", out var currentSessionValue); - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account; - if (currentUser == null) return Unauthorized(); - var currentSession = currentSessionValue as Session; - if (currentSession == null) return Unauthorized(); - - var result = - await nty.SubscribePushNotification(currentUser, request.Provider, currentSession.Challenge.DeviceId!, - request.DeviceToken); - - return Ok(result); - } - - [HttpDelete("subscription")] - [Authorize] - public async Task> UnsubscribeFromPushNotification() - { - HttpContext.Items.TryGetValue("CurrentSession", out var currentSessionValue); - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account; - if (currentUser == null) return Unauthorized(); - var currentSession = currentSessionValue as Session; - if (currentSession == null) return Unauthorized(); - - var affectedRows = await db.NotificationPushSubscriptions - .Where(s => - s.AccountId == currentUser.Id && - s.DeviceId == currentSession.Challenge.DeviceId - ).ExecuteDeleteAsync(); - return Ok(affectedRows); - } - - public class NotificationRequest - { - [Required] [MaxLength(1024)] public string Topic { get; set; } = null!; - [Required] [MaxLength(1024)] public string Title { get; set; } = null!; - [MaxLength(2048)] public string? Subtitle { get; set; } - [Required] [MaxLength(4096)] public string Content { get; set; } = null!; - public Dictionary? Meta { get; set; } - public int Priority { get; set; } = 10; - } - - [HttpPost("broadcast")] - [Authorize] - [RequiredPermission("global", "notifications.broadcast")] - public async Task BroadcastNotification( - [FromBody] NotificationRequest request, - [FromQuery] bool save = false - ) - { - await nty.BroadcastNotification( - new Notification - { - CreatedAt = SystemClock.Instance.GetCurrentInstant(), - UpdatedAt = SystemClock.Instance.GetCurrentInstant(), - Topic = request.Topic, - Title = request.Title, - Subtitle = request.Subtitle, - Content = request.Content, - Meta = request.Meta, - Priority = request.Priority, - }, - save - ); - return Ok(); - } - - public class NotificationWithAimRequest : NotificationRequest - { - [Required] public List AccountId { get; set; } = null!; - } - - [HttpPost("send")] - [Authorize] - [RequiredPermission("global", "notifications.send")] - public async Task SendNotification( - [FromBody] NotificationWithAimRequest request, - [FromQuery] bool save = false - ) - { - var accounts = await db.Accounts.Where(a => request.AccountId.Contains(a.Id)).ToListAsync(); - await nty.SendNotificationBatch( - new Notification - { - CreatedAt = SystemClock.Instance.GetCurrentInstant(), - UpdatedAt = SystemClock.Instance.GetCurrentInstant(), - Topic = request.Topic, - Title = request.Title, - Subtitle = request.Subtitle, - Content = request.Content, - Meta = request.Meta, - }, - accounts, - save - ); - return Ok(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/NotificationService.cs b/DysonNetwork.Sphere/Account/NotificationService.cs deleted file mode 100644 index 00ebe80..0000000 --- a/DysonNetwork.Sphere/Account/NotificationService.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System.Text; -using System.Text.Json; -using DysonNetwork.Sphere.Connection; -using EFCore.BulkExtensions; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public class NotificationService( - AppDatabase db, - WebSocketService ws, - IHttpClientFactory httpFactory, - IConfiguration config) -{ - private readonly string _notifyTopic = config["Notifications:Topic"]!; - private readonly Uri _notifyEndpoint = new(config["Notifications:Endpoint"]!); - - public async Task UnsubscribePushNotifications(string deviceId) - { - await db.NotificationPushSubscriptions - .Where(s => s.DeviceId == deviceId) - .ExecuteDeleteAsync(); - } - - public async Task SubscribePushNotification( - Account account, - NotificationPushProvider provider, - string deviceId, - string deviceToken - ) - { - var now = SystemClock.Instance.GetCurrentInstant(); - - // First check if a matching subscription exists - var existingSubscription = await db.NotificationPushSubscriptions - .Where(s => s.AccountId == account.Id) - .Where(s => s.DeviceId == deviceId || s.DeviceToken == deviceToken) - .FirstOrDefaultAsync(); - - if (existingSubscription is not null) - { - // Update the existing subscription directly in the database - await db.NotificationPushSubscriptions - .Where(s => s.Id == existingSubscription.Id) - .ExecuteUpdateAsync(setters => setters - .SetProperty(s => s.DeviceId, deviceId) - .SetProperty(s => s.DeviceToken, deviceToken) - .SetProperty(s => s.UpdatedAt, now)); - - // Return the updated subscription - existingSubscription.DeviceId = deviceId; - existingSubscription.DeviceToken = deviceToken; - existingSubscription.UpdatedAt = now; - return existingSubscription; - } - - var subscription = new NotificationPushSubscription - { - DeviceId = deviceId, - DeviceToken = deviceToken, - Provider = provider, - AccountId = account.Id, - }; - - db.NotificationPushSubscriptions.Add(subscription); - await db.SaveChangesAsync(); - - return subscription; - } - - public async Task SendNotification( - Account account, - string topic, - string? title = null, - string? subtitle = null, - string? content = null, - Dictionary? meta = null, - string? actionUri = null, - bool isSilent = false, - bool save = true - ) - { - if (title is null && subtitle is null && content is null) - throw new ArgumentException("Unable to send notification that completely empty."); - - meta ??= new Dictionary(); - if (actionUri is not null) meta["action_uri"] = actionUri; - - var notification = new Notification - { - Topic = topic, - Title = title, - Subtitle = subtitle, - Content = content, - Meta = meta, - AccountId = account.Id, - }; - - if (save) - { - db.Add(notification); - await db.SaveChangesAsync(); - } - - if (!isSilent) _ = DeliveryNotification(notification); - - return notification; - } - - public async Task DeliveryNotification(Notification notification) - { - ws.SendPacketToAccount(notification.AccountId, new WebSocketPacket - { - Type = "notifications.new", - Data = notification - }); - - // Pushing the notification - var subscribers = await db.NotificationPushSubscriptions - .Where(s => s.AccountId == notification.AccountId) - .ToListAsync(); - - await _PushNotification(notification, subscribers); - } - - public async Task MarkNotificationsViewed(ICollection notifications) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var id = notifications.Where(n => n.ViewedAt == null).Select(n => n.Id).ToList(); - if (id.Count == 0) return; - - await db.Notifications - .Where(n => id.Contains(n.Id)) - .ExecuteUpdateAsync(s => s.SetProperty(n => n.ViewedAt, now) - ); - } - - public async Task BroadcastNotification(Notification notification, bool save = false) - { - var accounts = await db.Accounts.ToListAsync(); - - if (save) - { - var notifications = accounts.Select(x => - { - var newNotification = new Notification - { - Topic = notification.Topic, - Title = notification.Title, - Subtitle = notification.Subtitle, - Content = notification.Content, - Meta = notification.Meta, - Priority = notification.Priority, - Account = x, - AccountId = x.Id - }; - return newNotification; - }).ToList(); - await db.BulkInsertAsync(notifications); - } - - foreach (var account in accounts) - { - notification.Account = account; - notification.AccountId = account.Id; - ws.SendPacketToAccount(account.Id, new WebSocketPacket - { - Type = "notifications.new", - Data = notification - }); - } - - var subscribers = await db.NotificationPushSubscriptions - .ToListAsync(); - await _PushNotification(notification, subscribers); - } - - public async Task SendNotificationBatch(Notification notification, List accounts, bool save = false) - { - if (save) - { - var notifications = accounts.Select(x => - { - var newNotification = new Notification - { - Topic = notification.Topic, - Title = notification.Title, - Subtitle = notification.Subtitle, - Content = notification.Content, - Meta = notification.Meta, - Priority = notification.Priority, - AccountId = x.Id - }; - return newNotification; - }).ToList(); - await db.BulkInsertAsync(notifications); - } - - foreach (var account in accounts) - { - notification.Account = account; - notification.AccountId = account.Id; - ws.SendPacketToAccount(account.Id, new WebSocketPacket - { - Type = "notifications.new", - Data = notification - }); - } - - var accountsId = accounts.Select(x => x.Id).ToList(); - var subscribers = await db.NotificationPushSubscriptions - .Where(s => accountsId.Contains(s.AccountId)) - .ToListAsync(); - await _PushNotification(notification, subscribers); - } - - private List> _BuildNotificationPayload(Notification notification, - IEnumerable subscriptions) - { - var subDict = subscriptions - .GroupBy(x => x.Provider) - .ToDictionary(x => x.Key, x => x.ToList()); - - var notifications = subDict.Select(value => - { - var platformCode = value.Key switch - { - NotificationPushProvider.Apple => 1, - NotificationPushProvider.Google => 2, - _ => throw new InvalidOperationException($"Unknown push provider: {value.Key}") - }; - - var tokens = value.Value.Select(x => x.DeviceToken).ToList(); - return _BuildNotificationPayload(notification, platformCode, tokens); - }).ToList(); - - return notifications.ToList(); - } - - private Dictionary _BuildNotificationPayload(Notification notification, int platformCode, - IEnumerable deviceTokens) - { - var alertDict = new Dictionary(); - var dict = new Dictionary - { - ["notif_id"] = notification.Id.ToString(), - ["apns_id"] = notification.Id.ToString(), - ["topic"] = _notifyTopic, - ["tokens"] = deviceTokens, - ["data"] = new Dictionary - { - ["type"] = notification.Topic, - ["meta"] = notification.Meta ?? new Dictionary(), - }, - ["mutable_content"] = true, - ["priority"] = notification.Priority >= 5 ? "high" : "normal", - }; - - if (!string.IsNullOrWhiteSpace(notification.Title)) - { - dict["title"] = notification.Title; - alertDict["title"] = notification.Title; - } - - if (!string.IsNullOrWhiteSpace(notification.Content)) - { - dict["message"] = notification.Content; - alertDict["body"] = notification.Content; - } - - if (!string.IsNullOrWhiteSpace(notification.Subtitle)) - { - dict["message"] = $"{notification.Subtitle}\n{dict["message"]}"; - alertDict["subtitle"] = notification.Subtitle; - } - - if (notification.Priority >= 5) - dict["name"] = "default"; - - dict["platform"] = platformCode; - dict["alert"] = alertDict; - - return dict; - } - - private async Task _PushNotification(Notification notification, - IEnumerable subscriptions) - { - var subList = subscriptions.ToList(); - if (subList.Count == 0) return; - - var requestDict = new Dictionary - { - ["notifications"] = _BuildNotificationPayload(notification, subList) - }; - - var client = httpFactory.CreateClient(); - client.BaseAddress = _notifyEndpoint; - var request = await client.PostAsync("/push", new StringContent( - JsonSerializer.Serialize(requestDict), - Encoding.UTF8, - "application/json" - )); - request.EnsureSuccessStatusCode(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/Relationship.cs b/DysonNetwork.Sphere/Account/Relationship.cs deleted file mode 100644 index b46b60a..0000000 --- a/DysonNetwork.Sphere/Account/Relationship.cs +++ /dev/null @@ -1,22 +0,0 @@ -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public enum RelationshipStatus : short -{ - Friends = 100, - Pending = 0, - Blocked = -100 -} - -public class Relationship : ModelBase -{ - public Guid AccountId { get; set; } - public Account Account { get; set; } = null!; - public Guid RelatedId { get; set; } - public Account Related { get; set; } = null!; - - public Instant? ExpiredAt { get; set; } - - public RelationshipStatus Status { get; set; } = RelationshipStatus.Pending; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/RelationshipController.cs b/DysonNetwork.Sphere/Account/RelationshipController.cs deleted file mode 100644 index d91c43a..0000000 --- a/DysonNetwork.Sphere/Account/RelationshipController.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -[ApiController] -[Route("/api/relationships")] -public class RelationshipController(AppDatabase db, RelationshipService rels) : ControllerBase -{ - [HttpGet] - [Authorize] - public async Task>> ListRelationships([FromQuery] int offset = 0, - [FromQuery] int take = 20) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var userId = currentUser.Id; - - var query = db.AccountRelationships.AsQueryable() - .Where(r => r.RelatedId == userId); - var totalCount = await query.CountAsync(); - var relationships = await query - .Include(r => r.Related) - .Include(r => r.Related.Profile) - .Include(r => r.Account) - .Include(r => r.Account.Profile) - .Skip(offset) - .Take(take) - .ToListAsync(); - - var statuses = await db.AccountRelationships - .Where(r => r.AccountId == userId) - .ToDictionaryAsync(r => r.RelatedId); - foreach (var relationship in relationships) - if (statuses.TryGetValue(relationship.RelatedId, out var status)) - relationship.Status = status.Status; - - Response.Headers["X-Total"] = totalCount.ToString(); - - return relationships; - } - - [HttpGet("requests")] - [Authorize] - public async Task>> ListSentRequests() - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relationships = await db.AccountRelationships - .Where(r => r.AccountId == currentUser.Id && r.Status == RelationshipStatus.Pending) - .Include(r => r.Related) - .Include(r => r.Related.Profile) - .Include(r => r.Account) - .Include(r => r.Account.Profile) - .ToListAsync(); - - return relationships; - } - - public class RelationshipRequest - { - [Required] public RelationshipStatus Status { get; set; } - } - - [HttpPost("{userId:guid}")] - [Authorize] - public async Task> CreateRelationship(Guid userId, - [FromBody] RelationshipRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relatedUser = await db.Accounts.FindAsync(userId); - if (relatedUser is null) return NotFound("Account was not found."); - - try - { - var relationship = await rels.CreateRelationship( - currentUser, relatedUser, request.Status - ); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpPatch("{userId:guid}")] - [Authorize] - public async Task> UpdateRelationship(Guid userId, - [FromBody] RelationshipRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - var relationship = await rels.UpdateRelationship(currentUser.Id, userId, request.Status); - return relationship; - } - catch (ArgumentException err) - { - return NotFound(err.Message); - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpGet("{userId:guid}")] - [Authorize] - public async Task> GetRelationship(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var now = Instant.FromDateTimeUtc(DateTime.UtcNow); - var queries = db.AccountRelationships.AsQueryable() - .Where(r => r.AccountId == currentUser.Id && r.RelatedId == userId) - .Where(r => r.ExpiredAt == null || r.ExpiredAt > now); - var relationship = await queries - .Include(r => r.Related) - .Include(r => r.Related.Profile) - .FirstOrDefaultAsync(); - if (relationship is null) return NotFound(); - - relationship.Account = currentUser; - return Ok(relationship); - } - - [HttpPost("{userId:guid}/friends")] - [Authorize] - public async Task> SendFriendRequest(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relatedUser = await db.Accounts.FindAsync(userId); - if (relatedUser is null) return NotFound("Account was not found."); - - var existing = await db.AccountRelationships.FirstOrDefaultAsync(r => - (r.AccountId == currentUser.Id && r.RelatedId == userId) || - (r.AccountId == userId && r.RelatedId == currentUser.Id)); - if (existing != null) return BadRequest("Relationship already exists."); - - try - { - var relationship = await rels.SendFriendRequest(currentUser, relatedUser); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpDelete("{userId:guid}/friends")] - [Authorize] - public async Task DeleteFriendRequest(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - try - { - await rels.DeleteFriendRequest(currentUser.Id, userId); - return NoContent(); - } - catch (ArgumentException err) - { - return NotFound(err.Message); - } - } - - [HttpPost("{userId:guid}/friends/accept")] - [Authorize] - public async Task> AcceptFriendRequest(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relationship = await rels.GetRelationship(userId, currentUser.Id, RelationshipStatus.Pending); - if (relationship is null) return NotFound("Friend request was not found."); - - try - { - relationship = await rels.AcceptFriendRelationship(relationship); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpPost("{userId:guid}/friends/decline")] - [Authorize] - public async Task> DeclineFriendRequest(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relationship = await rels.GetRelationship(userId, currentUser.Id, RelationshipStatus.Pending); - if (relationship is null) return NotFound("Friend request was not found."); - - try - { - relationship = await rels.AcceptFriendRelationship(relationship, status: RelationshipStatus.Blocked); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpPost("{userId:guid}/block")] - [Authorize] - public async Task> BlockUser(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relatedUser = await db.Accounts.FindAsync(userId); - if (relatedUser is null) return NotFound("Account was not found."); - - try - { - var relationship = await rels.BlockAccount(currentUser, relatedUser); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } - - [HttpDelete("{userId:guid}/block")] - [Authorize] - public async Task> UnblockUser(Guid userId) - { - if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - - var relatedUser = await db.Accounts.FindAsync(userId); - if (relatedUser is null) return NotFound("Account was not found."); - - try - { - var relationship = await rels.UnblockAccount(currentUser, relatedUser); - return relationship; - } - catch (InvalidOperationException err) - { - return BadRequest(err.Message); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/RelationshipService.cs b/DysonNetwork.Sphere/Account/RelationshipService.cs deleted file mode 100644 index 51df3bf..0000000 --- a/DysonNetwork.Sphere/Account/RelationshipService.cs +++ /dev/null @@ -1,207 +0,0 @@ -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Account; - -public class RelationshipService(AppDatabase db, ICacheService cache) -{ - private const string UserFriendsCacheKeyPrefix = "accounts:friends:"; - private const string UserBlockedCacheKeyPrefix = "accounts:blocked:"; - - public async Task HasExistingRelationship(Guid accountId, Guid relatedId) - { - var count = await db.AccountRelationships - .Where(r => (r.AccountId == accountId && r.RelatedId == relatedId) || - (r.AccountId == relatedId && r.AccountId == accountId)) - .CountAsync(); - return count > 0; - } - - public async Task GetRelationship( - Guid accountId, - Guid relatedId, - RelationshipStatus? status = null, - bool ignoreExpired = false - ) - { - var now = Instant.FromDateTimeUtc(DateTime.UtcNow); - var queries = db.AccountRelationships.AsQueryable() - .Where(r => r.AccountId == accountId && r.RelatedId == relatedId); - if (!ignoreExpired) queries = queries.Where(r => r.ExpiredAt == null || r.ExpiredAt > now); - if (status is not null) queries = queries.Where(r => r.Status == status); - var relationship = await queries.FirstOrDefaultAsync(); - return relationship; - } - - public async Task CreateRelationship(Account sender, Account target, RelationshipStatus status) - { - if (status == RelationshipStatus.Pending) - throw new InvalidOperationException( - "Cannot create relationship with pending status, use SendFriendRequest instead."); - if (await HasExistingRelationship(sender.Id, target.Id)) - throw new InvalidOperationException("Found existing relationship between you and target user."); - - var relationship = new Relationship - { - AccountId = sender.Id, - RelatedId = target.Id, - Status = status - }; - - db.AccountRelationships.Add(relationship); - await db.SaveChangesAsync(); - - await PurgeRelationshipCache(sender.Id, target.Id); - - return relationship; - } - - public async Task BlockAccount(Account sender, Account target) - { - if (await HasExistingRelationship(sender.Id, target.Id)) - return await UpdateRelationship(sender.Id, target.Id, RelationshipStatus.Blocked); - return await CreateRelationship(sender, target, RelationshipStatus.Blocked); - } - - public async Task UnblockAccount(Account sender, Account target) - { - var relationship = await GetRelationship(sender.Id, target.Id, RelationshipStatus.Blocked); - if (relationship is null) throw new ArgumentException("There is no relationship between you and the user."); - db.Remove(relationship); - await db.SaveChangesAsync(); - - await PurgeRelationshipCache(sender.Id, target.Id); - - return relationship; - } - - public async Task SendFriendRequest(Account sender, Account target) - { - if (await HasExistingRelationship(sender.Id, target.Id)) - throw new InvalidOperationException("Found existing relationship between you and target user."); - - var relationship = new Relationship - { - AccountId = sender.Id, - RelatedId = target.Id, - Status = RelationshipStatus.Pending, - ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddDays(7)) - }; - - db.AccountRelationships.Add(relationship); - await db.SaveChangesAsync(); - - return relationship; - } - - public async Task DeleteFriendRequest(Guid accountId, Guid relatedId) - { - var relationship = await GetRelationship(accountId, relatedId, RelationshipStatus.Pending); - if (relationship is null) throw new ArgumentException("Friend request was not found."); - - await db.AccountRelationships - .Where(r => r.AccountId == accountId && r.RelatedId == relatedId && r.Status == RelationshipStatus.Pending) - .ExecuteDeleteAsync(); - - await PurgeRelationshipCache(relationship.AccountId, relationship.RelatedId); - } - - public async Task AcceptFriendRelationship( - Relationship relationship, - RelationshipStatus status = RelationshipStatus.Friends - ) - { - if (relationship.Status != RelationshipStatus.Pending) - throw new ArgumentException("Cannot accept friend request that not in pending status."); - if (status == RelationshipStatus.Pending) - throw new ArgumentException("Cannot accept friend request by setting the new status to pending."); - - // Whatever the receiver decides to apply which status to the relationship, - // the sender should always see the user as a friend since the sender ask for it - relationship.Status = RelationshipStatus.Friends; - relationship.ExpiredAt = null; - db.Update(relationship); - - var relationshipBackward = new Relationship - { - AccountId = relationship.RelatedId, - RelatedId = relationship.AccountId, - Status = status - }; - db.AccountRelationships.Add(relationshipBackward); - - await db.SaveChangesAsync(); - - await PurgeRelationshipCache(relationship.AccountId, relationship.RelatedId); - - return relationshipBackward; - } - - public async Task UpdateRelationship(Guid accountId, Guid relatedId, RelationshipStatus status) - { - var relationship = await GetRelationship(accountId, relatedId); - if (relationship is null) throw new ArgumentException("There is no relationship between you and the user."); - if (relationship.Status == status) return relationship; - relationship.Status = status; - db.Update(relationship); - await db.SaveChangesAsync(); - - await PurgeRelationshipCache(accountId, relatedId); - - return relationship; - } - - public async Task> ListAccountFriends(Account account) - { - var cacheKey = $"{UserFriendsCacheKeyPrefix}{account.Id}"; - var friends = await cache.GetAsync>(cacheKey); - - if (friends == null) - { - friends = await db.AccountRelationships - .Where(r => r.RelatedId == account.Id) - .Where(r => r.Status == RelationshipStatus.Friends) - .Select(r => r.AccountId) - .ToListAsync(); - - await cache.SetAsync(cacheKey, friends, TimeSpan.FromHours(1)); - } - - return friends ?? []; - } - - public async Task> ListAccountBlocked(Account account) - { - var cacheKey = $"{UserBlockedCacheKeyPrefix}{account.Id}"; - var blocked = await cache.GetAsync>(cacheKey); - - if (blocked == null) - { - blocked = await db.AccountRelationships - .Where(r => r.RelatedId == account.Id) - .Where(r => r.Status == RelationshipStatus.Blocked) - .Select(r => r.AccountId) - .ToListAsync(); - - await cache.SetAsync(cacheKey, blocked, TimeSpan.FromHours(1)); - } - - return blocked ?? []; - } - - public async Task HasRelationshipWithStatus(Guid accountId, Guid relatedId, - RelationshipStatus status = RelationshipStatus.Friends) - { - var relationship = await GetRelationship(accountId, relatedId, status); - return relationship is not null; - } - - private async Task PurgeRelationshipCache(Guid accountId, Guid relatedId) - { - await cache.RemoveAsync($"{UserFriendsCacheKeyPrefix}{accountId}"); - await cache.RemoveAsync($"{UserFriendsCacheKeyPrefix}{relatedId}"); - await cache.RemoveAsync($"{UserBlockedCacheKeyPrefix}{accountId}"); - await cache.RemoveAsync($"{UserBlockedCacheKeyPrefix}{relatedId}"); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Account/VerificationMark.cs b/DysonNetwork.Sphere/Account/VerificationMark.cs deleted file mode 100644 index 4f0e6c3..0000000 --- a/DysonNetwork.Sphere/Account/VerificationMark.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace DysonNetwork.Sphere.Account; - -/// -/// The verification info of a resource -/// stands, for it is really an individual or organization or a company in the real world. -/// Besides, it can also be use for mark parody or fake. -/// -public class VerificationMark -{ - public VerificationMarkType Type { get; set; } - [MaxLength(1024)] public string? Title { get; set; } - [MaxLength(8192)] public string? Description { get; set; } - [MaxLength(1024)] public string? VerifiedBy { get; set; } -} - -public enum VerificationMarkType -{ - Official, - Individual, - Organization, - Government, - Creator -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Activity/ActivityController.cs b/DysonNetwork.Sphere/Activity/ActivityController.cs index 10db5a2..e5bfa26 100644 --- a/DysonNetwork.Sphere/Activity/ActivityController.cs +++ b/DysonNetwork.Sphere/Activity/ActivityController.cs @@ -1,3 +1,4 @@ +using DysonNetwork.Shared.Proto; using Microsoft.AspNetCore.Mvc; using NodaTime; using NodaTime.Text; @@ -45,7 +46,7 @@ public class ActivityController( var debugIncludeSet = debugInclude?.Split(',').ToHashSet() ?? new HashSet(); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - return currentUserValue is not Account.Account currentUser + return currentUserValue is not Account currentUser ? Ok(await acts.GetActivitiesForAnyone(take, cursorTimestamp, debugIncludeSet)) : Ok(await acts.GetActivities(take, cursorTimestamp, currentUser, filter, debugIncludeSet)); } diff --git a/DysonNetwork.Sphere/Activity/ActivityService.cs b/DysonNetwork.Sphere/Activity/ActivityService.cs index 5adbd50..823c84b 100644 --- a/DysonNetwork.Sphere/Activity/ActivityService.cs +++ b/DysonNetwork.Sphere/Activity/ActivityService.cs @@ -1,5 +1,6 @@ +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Connection.WebReader; +using DysonNetwork.Sphere.WebReader; using DysonNetwork.Sphere.Discovery; using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Publisher; @@ -118,14 +119,14 @@ public class ActivityService( public async Task> GetActivities( int take, Instant? cursor, - Account.Account currentUser, + Account currentUser, string? filter = null, HashSet? debugInclude = null ) { var activities = new List(); var userFriends = await rels.ListAccountFriends(currentUser); - var userPublishers = await pub.GetUserPublishers(currentUser.Id); + var userPublishers = await pub.GetUserPublishers(Guid.Parse(currentUser.Id)); debugInclude ??= []; if (string.IsNullOrEmpty(filter)) @@ -190,7 +191,7 @@ public class ActivityService( // Get publishers based on filter var filteredPublishers = filter switch { - "subscriptions" => await pub.GetSubscribedPublishers(currentUser.Id), + "subscriptions" => await pub.GetSubscribedPublishers(Guid.Parse(currentUser.Id)), "friends" => (await pub.GetUserPublishersBatch(userFriends)).SelectMany(x => x.Value) .DistinctBy(x => x.Id) .ToList(), diff --git a/DysonNetwork.Sphere/AppDatabase.cs b/DysonNetwork.Sphere/AppDatabase.cs index 1f635c6..e77bcbc 100644 --- a/DysonNetwork.Sphere/AppDatabase.cs +++ b/DysonNetwork.Sphere/AppDatabase.cs @@ -1,7 +1,5 @@ using System.Linq.Expressions; using System.Reflection; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Auth; using DysonNetwork.Sphere.Chat; using DysonNetwork.Sphere.Developer; using DysonNetwork.Sphere.Permission; @@ -9,13 +7,10 @@ using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Publisher; using DysonNetwork.Sphere.Realm; using DysonNetwork.Sphere.Sticker; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Query; using NodaTime; -using Npgsql; using Quartz; namespace DysonNetwork.Sphere; @@ -41,27 +36,6 @@ public class AppDatabase( public DbSet PermissionGroups { get; set; } public DbSet PermissionGroupMembers { get; set; } - public DbSet MagicSpells { get; set; } - public DbSet Accounts { get; set; } - public DbSet AccountConnections { get; set; } - public DbSet AccountProfiles { get; set; } - public DbSet AccountContacts { get; set; } - public DbSet AccountAuthFactors { get; set; } - public DbSet AccountRelationships { get; set; } - public DbSet AccountStatuses { get; set; } - public DbSet AccountCheckInResults { get; set; } - public DbSet Notifications { get; set; } - public DbSet NotificationPushSubscriptions { get; set; } - public DbSet Badges { get; set; } - public DbSet ActionLogs { get; set; } - public DbSet AbuseReports { get; set; } - - public DbSet AuthSessions { get; set; } - public DbSet AuthChallenges { get; set; } - - public DbSet Files { get; set; } - public DbSet FileReferences { get; set; } - public DbSet Publishers { get; set; } public DbSet PublisherMembers { get; set; } public DbSet PublisherSubscriptions { get; set; } @@ -87,18 +61,11 @@ public class AppDatabase( public DbSet Stickers { get; set; } public DbSet StickerPacks { get; set; } - public DbSet Wallets { get; set; } - public DbSet WalletPockets { get; set; } - public DbSet PaymentOrders { get; set; } - public DbSet PaymentTransactions { get; set; } - public DbSet CustomApps { get; set; } public DbSet CustomAppSecrets { get; set; } - public DbSet WalletSubscriptions { get; set; } - public DbSet WalletCoupons { get; set; } - public DbSet WebArticles { get; set; } - public DbSet WebFeeds { get; set; } + public DbSet WebArticles { get; set; } + public DbSet WebFeeds { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { @@ -158,17 +125,6 @@ public class AppDatabase( .HasForeignKey(pg => pg.GroupId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() - .HasKey(r => new { FromAccountId = r.AccountId, ToAccountId = r.RelatedId }); - modelBuilder.Entity() - .HasOne(r => r.Account) - .WithMany(a => a.OutgoingRelationships) - .HasForeignKey(r => r.AccountId); - modelBuilder.Entity() - .HasOne(r => r.Related) - .WithMany(a => a.IncomingRelationships) - .HasForeignKey(r => r.RelatedId); - modelBuilder.Entity() .HasKey(pm => new { pm.PublisherId, pm.AccountId }); modelBuilder.Entity() @@ -176,21 +132,11 @@ public class AppDatabase( .WithMany(p => p.Members) .HasForeignKey(pm => pm.PublisherId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() - .HasOne(pm => pm.Account) - .WithMany() - .HasForeignKey(pm => pm.AccountId) - .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity() .HasOne(ps => ps.Publisher) .WithMany(p => p.Subscriptions) .HasForeignKey(ps => ps.PublisherId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() - .HasOne(ps => ps.Account) - .WithMany() - .HasForeignKey(ps => ps.AccountId) - .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity() .HasGeneratedTsVectorColumn(p => p.SearchVector, "simple", p => new { p.Title, p.Description, p.Content }) @@ -237,11 +183,6 @@ public class AppDatabase( .WithMany(p => p.Members) .HasForeignKey(pm => pm.RealmId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() - .HasOne(pm => pm.Account) - .WithMany() - .HasForeignKey(pm => pm.AccountId) - .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity() .HasKey(rt => new { rt.RealmId, rt.TagId }); @@ -265,11 +206,6 @@ public class AppDatabase( .WithMany(p => p.Members) .HasForeignKey(pm => pm.ChatRoomId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() - .HasOne(pm => pm.Account) - .WithMany() - .HasForeignKey(pm => pm.AccountId) - .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity() .HasOne(m => m.ForwardedMessage) .WithMany() @@ -291,11 +227,10 @@ public class AppDatabase( .HasForeignKey(m => m.SenderId) .OnDelete(DeleteBehavior.Cascade); - modelBuilder.Entity() + modelBuilder.Entity() .HasIndex(f => f.Url) .IsUnique(); - - modelBuilder.Entity() + modelBuilder.Entity() .HasIndex(a => a.Url) .IsUnique(); @@ -356,13 +291,8 @@ public class AppDatabaseRecyclingJob(AppDatabase db, ILogger x.ExpiredAt != null && x.ExpiredAt <= now) - .ExecuteDeleteAsync(); - logger.LogDebug("Removed {Count} records of expired relationships.", affectedRows); // Expired permission group members - affectedRows = await db.PermissionGroupMembers + var affectedRows = await db.PermissionGroupMembers .Where(x => x.ExpiredAt != null && x.ExpiredAt <= now) .ExecuteDeleteAsync(); logger.LogDebug("Removed {Count} records of expired permission group members.", affectedRows); diff --git a/DysonNetwork.Sphere/Auth/Auth.cs b/DysonNetwork.Sphere/Auth/Auth.cs deleted file mode 100644 index 135f6bd..0000000 --- a/DysonNetwork.Sphere/Auth/Auth.cs +++ /dev/null @@ -1,279 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Security.Cryptography; -using System.Text.Encodings.Web; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Auth.OidcProvider.Options; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Storage.Handlers; -using Microsoft.AspNetCore.Authentication; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Options; -using Microsoft.IdentityModel.Tokens; -using NodaTime; -using System.Text; -using DysonNetwork.Sphere.Auth.OidcProvider.Controllers; -using DysonNetwork.Sphere.Auth.OidcProvider.Services; -using SystemClock = NodaTime.SystemClock; - -namespace DysonNetwork.Sphere.Auth; - -public static class AuthConstants -{ - public const string SchemeName = "DysonToken"; - public const string TokenQueryParamName = "tk"; - public const string CookieTokenName = "AuthToken"; -} - -public enum TokenType -{ - AuthKey, - ApiKey, - OidcKey, - Unknown -} - -public class TokenInfo -{ - public string Token { get; set; } = string.Empty; - public TokenType Type { get; set; } = TokenType.Unknown; -} - -public class DysonTokenAuthOptions : AuthenticationSchemeOptions; - -public class DysonTokenAuthHandler( - IOptionsMonitor options, - IConfiguration configuration, - ILoggerFactory logger, - UrlEncoder encoder, - AppDatabase database, - OidcProviderService oidc, - ICacheService cache, - FlushBufferService fbs -) - : AuthenticationHandler(options, logger, encoder) -{ - public const string AuthCachePrefix = "auth:"; - - protected override async Task HandleAuthenticateAsync() - { - var tokenInfo = _ExtractToken(Request); - - if (tokenInfo == null || string.IsNullOrEmpty(tokenInfo.Token)) - return AuthenticateResult.Fail("No token was provided."); - - try - { - var now = SystemClock.Instance.GetCurrentInstant(); - - // Validate token and extract session ID - if (!ValidateToken(tokenInfo.Token, out var sessionId)) - return AuthenticateResult.Fail("Invalid token."); - - // Try to get session from cache first - var session = await cache.GetAsync($"{AuthCachePrefix}{sessionId}"); - - // If not in cache, load from database - if (session is null) - { - session = await database.AuthSessions - .Where(e => e.Id == sessionId) - .Include(e => e.Challenge) - .Include(e => e.Account) - .ThenInclude(e => e.Profile) - .FirstOrDefaultAsync(); - - if (session is not null) - { - // Store in cache for future requests - await cache.SetWithGroupsAsync( - $"auth:{sessionId}", - session, - [$"{AccountService.AccountCachePrefix}{session.Account.Id}"], - TimeSpan.FromHours(1) - ); - } - } - - // Check if the session exists - if (session == null) - return AuthenticateResult.Fail("Session not found."); - - // Check if the session is expired - if (session.ExpiredAt.HasValue && session.ExpiredAt.Value < now) - return AuthenticateResult.Fail("Session expired."); - - // Store user and session in the HttpContext.Items for easy access in controllers - Context.Items["CurrentUser"] = session.Account; - Context.Items["CurrentSession"] = session; - Context.Items["CurrentTokenType"] = tokenInfo.Type.ToString(); - - // Create claims from the session - var claims = new List - { - new("user_id", session.Account.Id.ToString()), - new("session_id", session.Id.ToString()), - new("token_type", tokenInfo.Type.ToString()) - }; - - // Add scopes as claims - session.Challenge.Scopes.ForEach(scope => claims.Add(new Claim("scope", scope))); - - // Add superuser claim if applicable - if (session.Account.IsSuperuser) - claims.Add(new Claim("is_superuser", "1")); - - // Create the identity and principal - var identity = new ClaimsIdentity(claims, AuthConstants.SchemeName); - var principal = new ClaimsPrincipal(identity); - - var ticket = new AuthenticationTicket(principal, AuthConstants.SchemeName); - - var lastInfo = new LastActiveInfo - { - Account = session.Account, - Session = session, - SeenAt = SystemClock.Instance.GetCurrentInstant(), - }; - fbs.Enqueue(lastInfo); - - return AuthenticateResult.Success(ticket); - } - catch (Exception ex) - { - return AuthenticateResult.Fail($"Authentication failed: {ex.Message}"); - } - } - - private bool ValidateToken(string token, out Guid sessionId) - { - sessionId = Guid.Empty; - - try - { - var parts = token.Split('.'); - - switch (parts.Length) - { - // Handle JWT tokens (3 parts) - case 3: - { - var (isValid, jwtResult) = oidc.ValidateToken(token); - if (!isValid) return false; - var jti = jwtResult?.Claims.FirstOrDefault(c => c.Type == "jti")?.Value; - if (jti is null) return false; - - return Guid.TryParse(jti, out sessionId); - } - // Handle compact tokens (2 parts) - case 2: - // Original compact token validation logic - try - { - // Decode the payload - var payloadBytes = Base64UrlDecode(parts[0]); - - // Extract session ID - sessionId = new Guid(payloadBytes); - - // Load public key for verification - var publicKeyPem = File.ReadAllText(configuration["AuthToken:PublicKeyPath"]!); - using var rsa = RSA.Create(); - rsa.ImportFromPem(publicKeyPem); - - // Verify signature - var signature = Base64UrlDecode(parts[1]); - return rsa.VerifyData(payloadBytes, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - } - catch - { - return false; - } - - break; - default: - return false; - } - } - catch (Exception ex) - { - Logger.LogWarning(ex, "Token validation failed"); - return false; - } - } - - private static byte[] Base64UrlDecode(string base64Url) - { - var padded = base64Url - .Replace('-', '+') - .Replace('_', '/'); - - switch (padded.Length % 4) - { - case 2: padded += "=="; break; - case 3: padded += "="; break; - } - - return Convert.FromBase64String(padded); - } - - private TokenInfo? _ExtractToken(HttpRequest request) - { - // Check for token in query parameters - if (request.Query.TryGetValue(AuthConstants.TokenQueryParamName, out var queryToken)) - { - return new TokenInfo - { - Token = queryToken.ToString(), - Type = TokenType.AuthKey - }; - } - - - // Check for token in Authorization header - var authHeader = request.Headers.Authorization.ToString(); - if (!string.IsNullOrEmpty(authHeader)) - { - if (authHeader.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) - { - var token = authHeader["Bearer ".Length..].Trim(); - var parts = token.Split('.'); - - return new TokenInfo - { - Token = token, - Type = parts.Length == 3 ? TokenType.OidcKey : TokenType.AuthKey - }; - } - else if (authHeader.StartsWith("AtField ", StringComparison.OrdinalIgnoreCase)) - { - return new TokenInfo - { - Token = authHeader["AtField ".Length..].Trim(), - Type = TokenType.AuthKey - }; - } - else if (authHeader.StartsWith("AkField ", StringComparison.OrdinalIgnoreCase)) - { - return new TokenInfo - { - Token = authHeader["AkField ".Length..].Trim(), - Type = TokenType.ApiKey - }; - } - } - - // Check for token in cookies - if (request.Cookies.TryGetValue(AuthConstants.CookieTokenName, out var cookieToken)) - { - return new TokenInfo - { - Token = cookieToken, - Type = cookieToken.Count(c => c == '.') == 2 ? TokenType.OidcKey : TokenType.AuthKey - }; - } - - - return null; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/AuthController.cs b/DysonNetwork.Sphere/Auth/AuthController.cs deleted file mode 100644 index e34769c..0000000 --- a/DysonNetwork.Sphere/Auth/AuthController.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Account; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using NodaTime; -using Microsoft.EntityFrameworkCore; -using System.IdentityModel.Tokens.Jwt; -using System.Text.Json; -using DysonNetwork.Sphere.Connection; - -namespace DysonNetwork.Sphere.Auth; - -[ApiController] -[Route("/api/auth")] -public class AuthController( - AppDatabase db, - AccountService accounts, - AuthService auth, - GeoIpService geo, - ActionLogService als -) : ControllerBase -{ - public class ChallengeRequest - { - [Required] public ChallengePlatform Platform { get; set; } - [Required] [MaxLength(256)] public string Account { get; set; } = null!; - [Required] [MaxLength(512)] public string DeviceId { get; set; } = null!; - public List Audiences { get; set; } = new(); - public List Scopes { get; set; } = new(); - } - - [HttpPost("challenge")] - public async Task> StartChallenge([FromBody] ChallengeRequest request) - { - var account = await accounts.LookupAccount(request.Account); - if (account is null) return NotFound("Account was not found."); - - var ipAddress = HttpContext.Connection.RemoteIpAddress?.ToString(); - var userAgent = HttpContext.Request.Headers.UserAgent.ToString(); - - var now = Instant.FromDateTimeUtc(DateTime.UtcNow); - - // Trying to pick up challenges from the same IP address and user agent - var existingChallenge = await db.AuthChallenges - .Where(e => e.Account == account) - .Where(e => e.IpAddress == ipAddress) - .Where(e => e.UserAgent == userAgent) - .Where(e => e.StepRemain > 0) - .Where(e => e.ExpiredAt != null && now < e.ExpiredAt) - .FirstOrDefaultAsync(); - if (existingChallenge is not null) return existingChallenge; - - var challenge = new Challenge - { - ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddHours(1)), - StepTotal = await auth.DetectChallengeRisk(Request, account), - Platform = request.Platform, - Audiences = request.Audiences, - Scopes = request.Scopes, - IpAddress = ipAddress, - UserAgent = userAgent, - Location = geo.GetPointFromIp(ipAddress), - DeviceId = request.DeviceId, - AccountId = account.Id - }.Normalize(); - - await db.AuthChallenges.AddAsync(challenge); - await db.SaveChangesAsync(); - - als.CreateActionLogFromRequest(ActionLogType.ChallengeAttempt, - new Dictionary { { "challenge_id", challenge.Id } }, Request, account - ); - - return challenge; - } - - [HttpGet("challenge/{id:guid}")] - public async Task> GetChallenge([FromRoute] Guid id) - { - var challenge = await db.AuthChallenges - .Include(e => e.Account) - .ThenInclude(e => e.Profile) - .FirstOrDefaultAsync(e => e.Id == id); - - return challenge is null - ? NotFound("Auth challenge was not found.") - : challenge; - } - - [HttpGet("challenge/{id:guid}/factors")] - public async Task>> GetChallengeFactors([FromRoute] Guid id) - { - var challenge = await db.AuthChallenges - .Include(e => e.Account) - .Include(e => e.Account.AuthFactors) - .Where(e => e.Id == id) - .FirstOrDefaultAsync(); - return challenge is null - ? NotFound("Auth challenge was not found.") - : challenge.Account.AuthFactors.Where(e => e is { EnabledAt: not null, Trustworthy: >= 1 }).ToList(); - } - - [HttpPost("challenge/{id:guid}/factors/{factorId:guid}")] - public async Task RequestFactorCode( - [FromRoute] Guid id, - [FromRoute] Guid factorId, - [FromBody] string? hint - ) - { - var challenge = await db.AuthChallenges - .Include(e => e.Account) - .Where(e => e.Id == id).FirstOrDefaultAsync(); - if (challenge is null) return NotFound("Auth challenge was not found."); - var factor = await db.AccountAuthFactors - .Where(e => e.Id == factorId) - .Where(e => e.Account == challenge.Account).FirstOrDefaultAsync(); - if (factor is null) return NotFound("Auth factor was not found."); - - try - { - await accounts.SendFactorCode(challenge.Account, factor, hint); - } - catch (Exception ex) - { - return BadRequest(ex.Message); - } - - return Ok(); - } - - public class PerformChallengeRequest - { - [Required] public Guid FactorId { get; set; } - [Required] public string Password { get; set; } = string.Empty; - } - - [HttpPatch("challenge/{id:guid}")] - public async Task> DoChallenge( - [FromRoute] Guid id, - [FromBody] PerformChallengeRequest request - ) - { - var challenge = await db.AuthChallenges.Include(e => e.Account).FirstOrDefaultAsync(e => e.Id == id); - if (challenge is null) return NotFound("Auth challenge was not found."); - - var factor = await db.AccountAuthFactors.FindAsync(request.FactorId); - if (factor is null) return NotFound("Auth factor was not found."); - if (factor.EnabledAt is null) return BadRequest("Auth factor is not enabled."); - if (factor.Trustworthy <= 0) return BadRequest("Auth factor is not trustworthy."); - - if (challenge.StepRemain == 0) return challenge; - if (challenge.ExpiredAt.HasValue && challenge.ExpiredAt.Value < Instant.FromDateTimeUtc(DateTime.UtcNow)) - return BadRequest(); - - try - { - if (await accounts.VerifyFactorCode(factor, request.Password)) - { - challenge.StepRemain -= factor.Trustworthy; - challenge.StepRemain = Math.Max(0, challenge.StepRemain); - challenge.BlacklistFactors.Add(factor.Id); - db.Update(challenge); - als.CreateActionLogFromRequest(ActionLogType.ChallengeSuccess, - new Dictionary - { - { "challenge_id", challenge.Id }, - { "factor_id", factor.Id } - }, Request, challenge.Account - ); - } - else - { - throw new ArgumentException("Invalid password."); - } - } - catch - { - challenge.FailedAttempts++; - db.Update(challenge); - als.CreateActionLogFromRequest(ActionLogType.ChallengeFailure, - new Dictionary - { - { "challenge_id", challenge.Id }, - { "factor_id", factor.Id } - }, Request, challenge.Account - ); - await db.SaveChangesAsync(); - return BadRequest("Invalid password."); - } - - if (challenge.StepRemain == 0) - { - als.CreateActionLogFromRequest(ActionLogType.NewLogin, - new Dictionary - { - { "challenge_id", challenge.Id }, - { "account_id", challenge.AccountId } - }, Request, challenge.Account - ); - } - - await db.SaveChangesAsync(); - return challenge; - } - - public class TokenExchangeRequest - { - public string GrantType { get; set; } = string.Empty; - public string? RefreshToken { get; set; } - public string? Code { get; set; } - } - - public class TokenExchangeResponse - { - public string Token { get; set; } = string.Empty; - } - - [HttpPost("token")] - public async Task> ExchangeToken([FromBody] TokenExchangeRequest request) - { - switch (request.GrantType) - { - case "authorization_code": - var code = Guid.TryParse(request.Code, out var codeId) ? codeId : Guid.Empty; - if (code == Guid.Empty) - return BadRequest("Invalid or missing authorization code."); - var challenge = await db.AuthChallenges - .Include(e => e.Account) - .Where(e => e.Id == code) - .FirstOrDefaultAsync(); - if (challenge is null) - return BadRequest("Authorization code not found or expired."); - if (challenge.StepRemain != 0) - return BadRequest("Challenge not yet completed."); - - var session = await db.AuthSessions - .Where(e => e.Challenge == challenge) - .FirstOrDefaultAsync(); - if (session is not null) - return BadRequest("Session already exists for this challenge."); - - session = new Session - { - LastGrantedAt = Instant.FromDateTimeUtc(DateTime.UtcNow), - ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddDays(30)), - Account = challenge.Account, - Challenge = challenge, - }; - - db.AuthSessions.Add(session); - await db.SaveChangesAsync(); - - var tk = auth.CreateToken(session); - return Ok(new TokenExchangeResponse { Token = tk }); - case "refresh_token": - // Since we no longer need the refresh token - // This case is blank for now, thinking to mock it if the OIDC standard requires it - default: - return BadRequest("Unsupported grant type."); - } - } - - [HttpPost("captcha")] - public async Task ValidateCaptcha([FromBody] string token) - { - var result = await auth.ValidateCaptcha(token); - return result ? Ok() : BadRequest(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/AuthService.cs b/DysonNetwork.Sphere/Auth/AuthService.cs deleted file mode 100644 index d0c2ee3..0000000 --- a/DysonNetwork.Sphere/Auth/AuthService.cs +++ /dev/null @@ -1,304 +0,0 @@ -using System.Security.Cryptography; -using System.Text.Json; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth; - -public class AuthService( - AppDatabase db, - IConfiguration config, - IHttpClientFactory httpClientFactory, - IHttpContextAccessor httpContextAccessor, - ICacheService cache -) -{ - private HttpContext HttpContext => httpContextAccessor.HttpContext!; - - /// - /// Detect the risk of the current request to login - /// and returns the required steps to login. - /// - /// The request context - /// The account to login - /// The required steps to login - public async Task DetectChallengeRisk(HttpRequest request, Account.Account account) - { - // 1) Find out how many authentication factors the account has enabled. - var maxSteps = await db.AccountAuthFactors - .Where(f => f.AccountId == account.Id) - .Where(f => f.EnabledAt != null) - .CountAsync(); - - // We’ll accumulate a “risk score” based on various factors. - // Then we can decide how many total steps are required for the challenge. - var riskScore = 0; - - // 2) Get the remote IP address from the request (if any). - var ipAddress = request.HttpContext.Connection.RemoteIpAddress?.ToString(); - var lastActiveInfo = await db.AuthSessions - .OrderByDescending(s => s.LastGrantedAt) - .Include(s => s.Challenge) - .Where(s => s.AccountId == account.Id) - .FirstOrDefaultAsync(); - - // Example check: if IP is missing or in an unusual range, increase the risk. - // (This is just a placeholder; in reality, you’d integrate with GeoIpService or a custom check.) - if (string.IsNullOrWhiteSpace(ipAddress)) - riskScore += 1; - else - { - if (!string.IsNullOrEmpty(lastActiveInfo?.Challenge.IpAddress) && - !lastActiveInfo.Challenge.IpAddress.Equals(ipAddress, StringComparison.OrdinalIgnoreCase)) - riskScore += 1; - } - - // 3) (Optional) Check how recent the last login was. - // If it was a long time ago, the risk might be higher. - var now = SystemClock.Instance.GetCurrentInstant(); - var daysSinceLastActive = lastActiveInfo?.LastGrantedAt is not null - ? (now - lastActiveInfo.LastGrantedAt.Value).TotalDays - : double.MaxValue; - if (daysSinceLastActive > 30) - riskScore += 1; - - // 4) Combine base “maxSteps” (the number of enabled factors) with any accumulated risk score. - const int totalRiskScore = 3; - var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / totalRiskScore); - // Clamp the steps - totalRequiredSteps = Math.Max(Math.Min(totalRequiredSteps, maxSteps), 1); - - return totalRequiredSteps; - } - - public async Task CreateSessionForOidcAsync(Account.Account account, Instant time, Guid? customAppId = null) - { - var challenge = new Challenge - { - AccountId = account.Id, - IpAddress = HttpContext.Connection.RemoteIpAddress?.ToString(), - UserAgent = HttpContext.Request.Headers.UserAgent, - StepRemain = 1, - StepTotal = 1, - Type = customAppId is not null ? ChallengeType.OAuth : ChallengeType.Oidc - }; - - var session = new Session - { - AccountId = account.Id, - CreatedAt = time, - LastGrantedAt = time, - Challenge = challenge, - AppId = customAppId - }; - - db.AuthChallenges.Add(challenge); - db.AuthSessions.Add(session); - await db.SaveChangesAsync(); - - return session; - } - - public async Task ValidateCaptcha(string token) - { - if (string.IsNullOrWhiteSpace(token)) return false; - - var provider = config.GetSection("Captcha")["Provider"]?.ToLower(); - var apiSecret = config.GetSection("Captcha")["ApiSecret"]; - - var client = httpClientFactory.CreateClient(); - - var jsonOpts = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, - DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower - }; - - switch (provider) - { - case "cloudflare": - var content = new StringContent($"secret={apiSecret}&response={token}", System.Text.Encoding.UTF8, - "application/x-www-form-urlencoded"); - var response = await client.PostAsync("https://challenges.cloudflare.com/turnstile/v0/siteverify", - content); - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - var result = JsonSerializer.Deserialize(json, options: jsonOpts); - - return result?.Success == true; - case "google": - content = new StringContent($"secret={apiSecret}&response={token}", System.Text.Encoding.UTF8, - "application/x-www-form-urlencoded"); - response = await client.PostAsync("https://www.google.com/recaptcha/siteverify", content); - response.EnsureSuccessStatusCode(); - - json = await response.Content.ReadAsStringAsync(); - result = JsonSerializer.Deserialize(json, options: jsonOpts); - - return result?.Success == true; - case "hcaptcha": - content = new StringContent($"secret={apiSecret}&response={token}", System.Text.Encoding.UTF8, - "application/x-www-form-urlencoded"); - response = await client.PostAsync("https://hcaptcha.com/siteverify", content); - response.EnsureSuccessStatusCode(); - - json = await response.Content.ReadAsStringAsync(); - result = JsonSerializer.Deserialize(json, options: jsonOpts); - - return result?.Success == true; - default: - throw new ArgumentException("The server misconfigured for the captcha."); - } - } - - public string CreateToken(Session session) - { - // Load the private key for signing - var privateKeyPem = File.ReadAllText(config["AuthToken:PrivateKeyPath"]!); - using var rsa = RSA.Create(); - rsa.ImportFromPem(privateKeyPem); - - // Create and return a single token - return CreateCompactToken(session.Id, rsa); - } - - private string CreateCompactToken(Guid sessionId, RSA rsa) - { - // Create the payload: just the session ID - var payloadBytes = sessionId.ToByteArray(); - - // Base64Url encode the payload - var payloadBase64 = Base64UrlEncode(payloadBytes); - - // Sign the payload with RSA-SHA256 - var signature = rsa.SignData(payloadBytes, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - - // Base64Url encode the signature - var signatureBase64 = Base64UrlEncode(signature); - - // Combine payload and signature with a dot - return $"{payloadBase64}.{signatureBase64}"; - } - - public async Task ValidateSudoMode(Session session, string? pinCode) - { - // Check if the session is already in sudo mode (cached) - var sudoModeKey = $"accounts:{session.Id}:sudo"; - var (found, _) = await cache.GetAsyncWithStatus(sudoModeKey); - - if (found) - { - // Session is already in sudo mode - return true; - } - - // Check if the user has a pin code - var hasPinCode = await db.AccountAuthFactors - .Where(f => f.AccountId == session.AccountId) - .Where(f => f.EnabledAt != null) - .Where(f => f.Type == AccountAuthFactorType.PinCode) - .AnyAsync(); - - if (!hasPinCode) - { - // User doesn't have a pin code, no validation needed - return true; - } - - // If pin code is not provided, we can't validate - if (string.IsNullOrEmpty(pinCode)) - { - return false; - } - - try - { - // Validate the pin code - var isValid = await ValidatePinCode(session.AccountId, pinCode); - - if (isValid) - { - // Set session in sudo mode for 5 minutes - await cache.SetAsync(sudoModeKey, true, TimeSpan.FromMinutes(5)); - } - - return isValid; - } - catch (InvalidOperationException) - { - // No pin code enabled for this account, so validation is successful - return true; - } - } - - public async Task ValidatePinCode(Guid accountId, string pinCode) - { - var factor = await db.AccountAuthFactors - .Where(f => f.AccountId == accountId) - .Where(f => f.EnabledAt != null) - .Where(f => f.Type == AccountAuthFactorType.PinCode) - .FirstOrDefaultAsync(); - if (factor is null) throw new InvalidOperationException("No pin code enabled for this account."); - - return factor.VerifyPassword(pinCode); - } - - public bool ValidateToken(string token, out Guid sessionId) - { - sessionId = Guid.Empty; - - try - { - // Split the token - var parts = token.Split('.'); - if (parts.Length != 2) - return false; - - // Decode the payload - var payloadBytes = Base64UrlDecode(parts[0]); - - // Extract session ID - sessionId = new Guid(payloadBytes); - - // Load public key for verification - var publicKeyPem = File.ReadAllText(config["AuthToken:PublicKeyPath"]!); - using var rsa = RSA.Create(); - rsa.ImportFromPem(publicKeyPem); - - // Verify signature - var signature = Base64UrlDecode(parts[1]); - return rsa.VerifyData(payloadBytes, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - } - catch - { - return false; - } - } - - // Helper methods for Base64Url encoding/decoding - private static string Base64UrlEncode(byte[] data) - { - return Convert.ToBase64String(data) - .TrimEnd('=') - .Replace('+', '-') - .Replace('/', '_'); - } - - private static byte[] Base64UrlDecode(string base64Url) - { - string padded = base64Url - .Replace('-', '+') - .Replace('_', '/'); - - switch (padded.Length % 4) - { - case 2: padded += "=="; break; - case 3: padded += "="; break; - } - - return Convert.FromBase64String(padded); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/CheckpointModel.cs b/DysonNetwork.Sphere/Auth/CheckpointModel.cs deleted file mode 100644 index 3b4ea12..0000000 --- a/DysonNetwork.Sphere/Auth/CheckpointModel.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace DysonNetwork.Sphere.Auth; - -public class CaptchaVerificationResponse -{ - public bool Success { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/CompactTokenService.cs b/DysonNetwork.Sphere/Auth/CompactTokenService.cs deleted file mode 100644 index 53c3e8b..0000000 --- a/DysonNetwork.Sphere/Auth/CompactTokenService.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Security.Cryptography; - -namespace DysonNetwork.Sphere.Auth; - -public class CompactTokenService(IConfiguration config) -{ - private readonly string _privateKeyPath = config["AuthToken:PrivateKeyPath"] - ?? throw new InvalidOperationException("AuthToken:PrivateKeyPath configuration is missing"); - - public string CreateToken(Session session) - { - // Load the private key for signing - var privateKeyPem = File.ReadAllText(_privateKeyPath); - using var rsa = RSA.Create(); - rsa.ImportFromPem(privateKeyPem); - - // Create and return a single token - return CreateCompactToken(session.Id, rsa); - } - - private string CreateCompactToken(Guid sessionId, RSA rsa) - { - // Create the payload: just the session ID - var payloadBytes = sessionId.ToByteArray(); - - // Base64Url encode the payload - var payloadBase64 = Base64UrlEncode(payloadBytes); - - // Sign the payload with RSA-SHA256 - var signature = rsa.SignData(payloadBytes, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - - // Base64Url encode the signature - var signatureBase64 = Base64UrlEncode(signature); - - // Combine payload and signature with a dot - return $"{payloadBase64}.{signatureBase64}"; - } - - public bool ValidateToken(string token, out Guid sessionId) - { - sessionId = Guid.Empty; - - try - { - // Split the token - var parts = token.Split('.'); - if (parts.Length != 2) - return false; - - // Decode the payload - var payloadBytes = Base64UrlDecode(parts[0]); - - // Extract session ID - sessionId = new Guid(payloadBytes); - - // Load public key for verification - var publicKeyPem = File.ReadAllText(config["AuthToken:PublicKeyPath"]!); - using var rsa = RSA.Create(); - rsa.ImportFromPem(publicKeyPem); - - // Verify signature - var signature = Base64UrlDecode(parts[1]); - return rsa.VerifyData(payloadBytes, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - } - catch - { - return false; - } - } - - // Helper methods for Base64Url encoding/decoding - private static string Base64UrlEncode(byte[] data) - { - return Convert.ToBase64String(data) - .TrimEnd('=') - .Replace('+', '-') - .Replace('/', '_'); - } - - private static byte[] Base64UrlDecode(string base64Url) - { - string padded = base64Url - .Replace('-', '+') - .Replace('_', '/'); - - switch (padded.Length % 4) - { - case 2: padded += "=="; break; - case 3: padded += "="; break; - } - - return Convert.FromBase64String(padded); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Controllers/OidcProviderController.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Controllers/OidcProviderController.cs deleted file mode 100644 index 847925c..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Controllers/OidcProviderController.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System.Security.Cryptography; -using System.Text; -using DysonNetwork.Sphere.Auth.OidcProvider.Options; -using DysonNetwork.Sphere.Auth.OidcProvider.Responses; -using DysonNetwork.Sphere.Auth.OidcProvider.Services; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Account; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Controllers; - -[Route("/api/auth/open")] -[ApiController] -public class OidcProviderController( - AppDatabase db, - OidcProviderService oidcService, - IConfiguration configuration, - IOptions options, - ILogger logger -) - : ControllerBase -{ - [HttpPost("token")] - [Consumes("application/x-www-form-urlencoded")] - public async Task Token([FromForm] TokenRequest request) - { - switch (request.GrantType) - { - // Validate client credentials - case "authorization_code" when request.ClientId == null || string.IsNullOrEmpty(request.ClientSecret): - return BadRequest("Client credentials are required"); - case "authorization_code" when request.Code == null: - return BadRequest("Authorization code is required"); - case "authorization_code": - { - var client = await oidcService.FindClientByIdAsync(request.ClientId.Value); - if (client == null || - !await oidcService.ValidateClientCredentialsAsync(request.ClientId.Value, request.ClientSecret)) - return BadRequest(new ErrorResponse - { Error = "invalid_client", ErrorDescription = "Invalid client credentials" }); - - // Generate tokens - var tokenResponse = await oidcService.GenerateTokenResponseAsync( - clientId: request.ClientId.Value, - authorizationCode: request.Code!, - redirectUri: request.RedirectUri, - codeVerifier: request.CodeVerifier - ); - - return Ok(tokenResponse); - } - case "refresh_token" when string.IsNullOrEmpty(request.RefreshToken): - return BadRequest(new ErrorResponse - { Error = "invalid_request", ErrorDescription = "Refresh token is required" }); - case "refresh_token": - { - try - { - // Decode the base64 refresh token to get the session ID - var sessionIdBytes = Convert.FromBase64String(request.RefreshToken); - var sessionId = new Guid(sessionIdBytes); - - // Find the session and related data - var session = await oidcService.FindSessionByIdAsync(sessionId); - var now = SystemClock.Instance.GetCurrentInstant(); - if (session?.App is null || session.ExpiredAt < now) - { - return BadRequest(new ErrorResponse - { - Error = "invalid_grant", - ErrorDescription = "Invalid or expired refresh token" - }); - } - - // Get the client - var client = session.App; - if (client == null) - { - return BadRequest(new ErrorResponse - { - Error = "invalid_client", - ErrorDescription = "Client not found" - }); - } - - // Generate new tokens - var tokenResponse = await oidcService.GenerateTokenResponseAsync( - clientId: session.AppId!.Value, - sessionId: session.Id - ); - - return Ok(tokenResponse); - } - catch (FormatException) - { - return BadRequest(new ErrorResponse - { - Error = "invalid_grant", - ErrorDescription = "Invalid refresh token format" - }); - } - } - default: - return BadRequest(new ErrorResponse { Error = "unsupported_grant_type" }); - } - } - - [HttpGet("userinfo")] - [Authorize] - public async Task GetUserInfo() - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - // Get requested scopes from the token - var scopes = currentSession.Challenge.Scopes; - - var userInfo = new Dictionary - { - ["sub"] = currentUser.Id - }; - - // Include standard claims based on scopes - if (scopes.Contains("profile") || scopes.Contains("name")) - { - userInfo["name"] = currentUser.Name; - userInfo["preferred_username"] = currentUser.Nick; - } - - var userEmail = await db.AccountContacts - .Where(c => c.Type == AccountContactType.Email && c.AccountId == currentUser.Id) - .FirstOrDefaultAsync(); - if (scopes.Contains("email") && userEmail is not null) - { - userInfo["email"] = userEmail.Content; - userInfo["email_verified"] = userEmail.VerifiedAt is not null; - } - - return Ok(userInfo); - } - - [HttpGet("/.well-known/openid-configuration")] - public IActionResult GetConfiguration() - { - var baseUrl = configuration["BaseUrl"]; - var issuer = options.Value.IssuerUri.TrimEnd('/'); - - return Ok(new - { - issuer = issuer, - authorization_endpoint = $"{baseUrl}/auth/authorize", - token_endpoint = $"{baseUrl}/auth/open/token", - userinfo_endpoint = $"{baseUrl}/auth/open/userinfo", - jwks_uri = $"{baseUrl}/.well-known/jwks", - scopes_supported = new[] { "openid", "profile", "email" }, - response_types_supported = new[] - { "code", "token", "id_token", "code token", "code id_token", "token id_token", "code token id_token" }, - grant_types_supported = new[] { "authorization_code", "refresh_token" }, - token_endpoint_auth_methods_supported = new[] { "client_secret_basic", "client_secret_post" }, - id_token_signing_alg_values_supported = new[] { "HS256" }, - subject_types_supported = new[] { "public" }, - claims_supported = new[] { "sub", "name", "email", "email_verified" }, - code_challenge_methods_supported = new[] { "S256" }, - response_modes_supported = new[] { "query", "fragment", "form_post" }, - request_parameter_supported = true, - request_uri_parameter_supported = true, - require_request_uri_registration = false - }); - } - - [HttpGet("/.well-known/jwks")] - public IActionResult GetJwks() - { - using var rsa = options.Value.GetRsaPublicKey(); - if (rsa == null) - { - return BadRequest("Public key is not configured"); - } - - var parameters = rsa.ExportParameters(false); - var keyId = Convert.ToBase64String(SHA256.HashData(parameters.Modulus!)[..8]) - .Replace("+", "-") - .Replace("/", "_") - .Replace("=", ""); - - return Ok(new - { - keys = new[] - { - new - { - kty = "RSA", - use = "sig", - kid = keyId, - n = Base64UrlEncoder.Encode(parameters.Modulus!), - e = Base64UrlEncoder.Encode(parameters.Exponent!), - alg = "RS256" - } - } - }); - } -} - -public class TokenRequest -{ - [JsonPropertyName("grant_type")] - [FromForm(Name = "grant_type")] - public string? GrantType { get; set; } - - [JsonPropertyName("code")] - [FromForm(Name = "code")] - public string? Code { get; set; } - - [JsonPropertyName("redirect_uri")] - [FromForm(Name = "redirect_uri")] - public string? RedirectUri { get; set; } - - [JsonPropertyName("client_id")] - [FromForm(Name = "client_id")] - public Guid? ClientId { get; set; } - - [JsonPropertyName("client_secret")] - [FromForm(Name = "client_secret")] - public string? ClientSecret { get; set; } - - [JsonPropertyName("refresh_token")] - [FromForm(Name = "refresh_token")] - public string? RefreshToken { get; set; } - - [JsonPropertyName("scope")] - [FromForm(Name = "scope")] - public string? Scope { get; set; } - - [JsonPropertyName("code_verifier")] - [FromForm(Name = "code_verifier")] - public string? CodeVerifier { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Models/AuthorizationCodeInfo.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Models/AuthorizationCodeInfo.cs deleted file mode 100644 index d043cab..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Models/AuthorizationCodeInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Models; - -public class AuthorizationCodeInfo -{ - public Guid ClientId { get; set; } - public Guid AccountId { get; set; } - public string RedirectUri { get; set; } = string.Empty; - public List Scopes { get; set; } = new(); - public string? CodeChallenge { get; set; } - public string? CodeChallengeMethod { get; set; } - public string? Nonce { get; set; } - public Instant CreatedAt { get; set; } -} diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Options/OidcProviderOptions.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Options/OidcProviderOptions.cs deleted file mode 100644 index 6d57cb3..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Options/OidcProviderOptions.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Security.Cryptography; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Options; - -public class OidcProviderOptions -{ - public string IssuerUri { get; set; } = "https://your-issuer-uri.com"; - public string? PublicKeyPath { get; set; } - public string? PrivateKeyPath { get; set; } - public TimeSpan AccessTokenLifetime { get; set; } = TimeSpan.FromHours(1); - public TimeSpan RefreshTokenLifetime { get; set; } = TimeSpan.FromDays(30); - public TimeSpan AuthorizationCodeLifetime { get; set; } = TimeSpan.FromMinutes(5); - public bool RequireHttpsMetadata { get; set; } = true; - - public RSA? GetRsaPrivateKey() - { - if (string.IsNullOrEmpty(PrivateKeyPath) || !File.Exists(PrivateKeyPath)) - return null; - - var privateKey = File.ReadAllText(PrivateKeyPath); - var rsa = RSA.Create(); - rsa.ImportFromPem(privateKey.AsSpan()); - return rsa; - } - - public RSA? GetRsaPublicKey() - { - if (string.IsNullOrEmpty(PublicKeyPath) || !File.Exists(PublicKeyPath)) - return null; - - var publicKey = File.ReadAllText(PublicKeyPath); - var rsa = RSA.Create(); - rsa.ImportFromPem(publicKey.AsSpan()); - return rsa; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/AuthorizationResponse.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Responses/AuthorizationResponse.cs deleted file mode 100644 index 45cf25c..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/AuthorizationResponse.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Responses; - -public class AuthorizationResponse -{ - [JsonPropertyName("code")] - public string Code { get; set; } = null!; - - [JsonPropertyName("state")] - public string? State { get; set; } - - [JsonPropertyName("scope")] - public string? Scope { get; set; } - - - [JsonPropertyName("session_state")] - public string? SessionState { get; set; } - - - [JsonPropertyName("iss")] - public string? Issuer { get; set; } -} diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/ErrorResponse.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Responses/ErrorResponse.cs deleted file mode 100644 index 0018a47..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/ErrorResponse.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Responses; - -public class ErrorResponse -{ - [JsonPropertyName("error")] - public string Error { get; set; } = null!; - - [JsonPropertyName("error_description")] - public string? ErrorDescription { get; set; } - - - [JsonPropertyName("error_uri")] - public string? ErrorUri { get; set; } - - - [JsonPropertyName("state")] - public string? State { get; set; } -} diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/TokenResponse.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Responses/TokenResponse.cs deleted file mode 100644 index 6d41cf4..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Responses/TokenResponse.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Responses; - -public class TokenResponse -{ - [JsonPropertyName("access_token")] - public string AccessToken { get; set; } = null!; - - [JsonPropertyName("expires_in")] - public int ExpiresIn { get; set; } - - [JsonPropertyName("token_type")] - public string TokenType { get; set; } = "Bearer"; - - [JsonPropertyName("refresh_token")] - public string? RefreshToken { get; set; } - - - [JsonPropertyName("scope")] - public string? Scope { get; set; } - - - [JsonPropertyName("id_token")] - public string? IdToken { get; set; } -} diff --git a/DysonNetwork.Sphere/Auth/OidcProvider/Services/OidcProviderService.cs b/DysonNetwork.Sphere/Auth/OidcProvider/Services/OidcProviderService.cs deleted file mode 100644 index 4345dab..0000000 --- a/DysonNetwork.Sphere/Auth/OidcProvider/Services/OidcProviderService.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Security.Cryptography; -using System.Text; -using DysonNetwork.Sphere.Auth.OidcProvider.Models; -using DysonNetwork.Sphere.Auth.OidcProvider.Options; -using DysonNetwork.Sphere.Auth.OidcProvider.Responses; -using DysonNetwork.Sphere.Developer; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Options; -using Microsoft.IdentityModel.Tokens; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OidcProvider.Services; - -public class OidcProviderService( - AppDatabase db, - AuthService auth, - ICacheService cache, - IOptions options, - ILogger logger -) -{ - private readonly OidcProviderOptions _options = options.Value; - - public async Task FindClientByIdAsync(Guid clientId) - { - return await db.CustomApps - .Include(c => c.Secrets) - .FirstOrDefaultAsync(c => c.Id == clientId); - } - - public async Task FindClientByAppIdAsync(Guid appId) - { - return await db.CustomApps - .Include(c => c.Secrets) - .FirstOrDefaultAsync(c => c.Id == appId); - } - - public async Task FindValidSessionAsync(Guid accountId, Guid clientId) - { - var now = SystemClock.Instance.GetCurrentInstant(); - - return await db.AuthSessions - .Include(s => s.Challenge) - .Where(s => s.AccountId == accountId && - s.AppId == clientId && - (s.ExpiredAt == null || s.ExpiredAt > now) && - s.Challenge.Type == ChallengeType.OAuth) - .OrderByDescending(s => s.CreatedAt) - .FirstOrDefaultAsync(); - } - - public async Task ValidateClientCredentialsAsync(Guid clientId, string clientSecret) - { - var client = await FindClientByIdAsync(clientId); - if (client == null) return false; - - var clock = SystemClock.Instance; - var secret = client.Secrets - .Where(s => s.IsOidc && (s.ExpiredAt == null || s.ExpiredAt > clock.GetCurrentInstant())) - .FirstOrDefault(s => s.Secret == clientSecret); // In production, use proper hashing - - return secret != null; - } - - public async Task GenerateTokenResponseAsync( - Guid clientId, - string? authorizationCode = null, - string? redirectUri = null, - string? codeVerifier = null, - Guid? sessionId = null - ) - { - var client = await FindClientByIdAsync(clientId); - if (client == null) - throw new InvalidOperationException("Client not found"); - - Session session; - var clock = SystemClock.Instance; - var now = clock.GetCurrentInstant(); - - List? scopes = null; - if (authorizationCode != null) - { - // Authorization code flow - var authCode = await ValidateAuthorizationCodeAsync(authorizationCode, clientId, redirectUri, codeVerifier); - if (authCode is null) throw new InvalidOperationException("Invalid authorization code"); - var account = await db.Accounts.Where(a => a.Id == authCode.AccountId).FirstOrDefaultAsync(); - if (account is null) throw new InvalidOperationException("Account was not found"); - - session = await auth.CreateSessionForOidcAsync(account, now, client.Id); - scopes = authCode.Scopes; - } - else if (sessionId.HasValue) - { - // Refresh token flow - session = await FindSessionByIdAsync(sessionId.Value) ?? - throw new InvalidOperationException("Invalid session"); - - // Verify the session is still valid - if (session.ExpiredAt < now) - throw new InvalidOperationException("Session has expired"); - } - else - { - throw new InvalidOperationException("Either authorization code or session ID must be provided"); - } - - var expiresIn = (int)_options.AccessTokenLifetime.TotalSeconds; - var expiresAt = now.Plus(Duration.FromSeconds(expiresIn)); - - // Generate an access token - var accessToken = GenerateJwtToken(client, session, expiresAt, scopes); - var refreshToken = GenerateRefreshToken(session); - - return new TokenResponse - { - AccessToken = accessToken, - ExpiresIn = expiresIn, - TokenType = "Bearer", - RefreshToken = refreshToken, - Scope = scopes != null ? string.Join(" ", scopes) : null - }; - } - - private string GenerateJwtToken( - CustomApp client, - Session session, - Instant expiresAt, - IEnumerable? scopes = null - ) - { - var tokenHandler = new JwtSecurityTokenHandler(); - var clock = SystemClock.Instance; - var now = clock.GetCurrentInstant(); - - var tokenDescriptor = new SecurityTokenDescriptor - { - Subject = new ClaimsIdentity([ - new Claim(JwtRegisteredClaimNames.Sub, session.AccountId.ToString()), - new Claim(JwtRegisteredClaimNames.Jti, session.Id.ToString()), - new Claim(JwtRegisteredClaimNames.Iat, now.ToUnixTimeSeconds().ToString(), - ClaimValueTypes.Integer64), - new Claim("client_id", client.Id.ToString()) - ]), - Expires = expiresAt.ToDateTimeUtc(), - Issuer = _options.IssuerUri, - Audience = client.Id.ToString() - }; - - // Try to use RSA signing if keys are available, fall back to HMAC - var rsaPrivateKey = _options.GetRsaPrivateKey(); - tokenDescriptor.SigningCredentials = new SigningCredentials( - new RsaSecurityKey(rsaPrivateKey), - SecurityAlgorithms.RsaSha256 - ); - - // Add scopes as claims if provided - var effectiveScopes = scopes?.ToList() ?? client.OauthConfig!.AllowedScopes?.ToList() ?? []; - if (effectiveScopes.Count != 0) - { - tokenDescriptor.Subject.AddClaims( - effectiveScopes.Select(scope => new Claim("scope", scope))); - } - - var token = tokenHandler.CreateToken(tokenDescriptor); - return tokenHandler.WriteToken(token); - } - - public (bool isValid, JwtSecurityToken? token) ValidateToken(string token) - { - try - { - var tokenHandler = new JwtSecurityTokenHandler(); - var validationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidIssuer = _options.IssuerUri, - ValidateAudience = false, - ValidateLifetime = true, - ClockSkew = TimeSpan.Zero - }; - - // Try to use RSA validation if public key is available - var rsaPublicKey = _options.GetRsaPublicKey(); - validationParameters.IssuerSigningKey = new RsaSecurityKey(rsaPublicKey); - validationParameters.ValidateIssuerSigningKey = true; - validationParameters.ValidAlgorithms = new[] { SecurityAlgorithms.RsaSha256 }; - - - tokenHandler.ValidateToken(token, validationParameters, out var validatedToken); - return (true, (JwtSecurityToken)validatedToken); - } - catch (Exception ex) - { - logger.LogError(ex, "Token validation failed"); - return (false, null); - } - } - - public async Task FindSessionByIdAsync(Guid sessionId) - { - return await db.AuthSessions - .Include(s => s.Account) - .Include(s => s.Challenge) - .Include(s => s.App) - .FirstOrDefaultAsync(s => s.Id == sessionId); - } - - private static string GenerateRefreshToken(Session session) - { - return Convert.ToBase64String(session.Id.ToByteArray()); - } - - private static bool VerifyHashedSecret(string secret, string hashedSecret) - { - // In a real implementation, you'd use a proper password hashing algorithm like PBKDF2, bcrypt, or Argon2 - // For now, we'll do a simple comparison, but you should replace this with proper hashing - return string.Equals(secret, hashedSecret, StringComparison.Ordinal); - } - - public async Task GenerateAuthorizationCodeForReuseSessionAsync( - Session session, - Guid clientId, - string redirectUri, - IEnumerable scopes, - string? codeChallenge = null, - string? codeChallengeMethod = null, - string? nonce = null) - { - var clock = SystemClock.Instance; - var now = clock.GetCurrentInstant(); - var code = Guid.NewGuid().ToString("N"); - - // Update the session's last activity time - await db.AuthSessions.Where(s => s.Id == session.Id) - .ExecuteUpdateAsync(s => s.SetProperty(s => s.LastGrantedAt, now)); - - // Create the authorization code info - var authCodeInfo = new AuthorizationCodeInfo - { - ClientId = clientId, - AccountId = session.AccountId, - RedirectUri = redirectUri, - Scopes = scopes.ToList(), - CodeChallenge = codeChallenge, - CodeChallengeMethod = codeChallengeMethod, - Nonce = nonce, - CreatedAt = now - }; - - // Store the code with its metadata in the cache - var cacheKey = $"auth:code:{code}"; - await cache.SetAsync(cacheKey, authCodeInfo, _options.AuthorizationCodeLifetime); - - logger.LogInformation("Generated authorization code for client {ClientId} and user {UserId}", clientId, session.AccountId); - return code; - } - - public async Task GenerateAuthorizationCodeAsync( - Guid clientId, - Guid userId, - string redirectUri, - IEnumerable scopes, - string? codeChallenge = null, - string? codeChallengeMethod = null, - string? nonce = null - ) - { - // Generate a random code - var clock = SystemClock.Instance; - var code = GenerateRandomString(32); - var now = clock.GetCurrentInstant(); - - // Create the authorization code info - var authCodeInfo = new AuthorizationCodeInfo - { - ClientId = clientId, - AccountId = userId, - RedirectUri = redirectUri, - Scopes = scopes.ToList(), - CodeChallenge = codeChallenge, - CodeChallengeMethod = codeChallengeMethod, - Nonce = nonce, - CreatedAt = now - }; - - // Store the code with its metadata in the cache - var cacheKey = $"auth:code:{code}"; - await cache.SetAsync(cacheKey, authCodeInfo, _options.AuthorizationCodeLifetime); - - logger.LogInformation("Generated authorization code for client {ClientId} and user {UserId}", clientId, userId); - return code; - } - - private async Task ValidateAuthorizationCodeAsync( - string code, - Guid clientId, - string? redirectUri = null, - string? codeVerifier = null - ) - { - var cacheKey = $"auth:code:{code}"; - var (found, authCode) = await cache.GetAsyncWithStatus(cacheKey); - - if (!found || authCode == null) - { - logger.LogWarning("Authorization code not found: {Code}", code); - return null; - } - - // Verify client ID matches - if (authCode.ClientId != clientId) - { - logger.LogWarning( - "Client ID mismatch for code {Code}. Expected: {ExpectedClientId}, Actual: {ActualClientId}", - code, authCode.ClientId, clientId); - return null; - } - - // Verify redirect URI if provided - if (!string.IsNullOrEmpty(redirectUri) && authCode.RedirectUri != redirectUri) - { - logger.LogWarning("Redirect URI mismatch for code {Code}", code); - return null; - } - - // Verify PKCE code challenge if one was provided during authorization - if (!string.IsNullOrEmpty(authCode.CodeChallenge)) - { - if (string.IsNullOrEmpty(codeVerifier)) - { - logger.LogWarning("PKCE code verifier is required but not provided for code {Code}", code); - return null; - } - - var isValid = authCode.CodeChallengeMethod?.ToUpperInvariant() switch - { - "S256" => VerifyCodeChallenge(codeVerifier, authCode.CodeChallenge, "S256"), - "PLAIN" => VerifyCodeChallenge(codeVerifier, authCode.CodeChallenge, "PLAIN"), - _ => false // Unsupported code challenge method - }; - - if (!isValid) - { - logger.LogWarning("PKCE code verifier validation failed for code {Code}", code); - return null; - } - } - - // Code is valid, remove it from the cache (codes are single-use) - await cache.RemoveAsync(cacheKey); - - return authCode; - } - - private static string GenerateRandomString(int length) - { - const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"; - var random = RandomNumberGenerator.Create(); - var result = new char[length]; - - for (int i = 0; i < length; i++) - { - var randomNumber = new byte[4]; - random.GetBytes(randomNumber); - var index = (int)(BitConverter.ToUInt32(randomNumber, 0) % chars.Length); - result[i] = chars[index]; - } - - return new string(result); - } - - private static bool VerifyCodeChallenge(string codeVerifier, string codeChallenge, string method) - { - if (string.IsNullOrEmpty(codeVerifier)) return false; - - if (method == "S256") - { - using var sha256 = SHA256.Create(); - var hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(codeVerifier)); - var base64 = Base64UrlEncoder.Encode(hash); - return string.Equals(base64, codeChallenge, StringComparison.Ordinal); - } - - if (method == "PLAIN") - { - return string.Equals(codeVerifier, codeChallenge, StringComparison.Ordinal); - } - - return false; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/AfdianOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/AfdianOidcService.cs deleted file mode 100644 index c0e0600..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/AfdianOidcService.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Net.Http.Json; -using System.Text.Json; -using DysonNetwork.Sphere.Storage; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class AfdianOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache, - ILogger logger -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - public override string ProviderName => "Afdian"; - protected override string DiscoveryEndpoint => ""; // Afdian doesn't have a standard OIDC discovery endpoint - protected override string ConfigSectionName => "Afdian"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "redirect_uri", config.RedirectUri }, - { "response_type", "code" }, - { "scope", "basic" }, - { "state", state }, - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"https://afdian.com/oauth2/authorize?{queryString}"; - } - - protected override Task GetDiscoveryDocumentAsync() - { - return Task.FromResult(new OidcDiscoveryDocument - { - AuthorizationEndpoint = "https://afdian.com/oauth2/authorize", - TokenEndpoint = "https://afdian.com/oauth2/access_token", - UserinfoEndpoint = null, - JwksUri = null - })!; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - try - { - var config = GetProviderConfig(); - var content = new FormUrlEncodedContent(new Dictionary - { - { "client_id", config.ClientId }, - { "client_secret", config.ClientSecret }, - { "grant_type", "authorization_code" }, - { "code", callbackData.Code }, - { "redirect_uri", config.RedirectUri }, - }); - - var client = HttpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Post, "https://afdian.com/oauth2/access_token"); - request.Content = content; - - var response = await client.SendAsync(request); - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - logger.LogInformation("Trying get userinfo from afdian, response: {Response}", json); - var afdianResponse = JsonDocument.Parse(json).RootElement; - - var user = afdianResponse.TryGetProperty("data", out var dataElement) ? dataElement : default; - var userId = user.TryGetProperty("user_id", out var userIdElement) ? userIdElement.GetString() ?? "" : ""; - var avatar = user.TryGetProperty("avatar", out var avatarElement) ? avatarElement.GetString() : null; - - return new OidcUserInfo - { - UserId = userId, - DisplayName = (user.TryGetProperty("name", out var nameElement) - ? nameElement.GetString() - : null) ?? "", - ProfilePictureUrl = avatar, - Provider = ProviderName - }; - } - catch (Exception ex) - { - // Due to afidan's API isn't compliant with OAuth2, we want more logs from it to investigate. - logger.LogError(ex, "Failed to get user info from Afdian"); - throw; - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/AppleMobileSignInRequest.cs b/DysonNetwork.Sphere/Auth/OpenId/AppleMobileSignInRequest.cs deleted file mode 100644 index f5249cd..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/AppleMobileSignInRequest.cs +++ /dev/null @@ -1,19 +0,0 @@ - -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class AppleMobileConnectRequest -{ - [Required] - public required string IdentityToken { get; set; } - [Required] - public required string AuthorizationCode { get; set; } -} - -public class AppleMobileSignInRequest : AppleMobileConnectRequest -{ - [Required] - public required string DeviceId { get; set; } -} diff --git a/DysonNetwork.Sphere/Auth/OpenId/AppleOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/AppleOidcService.cs deleted file mode 100644 index 75420b8..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/AppleOidcService.cs +++ /dev/null @@ -1,279 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Security.Cryptography; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Storage; -using Microsoft.IdentityModel.Tokens; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -/// -/// Implementation of OpenID Connect service for Apple Sign In -/// -public class AppleOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - private readonly IConfiguration _configuration = configuration; - private readonly IHttpClientFactory _httpClientFactory = httpClientFactory; - - public override string ProviderName => "apple"; - protected override string DiscoveryEndpoint => "https://appleid.apple.com/.well-known/openid-configuration"; - protected override string ConfigSectionName => "Apple"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "redirect_uri", config.RedirectUri }, - { "response_type", "code id_token" }, - { "scope", "name email" }, - { "response_mode", "form_post" }, - { "state", state }, - { "nonce", nonce } - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"https://appleid.apple.com/auth/authorize?{queryString}"; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - // Verify and decode the id_token - var userInfo = await ValidateTokenAsync(callbackData.IdToken); - - // If user data is provided in first login, parse it - if (!string.IsNullOrEmpty(callbackData.RawData)) - { - var userData = JsonSerializer.Deserialize(callbackData.RawData); - if (userData?.Name != null) - { - userInfo.FirstName = userData.Name.FirstName ?? ""; - userInfo.LastName = userData.Name.LastName ?? ""; - userInfo.DisplayName = $"{userInfo.FirstName} {userInfo.LastName}".Trim(); - } - } - - // Exchange authorization code for access token (optional, if you need the access token) - if (string.IsNullOrEmpty(callbackData.Code)) return userInfo; - var tokenResponse = await ExchangeCodeForTokensAsync(callbackData.Code); - if (tokenResponse == null) return userInfo; - userInfo.AccessToken = tokenResponse.AccessToken; - userInfo.RefreshToken = tokenResponse.RefreshToken; - - return userInfo; - } - - private async Task ValidateTokenAsync(string idToken) - { - // Get Apple's public keys - var jwksJson = await GetAppleJwksAsync(); - var jwks = JsonSerializer.Deserialize(jwksJson) ?? new AppleJwks { Keys = new List() }; - - // Parse the JWT header to get the key ID - var handler = new JwtSecurityTokenHandler(); - var jwtToken = handler.ReadJwtToken(idToken); - var kid = jwtToken.Header.Kid; - - // Find the matching key - var key = jwks.Keys.FirstOrDefault(k => k.Kid == kid); - if (key == null) - { - throw new SecurityTokenValidationException("Unable to find matching key in Apple's JWKS"); - } - - // Create the validation parameters - var validationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidIssuer = "https://appleid.apple.com", - ValidateAudience = true, - ValidAudience = GetProviderConfig().ClientId, - ValidateLifetime = true, - IssuerSigningKey = key.ToSecurityKey() - }; - - return ValidateAndExtractIdToken(idToken, validationParameters); - } - - protected override Dictionary BuildTokenRequestParameters( - string code, - ProviderConfiguration config, - string? codeVerifier - ) - { - var parameters = new Dictionary - { - { "client_id", config.ClientId }, - { "client_secret", GenerateClientSecret() }, - { "code", code }, - { "grant_type", "authorization_code" }, - { "redirect_uri", config.RedirectUri } - }; - - return parameters; - } - - private async Task GetAppleJwksAsync() - { - var client = _httpClientFactory.CreateClient(); - var response = await client.GetAsync("https://appleid.apple.com/auth/keys"); - response.EnsureSuccessStatusCode(); - - return await response.Content.ReadAsStringAsync(); - } - - /// - /// Generates a client secret for Apple Sign In using JWT - /// - private string GenerateClientSecret() - { - var now = DateTime.UtcNow; - var teamId = _configuration["Oidc:Apple:TeamId"]; - var clientId = _configuration["Oidc:Apple:ClientId"]; - var keyId = _configuration["Oidc:Apple:KeyId"]; - var privateKeyPath = _configuration["Oidc:Apple:PrivateKeyPath"]; - - if (string.IsNullOrEmpty(teamId) || string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(keyId) || - string.IsNullOrEmpty(privateKeyPath)) - { - throw new InvalidOperationException("Apple OIDC configuration is missing required values (TeamId, ClientId, KeyId, PrivateKeyPath)."); - } - - // Read the private key - var privateKey = File.ReadAllText(privateKeyPath); - - // Create the JWT header - var header = new Dictionary - { - { "alg", "ES256" }, - { "kid", keyId } - }; - - // Create the JWT payload - var payload = new Dictionary - { - { "iss", teamId }, - { "iat", ToUnixTimeSeconds(now) }, - { "exp", ToUnixTimeSeconds(now.AddMinutes(5)) }, - { "aud", "https://appleid.apple.com" }, - { "sub", clientId } - }; - - // Convert header and payload to Base64Url - var headerJson = JsonSerializer.Serialize(header); - var payloadJson = JsonSerializer.Serialize(payload); - var headerBase64 = Base64UrlEncode(Encoding.UTF8.GetBytes(headerJson)); - var payloadBase64 = Base64UrlEncode(Encoding.UTF8.GetBytes(payloadJson)); - - // Create the signature - var dataToSign = $"{headerBase64}.{payloadBase64}"; - var signature = SignWithECDsa(dataToSign, privateKey); - - // Combine all parts - return $"{headerBase64}.{payloadBase64}.{signature}"; - } - - private long ToUnixTimeSeconds(DateTime dateTime) - { - return new DateTimeOffset(dateTime).ToUnixTimeSeconds(); - } - - private string SignWithECDsa(string dataToSign, string privateKey) - { - using var ecdsa = ECDsa.Create(); - ecdsa.ImportFromPem(privateKey); - - var bytes = Encoding.UTF8.GetBytes(dataToSign); - var signature = ecdsa.SignData(bytes, HashAlgorithmName.SHA256); - - return Base64UrlEncode(signature); - } - - private string Base64UrlEncode(byte[] data) - { - return Convert.ToBase64String(data) - .Replace('+', '-') - .Replace('/', '_') - .TrimEnd('='); - } -} - -public class AppleUserData -{ - [JsonPropertyName("name")] public AppleNameData? Name { get; set; } - - [JsonPropertyName("email")] public string? Email { get; set; } -} - -public class AppleNameData -{ - [JsonPropertyName("firstName")] public string? FirstName { get; set; } - - [JsonPropertyName("lastName")] public string? LastName { get; set; } -} - -public class AppleJwks -{ - [JsonPropertyName("keys")] public List Keys { get; set; } = new List(); -} - -public class AppleKey -{ - [JsonPropertyName("kty")] public string? Kty { get; set; } - - [JsonPropertyName("kid")] public string? Kid { get; set; } - - [JsonPropertyName("use")] public string? Use { get; set; } - - [JsonPropertyName("alg")] public string? Alg { get; set; } - - [JsonPropertyName("n")] public string? N { get; set; } - - [JsonPropertyName("e")] public string? E { get; set; } - - public SecurityKey ToSecurityKey() - { - if (Kty != "RSA" || string.IsNullOrEmpty(N) || string.IsNullOrEmpty(E)) - { - throw new InvalidOperationException("Invalid key data"); - } - - var parameters = new RSAParameters - { - Modulus = Base64UrlDecode(N), - Exponent = Base64UrlDecode(E) - }; - - var rsa = RSA.Create(); - rsa.ImportParameters(parameters); - - return new RsaSecurityKey(rsa); - } - - private byte[] Base64UrlDecode(string input) - { - var output = input - .Replace('-', '+') - .Replace('_', '/'); - - switch (output.Length % 4) - { - case 0: break; - case 2: output += "=="; break; - case 3: output += "="; break; - default: throw new InvalidOperationException("Invalid base64url string"); - } - - return Convert.FromBase64String(output); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/ConnectionController.cs b/DysonNetwork.Sphere/Auth/OpenId/ConnectionController.cs deleted file mode 100644 index 49f11ee..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/ConnectionController.cs +++ /dev/null @@ -1,409 +0,0 @@ -using DysonNetwork.Sphere.Account; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using DysonNetwork.Sphere.Storage; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -[ApiController] -[Route("/api/accounts/me/connections")] -[Authorize] -public class ConnectionController( - AppDatabase db, - IEnumerable oidcServices, - AccountService accounts, - AuthService auth, - ICacheService cache -) : ControllerBase -{ - private const string StateCachePrefix = "oidc-state:"; - private const string ReturnUrlCachePrefix = "oidc-returning:"; - private static readonly TimeSpan StateExpiration = TimeSpan.FromMinutes(15); - - [HttpGet] - public async Task>> GetConnections() - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) - return Unauthorized(); - - var connections = await db.AccountConnections - .Where(c => c.AccountId == currentUser.Id) - .Select(c => new - { - c.Id, - c.AccountId, - c.Provider, - c.ProvidedIdentifier, - c.Meta, - c.LastUsedAt, - c.CreatedAt, - c.UpdatedAt, - }) - .ToListAsync(); - return Ok(connections); - } - - [HttpDelete("{id:guid}")] - public async Task RemoveConnection(Guid id) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) - return Unauthorized(); - - var connection = await db.AccountConnections - .Where(c => c.Id == id && c.AccountId == currentUser.Id) - .FirstOrDefaultAsync(); - if (connection == null) - return NotFound(); - - db.AccountConnections.Remove(connection); - await db.SaveChangesAsync(); - - return Ok(); - } - - [HttpPost("/auth/connect/apple/mobile")] - public async Task ConnectAppleMobile([FromBody] AppleMobileConnectRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) - return Unauthorized(); - - if (GetOidcService("apple") is not AppleOidcService appleService) - return StatusCode(503, "Apple OIDC service not available"); - - var callbackData = new OidcCallbackData - { - IdToken = request.IdentityToken, - Code = request.AuthorizationCode, - }; - - OidcUserInfo userInfo; - try - { - userInfo = await appleService.ProcessCallbackAsync(callbackData); - } - catch (Exception ex) - { - return BadRequest($"Error processing Apple token: {ex.Message}"); - } - - var existingConnection = await db.AccountConnections - .FirstOrDefaultAsync(c => - c.Provider == "apple" && - c.ProvidedIdentifier == userInfo.UserId); - - if (existingConnection != null) - { - return BadRequest( - $"This Apple account is already linked to {(existingConnection.AccountId == currentUser.Id ? "your account" : "another user")}."); - } - - db.AccountConnections.Add(new AccountConnection - { - AccountId = currentUser.Id, - Provider = "apple", - ProvidedIdentifier = userInfo.UserId!, - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = SystemClock.Instance.GetCurrentInstant(), - Meta = userInfo.ToMetadata(), - }); - - await db.SaveChangesAsync(); - - return Ok(new { message = "Successfully connected Apple account." }); - } - - private OidcService? GetOidcService(string provider) - { - return oidcServices.FirstOrDefault(s => s.ProviderName.Equals(provider, StringComparison.OrdinalIgnoreCase)); - } - - public class ConnectProviderRequest - { - public string Provider { get; set; } = null!; - public string? ReturnUrl { get; set; } - } - - /// - /// Initiates manual connection to an OAuth provider for the current user - /// - [HttpPost("connect")] - public async Task> InitiateConnection([FromBody] ConnectProviderRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) - return Unauthorized(); - - var oidcService = GetOidcService(request.Provider); - if (oidcService == null) - return BadRequest($"Provider '{request.Provider}' is not supported"); - - var existingConnection = await db.AccountConnections - .AnyAsync(c => c.AccountId == currentUser.Id && c.Provider == oidcService.ProviderName); - - if (existingConnection) - return BadRequest($"You already have a {request.Provider} connection"); - - var state = Guid.NewGuid().ToString("N"); - var nonce = Guid.NewGuid().ToString("N"); - var stateValue = $"{currentUser.Id}|{request.Provider}|{nonce}"; - var finalReturnUrl = !string.IsNullOrEmpty(request.ReturnUrl) ? request.ReturnUrl : "/settings/connections"; - - // Store state and return URL in cache - await cache.SetAsync($"{StateCachePrefix}{state}", stateValue, StateExpiration); - await cache.SetAsync($"{ReturnUrlCachePrefix}{state}", finalReturnUrl, StateExpiration); - - var authUrl = oidcService.GetAuthorizationUrl(state, nonce); - - return Ok(new - { - authUrl, - message = $"Redirect to this URL to connect your {request.Provider} account" - }); - } - - [AllowAnonymous] - [Route("/api/auth/callback/{provider}")] - [HttpGet, HttpPost] - public async Task HandleCallback([FromRoute] string provider) - { - var oidcService = GetOidcService(provider); - if (oidcService == null) - return BadRequest($"Provider '{provider}' is not supported."); - - var callbackData = await ExtractCallbackData(Request); - if (callbackData.State == null) - return BadRequest("State parameter is missing."); - - // Get the state from the cache - var stateKey = $"{StateCachePrefix}{callbackData.State}"; - - // Try to get the state as OidcState first (new format) - var oidcState = await cache.GetAsync(stateKey); - - // If not found, try to get as string (legacy format) - if (oidcState == null) - { - var stateValue = await cache.GetAsync(stateKey); - if (string.IsNullOrEmpty(stateValue) || !OidcState.TryParse(stateValue, out oidcState) || oidcState == null) - return BadRequest("Invalid or expired state parameter"); - } - - // Remove the state from cache to prevent replay attacks - await cache.RemoveAsync(stateKey); - - // Handle the flow based on state type - if (oidcState.FlowType == OidcFlowType.Connect && oidcState.AccountId.HasValue) - { - // Connection flow - if (oidcState.DeviceId != null) - { - callbackData.State = oidcState.DeviceId; - } - return await HandleManualConnection(provider, oidcService, callbackData, oidcState.AccountId.Value); - } - else if (oidcState.FlowType == OidcFlowType.Login) - { - // Login/Registration flow - if (!string.IsNullOrEmpty(oidcState.DeviceId)) - { - callbackData.State = oidcState.DeviceId; - } - - // Store return URL if provided - if (!string.IsNullOrEmpty(oidcState.ReturnUrl) && oidcState.ReturnUrl != "/") - { - var returnUrlKey = $"{ReturnUrlCachePrefix}{callbackData.State}"; - await cache.SetAsync(returnUrlKey, oidcState.ReturnUrl, StateExpiration); - } - - return await HandleLoginOrRegistration(provider, oidcService, callbackData); - } - - return BadRequest("Unsupported flow type"); - } - - private async Task HandleManualConnection( - string provider, - OidcService oidcService, - OidcCallbackData callbackData, - Guid accountId - ) - { - provider = provider.ToLower(); - - OidcUserInfo userInfo; - try - { - userInfo = await oidcService.ProcessCallbackAsync(callbackData); - } - catch (Exception ex) - { - return BadRequest($"Error processing {provider} authentication: {ex.Message}"); - } - - if (string.IsNullOrEmpty(userInfo.UserId)) - { - return BadRequest($"{provider} did not return a valid user identifier."); - } - - // Extract device ID from the callback state if available - var deviceId = !string.IsNullOrEmpty(callbackData.State) ? callbackData.State : string.Empty; - - // Check if this provider account is already connected to any user - var existingConnection = await db.AccountConnections - .FirstOrDefaultAsync(c => - c.Provider == provider && - c.ProvidedIdentifier == userInfo.UserId); - - // If it's connected to a different user, return error - if (existingConnection != null && existingConnection.AccountId != accountId) - { - return BadRequest($"This {provider} account is already linked to another user."); - } - - // Check if the current user already has this provider connected - var userHasProvider = await db.AccountConnections - .AnyAsync(c => - c.AccountId == accountId && - c.Provider == provider); - - if (userHasProvider) - { - // Update existing connection with new tokens - var connection = await db.AccountConnections - .FirstOrDefaultAsync(c => - c.AccountId == accountId && - c.Provider == provider); - - if (connection != null) - { - connection.AccessToken = userInfo.AccessToken; - connection.RefreshToken = userInfo.RefreshToken; - connection.LastUsedAt = SystemClock.Instance.GetCurrentInstant(); - connection.Meta = userInfo.ToMetadata(); - } - } - else - { - // Create new connection - db.AccountConnections.Add(new AccountConnection - { - AccountId = accountId, - Provider = provider, - ProvidedIdentifier = userInfo.UserId!, - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = SystemClock.Instance.GetCurrentInstant(), - Meta = userInfo.ToMetadata(), - }); - } - - try - { - await db.SaveChangesAsync(); - } - catch (DbUpdateException) - { - return StatusCode(500, $"Failed to save {provider} connection. Please try again."); - } - - // Clean up and redirect - var returnUrlKey = $"{ReturnUrlCachePrefix}{callbackData.State}"; - var returnUrl = await cache.GetAsync(returnUrlKey); - await cache.RemoveAsync(returnUrlKey); - - return Redirect(string.IsNullOrEmpty(returnUrl) ? "/auth/callback" : returnUrl); - } - - private async Task HandleLoginOrRegistration( - string provider, - OidcService oidcService, - OidcCallbackData callbackData - ) - { - OidcUserInfo userInfo; - try - { - userInfo = await oidcService.ProcessCallbackAsync(callbackData); - } - catch (Exception ex) - { - return BadRequest($"Error processing callback: {ex.Message}"); - } - - if (string.IsNullOrEmpty(userInfo.Email) || string.IsNullOrEmpty(userInfo.UserId)) - { - return BadRequest($"Email or user ID is missing from {provider}'s response"); - } - - var connection = await db.AccountConnections - .Include(c => c.Account) - .FirstOrDefaultAsync(c => c.Provider == provider && c.ProvidedIdentifier == userInfo.UserId); - - var clock = SystemClock.Instance; - if (connection != null) - { - // Login existing user - var deviceId = !string.IsNullOrEmpty(callbackData.State) ? - callbackData.State.Split('|').FirstOrDefault() : - string.Empty; - - var challenge = await oidcService.CreateChallengeForUserAsync( - userInfo, - connection.Account, - HttpContext, - deviceId ?? string.Empty); - return Redirect($"/auth/callback?challenge={challenge.Id}"); - } - - // Register new user - var account = await accounts.LookupAccount(userInfo.Email) ?? await accounts.CreateAccount(userInfo); - - // Create connection for new or existing user - var newConnection = new AccountConnection - { - Account = account, - Provider = provider, - ProvidedIdentifier = userInfo.UserId!, - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = clock.GetCurrentInstant(), - Meta = userInfo.ToMetadata() - }; - db.AccountConnections.Add(newConnection); - - await db.SaveChangesAsync(); - - var loginSession = await auth.CreateSessionForOidcAsync(account, clock.GetCurrentInstant()); - var loginToken = auth.CreateToken(loginSession); - return Redirect($"/auth/token?token={loginToken}"); - } - - private static async Task ExtractCallbackData(HttpRequest request) - { - var data = new OidcCallbackData(); - switch (request.Method) - { - case "GET": - data.Code = Uri.UnescapeDataString(request.Query["code"].FirstOrDefault() ?? ""); - data.IdToken = Uri.UnescapeDataString(request.Query["id_token"].FirstOrDefault() ?? ""); - data.State = Uri.UnescapeDataString(request.Query["state"].FirstOrDefault() ?? ""); - break; - case "POST" when request.HasFormContentType: - { - var form = await request.ReadFormAsync(); - data.Code = Uri.UnescapeDataString(form["code"].FirstOrDefault() ?? ""); - data.IdToken = Uri.UnescapeDataString(form["id_token"].FirstOrDefault() ?? ""); - data.State = Uri.UnescapeDataString(form["state"].FirstOrDefault() ?? ""); - if (form.ContainsKey("user")) - data.RawData = Uri.UnescapeDataString(form["user"].FirstOrDefault() ?? ""); - - break; - } - } - - return data; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/DiscordOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/DiscordOidcService.cs deleted file mode 100644 index c710b71..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/DiscordOidcService.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System.Net.Http.Json; -using System.Text.Json; -using DysonNetwork.Sphere.Storage; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class DiscordOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - public override string ProviderName => "Discord"; - protected override string DiscoveryEndpoint => ""; // Discord doesn't have a standard OIDC discovery endpoint - protected override string ConfigSectionName => "Discord"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "redirect_uri", config.RedirectUri }, - { "response_type", "code" }, - { "scope", "identify email" }, - { "state", state }, - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"https://discord.com/oauth2/authorize?{queryString}"; - } - - protected override Task GetDiscoveryDocumentAsync() - { - return Task.FromResult(new OidcDiscoveryDocument - { - AuthorizationEndpoint = "https://discord.com/oauth2/authorize", - TokenEndpoint = "https://discord.com/oauth2/token", - UserinfoEndpoint = "https://discord.com/users/@me", - JwksUri = null - })!; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - var tokenResponse = await ExchangeCodeForTokensAsync(callbackData.Code); - if (tokenResponse?.AccessToken == null) - { - throw new InvalidOperationException("Failed to obtain access token from Discord"); - } - - var userInfo = await GetUserInfoAsync(tokenResponse.AccessToken); - - userInfo.AccessToken = tokenResponse.AccessToken; - userInfo.RefreshToken = tokenResponse.RefreshToken; - - return userInfo; - } - - protected override async Task ExchangeCodeForTokensAsync(string code, - string? codeVerifier = null) - { - var config = GetProviderConfig(); - var client = HttpClientFactory.CreateClient(); - - var content = new FormUrlEncodedContent(new Dictionary - { - { "client_id", config.ClientId }, - { "client_secret", config.ClientSecret }, - { "grant_type", "authorization_code" }, - { "code", code }, - { "redirect_uri", config.RedirectUri }, - }); - - var response = await client.PostAsync("https://discord.com/oauth2/token", content); - response.EnsureSuccessStatusCode(); - - return await response.Content.ReadFromJsonAsync(); - } - - private async Task GetUserInfoAsync(string accessToken) - { - var client = HttpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Get, "https://discord.com/users/@me"); - request.Headers.Add("Authorization", $"Bearer {accessToken}"); - - var response = await client.SendAsync(request); - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - var discordUser = JsonDocument.Parse(json).RootElement; - - var userId = discordUser.GetProperty("id").GetString() ?? ""; - var avatar = discordUser.TryGetProperty("avatar", out var avatarElement) ? avatarElement.GetString() : null; - - return new OidcUserInfo - { - UserId = userId, - Email = (discordUser.TryGetProperty("email", out var emailElement) ? emailElement.GetString() : null) ?? "", - EmailVerified = discordUser.TryGetProperty("verified", out var verifiedElement) && - verifiedElement.GetBoolean(), - DisplayName = (discordUser.TryGetProperty("global_name", out var globalNameElement) - ? globalNameElement.GetString() - : null) ?? "", - PreferredUsername = discordUser.GetProperty("username").GetString() ?? "", - ProfilePictureUrl = !string.IsNullOrEmpty(avatar) - ? $"https://cdn.discordapp.com/avatars/{userId}/{avatar}.png" - : "", - Provider = ProviderName - }; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/GitHubOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/GitHubOidcService.cs deleted file mode 100644 index fc80bfe..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/GitHubOidcService.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Net.Http.Json; -using System.Text.Json; -using DysonNetwork.Sphere.Storage; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class GitHubOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - public override string ProviderName => "GitHub"; - protected override string DiscoveryEndpoint => ""; // GitHub doesn't have a standard OIDC discovery endpoint - protected override string ConfigSectionName => "GitHub"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "redirect_uri", config.RedirectUri }, - { "scope", "user:email" }, - { "state", state }, - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"https://github.com/login/oauth/authorize?{queryString}"; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - var tokenResponse = await ExchangeCodeForTokensAsync(callbackData.Code); - if (tokenResponse?.AccessToken == null) - { - throw new InvalidOperationException("Failed to obtain access token from GitHub"); - } - - var userInfo = await GetUserInfoAsync(tokenResponse.AccessToken); - - userInfo.AccessToken = tokenResponse.AccessToken; - userInfo.RefreshToken = tokenResponse.RefreshToken; - - return userInfo; - } - - protected override async Task ExchangeCodeForTokensAsync(string code, - string? codeVerifier = null) - { - var config = GetProviderConfig(); - var client = HttpClientFactory.CreateClient(); - - var tokenRequest = new HttpRequestMessage(HttpMethod.Post, "https://github.com/login/oauth/access_token") - { - Content = new FormUrlEncodedContent(new Dictionary - { - { "client_id", config.ClientId }, - { "client_secret", config.ClientSecret }, - { "code", code }, - { "redirect_uri", config.RedirectUri }, - }) - }; - tokenRequest.Headers.Add("Accept", "application/json"); - - var response = await client.SendAsync(tokenRequest); - response.EnsureSuccessStatusCode(); - - return await response.Content.ReadFromJsonAsync(); - } - - private async Task GetUserInfoAsync(string accessToken) - { - var client = HttpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Get, "https://api.github.com/user"); - request.Headers.Add("Authorization", $"Bearer {accessToken}"); - request.Headers.Add("User-Agent", "DysonNetwork.Sphere"); - - var response = await client.SendAsync(request); - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - var githubUser = JsonDocument.Parse(json).RootElement; - - var email = githubUser.TryGetProperty("email", out var emailElement) ? emailElement.GetString() : null; - if (string.IsNullOrEmpty(email)) - { - email = await GetPrimaryEmailAsync(accessToken); - } - - return new OidcUserInfo - { - UserId = githubUser.GetProperty("id").GetInt64().ToString(), - Email = email, - DisplayName = githubUser.TryGetProperty("name", out var nameElement) ? nameElement.GetString() ?? "" : "", - PreferredUsername = githubUser.GetProperty("login").GetString() ?? "", - ProfilePictureUrl = githubUser.TryGetProperty("avatar_url", out var avatarElement) - ? avatarElement.GetString() ?? "" - : "", - Provider = ProviderName - }; - } - - private async Task GetPrimaryEmailAsync(string accessToken) - { - var client = HttpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Get, "https://api.github.com/user/emails"); - request.Headers.Add("Authorization", $"Bearer {accessToken}"); - request.Headers.Add("User-Agent", "DysonNetwork.Sphere"); - - var response = await client.SendAsync(request); - if (!response.IsSuccessStatusCode) return null; - - var emails = await response.Content.ReadFromJsonAsync>(); - return emails?.FirstOrDefault(e => e.Primary)?.Email; - } - - private class GitHubEmail - { - public string Email { get; set; } = ""; - public bool Primary { get; set; } - public bool Verified { get; set; } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/GoogleOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/GoogleOidcService.cs deleted file mode 100644 index a446b2e..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/GoogleOidcService.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Net.Http.Json; -using System.Security.Cryptography; -using System.Text; -using DysonNetwork.Sphere.Storage; -using Microsoft.IdentityModel.Tokens; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class GoogleOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - private readonly IHttpClientFactory _httpClientFactory = httpClientFactory; - - public override string ProviderName => "google"; - protected override string DiscoveryEndpoint => "https://accounts.google.com/.well-known/openid-configuration"; - protected override string ConfigSectionName => "Google"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - var discoveryDocument = GetDiscoveryDocumentAsync().GetAwaiter().GetResult(); - - if (discoveryDocument?.AuthorizationEndpoint == null) - { - throw new InvalidOperationException("Authorization endpoint not found in discovery document"); - } - - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "redirect_uri", config.RedirectUri }, - { "response_type", "code" }, - { "scope", "openid email profile" }, - { "state", state }, // No '|codeVerifier' appended anymore - { "nonce", nonce } - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"{discoveryDocument.AuthorizationEndpoint}?{queryString}"; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - // No need to split or parse code verifier from state - var state = callbackData.State ?? ""; - callbackData.State = state; // Keep the original state if needed - - // Exchange the code for tokens - // Pass null or omit the parameter for codeVerifier as PKCE is removed - var tokenResponse = await ExchangeCodeForTokensAsync(callbackData.Code, null); - if (tokenResponse?.IdToken == null) - { - throw new InvalidOperationException("Failed to obtain ID token from Google"); - } - - // Validate the ID token - var userInfo = await ValidateTokenAsync(tokenResponse.IdToken); - - // Set tokens on the user info - userInfo.AccessToken = tokenResponse.AccessToken; - userInfo.RefreshToken = tokenResponse.RefreshToken; - - // Try to fetch additional profile data if userinfo endpoint is available - try - { - var discoveryDocument = await GetDiscoveryDocumentAsync(); - if (discoveryDocument?.UserinfoEndpoint != null && !string.IsNullOrEmpty(tokenResponse.AccessToken)) - { - var client = _httpClientFactory.CreateClient(); - client.DefaultRequestHeaders.Authorization = - new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", tokenResponse.AccessToken); - - var userInfoResponse = - await client.GetFromJsonAsync>(discoveryDocument.UserinfoEndpoint); - - if (userInfoResponse != null) - { - if (userInfoResponse.TryGetValue("picture", out var picture) && picture != null) - { - userInfo.ProfilePictureUrl = picture.ToString(); - } - } - } - } - catch - { - // Ignore errors when fetching additional profile data - } - - return userInfo; - } - - private async Task ValidateTokenAsync(string idToken) - { - var discoveryDocument = await GetDiscoveryDocumentAsync(); - if (discoveryDocument?.JwksUri == null) - { - throw new InvalidOperationException("JWKS URI not found in discovery document"); - } - - var client = _httpClientFactory.CreateClient(); - var jwksResponse = await client.GetFromJsonAsync(discoveryDocument.JwksUri); - if (jwksResponse == null) - { - throw new InvalidOperationException("Failed to retrieve JWKS from Google"); - } - - var handler = new JwtSecurityTokenHandler(); - var jwtToken = handler.ReadJwtToken(idToken); - var kid = jwtToken.Header.Kid; - var signingKey = jwksResponse.Keys.FirstOrDefault(k => k.Kid == kid); - if (signingKey == null) - { - throw new SecurityTokenValidationException("Unable to find matching key in Google's JWKS"); - } - - var validationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidIssuer = "https://accounts.google.com", - ValidateAudience = true, - ValidAudience = GetProviderConfig().ClientId, - ValidateLifetime = true, - IssuerSigningKey = signingKey - }; - - return ValidateAndExtractIdToken(idToken, validationParameters); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/MicrosoftOidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/MicrosoftOidcService.cs deleted file mode 100644 index 83efad1..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/MicrosoftOidcService.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System.Net.Http.Json; -using System.Text.Json; -using DysonNetwork.Sphere.Storage; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -public class MicrosoftOidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) - : OidcService(configuration, httpClientFactory, db, auth, cache) -{ - public override string ProviderName => "Microsoft"; - - protected override string DiscoveryEndpoint => Configuration[$"Oidc:{ConfigSectionName}:DiscoveryEndpoint"] ?? - throw new InvalidOperationException( - "Microsoft OIDC discovery endpoint is not configured."); - - protected override string ConfigSectionName => "Microsoft"; - - public override string GetAuthorizationUrl(string state, string nonce) - { - var config = GetProviderConfig(); - var discoveryDocument = GetDiscoveryDocumentAsync().GetAwaiter().GetResult(); - if (discoveryDocument?.AuthorizationEndpoint == null) - throw new InvalidOperationException("Authorization endpoint not found in discovery document."); - - var queryParams = new Dictionary - { - { "client_id", config.ClientId }, - { "response_type", "code" }, - { "redirect_uri", config.RedirectUri }, - { "response_mode", "query" }, - { "scope", "openid profile email" }, - { "state", state }, - { "nonce", nonce }, - }; - - var queryString = string.Join("&", queryParams.Select(p => $"{p.Key}={Uri.EscapeDataString(p.Value)}")); - return $"{discoveryDocument.AuthorizationEndpoint}?{queryString}"; - } - - public override async Task ProcessCallbackAsync(OidcCallbackData callbackData) - { - var tokenResponse = await ExchangeCodeForTokensAsync(callbackData.Code); - if (tokenResponse?.AccessToken == null) - { - throw new InvalidOperationException("Failed to obtain access token from Microsoft"); - } - - var userInfo = await GetUserInfoAsync(tokenResponse.AccessToken); - - userInfo.AccessToken = tokenResponse.AccessToken; - userInfo.RefreshToken = tokenResponse.RefreshToken; - - return userInfo; - } - - protected override async Task ExchangeCodeForTokensAsync(string code, - string? codeVerifier = null) - { - var config = GetProviderConfig(); - var discoveryDocument = await GetDiscoveryDocumentAsync(); - if (discoveryDocument?.TokenEndpoint == null) - { - throw new InvalidOperationException("Token endpoint not found in discovery document."); - } - - var client = HttpClientFactory.CreateClient(); - - var tokenRequest = new HttpRequestMessage(HttpMethod.Post, discoveryDocument.TokenEndpoint) - { - Content = new FormUrlEncodedContent(new Dictionary - { - { "client_id", config.ClientId }, - { "scope", "openid profile email" }, - { "code", code }, - { "redirect_uri", config.RedirectUri }, - { "grant_type", "authorization_code" }, - { "client_secret", config.ClientSecret }, - }) - }; - - var response = await client.SendAsync(tokenRequest); - response.EnsureSuccessStatusCode(); - - return await response.Content.ReadFromJsonAsync(); - } - - private async Task GetUserInfoAsync(string accessToken) - { - var discoveryDocument = await GetDiscoveryDocumentAsync(); - if (discoveryDocument?.UserinfoEndpoint == null) - throw new InvalidOperationException("Userinfo endpoint not found in discovery document."); - - var client = HttpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Get, discoveryDocument.UserinfoEndpoint); - request.Headers.Add("Authorization", $"Bearer {accessToken}"); - - var response = await client.SendAsync(request); - response.EnsureSuccessStatusCode(); - - var json = await response.Content.ReadAsStringAsync(); - var microsoftUser = JsonDocument.Parse(json).RootElement; - - return new OidcUserInfo - { - UserId = microsoftUser.GetProperty("sub").GetString() ?? "", - Email = microsoftUser.TryGetProperty("email", out var emailElement) ? emailElement.GetString() : null, - DisplayName = - microsoftUser.TryGetProperty("name", out var nameElement) ? nameElement.GetString() ?? "" : "", - PreferredUsername = microsoftUser.TryGetProperty("preferred_username", out var preferredUsernameElement) - ? preferredUsernameElement.GetString() ?? "" - : "", - ProfilePictureUrl = microsoftUser.TryGetProperty("picture", out var pictureElement) - ? pictureElement.GetString() ?? "" - : "", - Provider = ProviderName - }; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/OidcController.cs b/DysonNetwork.Sphere/Auth/OpenId/OidcController.cs deleted file mode 100644 index 4324011..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/OidcController.cs +++ /dev/null @@ -1,194 +0,0 @@ -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -[ApiController] -[Route("/api/auth/login")] -public class OidcController( - IServiceProvider serviceProvider, - AppDatabase db, - AccountService accounts, - ICacheService cache -) - : ControllerBase -{ - private const string StateCachePrefix = "oidc-state:"; - private static readonly TimeSpan StateExpiration = TimeSpan.FromMinutes(15); - - [HttpGet("{provider}")] - public async Task OidcLogin( - [FromRoute] string provider, - [FromQuery] string? returnUrl = "/", - [FromHeader(Name = "X-Device-Id")] string? deviceId = null - ) - { - try - { - var oidcService = GetOidcService(provider); - - // If the user is already authenticated, treat as an account connection request - if (HttpContext.Items["CurrentUser"] is Account.Account currentUser) - { - var state = Guid.NewGuid().ToString(); - var nonce = Guid.NewGuid().ToString(); - - // Create and store connection state - var oidcState = OidcState.ForConnection(currentUser.Id, provider, nonce, deviceId); - await cache.SetAsync($"{StateCachePrefix}{state}", oidcState, StateExpiration); - - // The state parameter sent to the provider is the GUID key for the cache. - var authUrl = oidcService.GetAuthorizationUrl(state, nonce); - return Redirect(authUrl); - } - else // Otherwise, proceed with the login / registration flow - { - var nonce = Guid.NewGuid().ToString(); - var state = Guid.NewGuid().ToString(); - - // Create login state with return URL and device ID - var oidcState = OidcState.ForLogin(returnUrl ?? "/", deviceId); - await cache.SetAsync($"{StateCachePrefix}{state}", oidcState, StateExpiration); - var authUrl = oidcService.GetAuthorizationUrl(state, nonce); - return Redirect(authUrl); - } - } - catch (Exception ex) - { - return BadRequest($"Error initiating OpenID Connect flow: {ex.Message}"); - } - } - - /// - /// Mobile Apple Sign In endpoint - /// Handles Apple authentication directly from mobile apps - /// - [HttpPost("apple/mobile")] - public async Task> AppleMobileLogin( - [FromBody] AppleMobileSignInRequest request) - { - try - { - // Get Apple OIDC service - if (GetOidcService("apple") is not AppleOidcService appleService) - return StatusCode(503, "Apple OIDC service not available"); - - // Prepare callback data for processing - var callbackData = new OidcCallbackData - { - IdToken = request.IdentityToken, - Code = request.AuthorizationCode, - }; - - // Process the authentication - var userInfo = await appleService.ProcessCallbackAsync(callbackData); - - // Find or create user account using existing logic - var account = await FindOrCreateAccount(userInfo, "apple"); - - // Create session using the OIDC service - var challenge = await appleService.CreateChallengeForUserAsync( - userInfo, - account, - HttpContext, - request.DeviceId - ); - - return Ok(challenge); - } - catch (SecurityTokenValidationException ex) - { - return Unauthorized($"Invalid identity token: {ex.Message}"); - } - catch (Exception ex) - { - // Log the error - return StatusCode(500, $"Authentication failed: {ex.Message}"); - } - } - - private OidcService GetOidcService(string provider) - { - return provider.ToLower() switch - { - "apple" => serviceProvider.GetRequiredService(), - "google" => serviceProvider.GetRequiredService(), - "microsoft" => serviceProvider.GetRequiredService(), - "discord" => serviceProvider.GetRequiredService(), - "github" => serviceProvider.GetRequiredService(), - "afdian" => serviceProvider.GetRequiredService(), - _ => throw new ArgumentException($"Unsupported provider: {provider}") - }; - } - - private async Task FindOrCreateAccount(OidcUserInfo userInfo, string provider) - { - if (string.IsNullOrEmpty(userInfo.Email)) - throw new ArgumentException("Email is required for account creation"); - - // Check if an account exists by email - var existingAccount = await accounts.LookupAccount(userInfo.Email); - if (existingAccount != null) - { - // Check if this provider connection already exists - var existingConnection = await db.AccountConnections - .FirstOrDefaultAsync(c => c.AccountId == existingAccount.Id && - c.Provider == provider && - c.ProvidedIdentifier == userInfo.UserId); - - // If no connection exists, create one - if (existingConnection != null) - { - await db.AccountConnections - .Where(c => c.AccountId == existingAccount.Id && - c.Provider == provider && - c.ProvidedIdentifier == userInfo.UserId) - .ExecuteUpdateAsync(s => s - .SetProperty(c => c.LastUsedAt, SystemClock.Instance.GetCurrentInstant()) - .SetProperty(c => c.Meta, userInfo.ToMetadata())); - - return existingAccount; - } - - var connection = new AccountConnection - { - AccountId = existingAccount.Id, - Provider = provider, - ProvidedIdentifier = userInfo.UserId!, - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = SystemClock.Instance.GetCurrentInstant(), - Meta = userInfo.ToMetadata() - }; - - await db.AccountConnections.AddAsync(connection); - await db.SaveChangesAsync(); - - return existingAccount; - } - - // Create new account using the AccountService - var newAccount = await accounts.CreateAccount(userInfo); - - // Create the provider connection - var newConnection = new AccountConnection - { - AccountId = newAccount.Id, - Provider = provider, - ProvidedIdentifier = userInfo.UserId!, - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = SystemClock.Instance.GetCurrentInstant(), - Meta = userInfo.ToMetadata() - }; - - db.AccountConnections.Add(newConnection); - await db.SaveChangesAsync(); - - return newAccount; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/OidcService.cs b/DysonNetwork.Sphere/Auth/OpenId/OidcService.cs deleted file mode 100644 index 544704a..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/OidcService.cs +++ /dev/null @@ -1,295 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Net.Http.Json; -using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using NodaTime; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -/// -/// Base service for OpenID Connect authentication providers -/// -public abstract class OidcService( - IConfiguration configuration, - IHttpClientFactory httpClientFactory, - AppDatabase db, - AuthService auth, - ICacheService cache -) -{ - protected readonly IConfiguration Configuration = configuration; - protected readonly IHttpClientFactory HttpClientFactory = httpClientFactory; - protected readonly AppDatabase Db = db; - - /// - /// Gets the unique identifier for this provider - /// - public abstract string ProviderName { get; } - - /// - /// Gets the OIDC discovery document endpoint - /// - protected abstract string DiscoveryEndpoint { get; } - - /// - /// Gets configuration section name for this provider - /// - protected abstract string ConfigSectionName { get; } - - /// - /// Gets the authorization URL for initiating the authentication flow - /// - public abstract string GetAuthorizationUrl(string state, string nonce); - - /// - /// Process the callback from the OIDC provider - /// - public abstract Task ProcessCallbackAsync(OidcCallbackData callbackData); - - /// - /// Gets the provider configuration - /// - protected ProviderConfiguration GetProviderConfig() - { - return new ProviderConfiguration - { - ClientId = Configuration[$"Oidc:{ConfigSectionName}:ClientId"] ?? "", - ClientSecret = Configuration[$"Oidc:{ConfigSectionName}:ClientSecret"] ?? "", - RedirectUri = Configuration["BaseUrl"] + "/auth/callback/" + ProviderName.ToLower() - }; - } - - /// - /// Retrieves the OpenID Connect discovery document - /// - protected virtual async Task GetDiscoveryDocumentAsync() - { - // Construct a cache key unique to the current provider: - var cacheKey = $"oidc-discovery:{ProviderName}"; - - // Try getting the discovery document from cache first: - var (found, cachedDoc) = await cache.GetAsyncWithStatus(cacheKey); - if (found && cachedDoc != null) - { - return cachedDoc; - } - - // If it's not cached, fetch from the actual discovery endpoint: - var client = HttpClientFactory.CreateClient(); - var response = await client.GetAsync(DiscoveryEndpoint); - response.EnsureSuccessStatusCode(); - var doc = await response.Content.ReadFromJsonAsync(); - - // Store the discovery document in the cache for a while (e.g., 15 minutes): - if (doc is not null) - await cache.SetAsync(cacheKey, doc, TimeSpan.FromMinutes(15)); - - return doc; - - } - - /// - /// Exchange the authorization code for tokens - /// - protected virtual async Task ExchangeCodeForTokensAsync(string code, - string? codeVerifier = null) - { - var config = GetProviderConfig(); - var discoveryDocument = await GetDiscoveryDocumentAsync(); - - if (discoveryDocument?.TokenEndpoint == null) - { - throw new InvalidOperationException("Token endpoint not found in discovery document"); - } - - var client = HttpClientFactory.CreateClient(); - var content = new FormUrlEncodedContent(BuildTokenRequestParameters(code, config, codeVerifier)); - - var response = await client.PostAsync(discoveryDocument.TokenEndpoint, content); - response.EnsureSuccessStatusCode(); - - return await response.Content.ReadFromJsonAsync(); - } - - /// - /// Build the token request parameters - /// - protected virtual Dictionary BuildTokenRequestParameters(string code, ProviderConfiguration config, - string? codeVerifier) - { - var parameters = new Dictionary - { - { "client_id", config.ClientId }, - { "code", code }, - { "grant_type", "authorization_code" }, - { "redirect_uri", config.RedirectUri } - }; - - if (!string.IsNullOrEmpty(config.ClientSecret)) - { - parameters.Add("client_secret", config.ClientSecret); - } - - if (!string.IsNullOrEmpty(codeVerifier)) - { - parameters.Add("code_verifier", codeVerifier); - } - - return parameters; - } - - /// - /// Validates and extracts information from an ID token - /// - protected virtual OidcUserInfo ValidateAndExtractIdToken(string idToken, - TokenValidationParameters validationParameters) - { - var handler = new JwtSecurityTokenHandler(); - handler.ValidateToken(idToken, validationParameters, out _); - - var jwtToken = handler.ReadJwtToken(idToken); - - // Extract standard claims - var userId = jwtToken.Claims.FirstOrDefault(c => c.Type == "sub")?.Value; - var email = jwtToken.Claims.FirstOrDefault(c => c.Type == "email")?.Value; - var emailVerified = jwtToken.Claims.FirstOrDefault(c => c.Type == "email_verified")?.Value == "true"; - var name = jwtToken.Claims.FirstOrDefault(c => c.Type == "name")?.Value; - var givenName = jwtToken.Claims.FirstOrDefault(c => c.Type == "given_name")?.Value; - var familyName = jwtToken.Claims.FirstOrDefault(c => c.Type == "family_name")?.Value; - var preferredUsername = jwtToken.Claims.FirstOrDefault(c => c.Type == "preferred_username")?.Value; - var picture = jwtToken.Claims.FirstOrDefault(c => c.Type == "picture")?.Value; - - // Determine preferred username - try different options - var username = preferredUsername; - if (string.IsNullOrEmpty(username)) - { - // Fall back to email local part if no preferred username - username = !string.IsNullOrEmpty(email) ? email.Split('@')[0] : null; - } - - return new OidcUserInfo - { - UserId = userId, - Email = email, - EmailVerified = emailVerified, - FirstName = givenName ?? "", - LastName = familyName ?? "", - DisplayName = name ?? $"{givenName} {familyName}".Trim(), - PreferredUsername = username ?? "", - ProfilePictureUrl = picture, - Provider = ProviderName - }; - } - - /// - /// Creates a challenge and session for an authenticated user - /// Also creates or updates the account connection - /// - public async Task CreateChallengeForUserAsync( - OidcUserInfo userInfo, - Account.Account account, - HttpContext request, - string deviceId - ) - { - // Create or update the account connection - var connection = await Db.AccountConnections - .FirstOrDefaultAsync(c => c.Provider == ProviderName && - c.ProvidedIdentifier == userInfo.UserId && - c.AccountId == account.Id - ); - - if (connection is null) - { - connection = new AccountConnection - { - Provider = ProviderName, - ProvidedIdentifier = userInfo.UserId ?? "", - AccessToken = userInfo.AccessToken, - RefreshToken = userInfo.RefreshToken, - LastUsedAt = SystemClock.Instance.GetCurrentInstant(), - AccountId = account.Id - }; - await Db.AccountConnections.AddAsync(connection); - } - - // Create a challenge that's already completed - var now = SystemClock.Instance.GetCurrentInstant(); - var challenge = new Challenge - { - ExpiredAt = now.Plus(Duration.FromHours(1)), - StepTotal = await auth.DetectChallengeRisk(request.Request, account), - Type = ChallengeType.Oidc, - Platform = ChallengePlatform.Unidentified, - Audiences = [ProviderName], - Scopes = ["*"], - AccountId = account.Id, - DeviceId = deviceId, - IpAddress = request.Connection.RemoteIpAddress?.ToString() ?? null, - UserAgent = request.Request.Headers.UserAgent, - }; - challenge.StepRemain--; - if (challenge.StepRemain < 0) challenge.StepRemain = 0; - - await Db.AuthChallenges.AddAsync(challenge); - await Db.SaveChangesAsync(); - - return challenge; - } -} - -/// -/// Provider configuration from app settings -/// -public class ProviderConfiguration -{ - public string ClientId { get; set; } = ""; - public string ClientSecret { get; set; } = ""; - public string RedirectUri { get; set; } = ""; -} - -/// -/// OIDC Discovery Document -/// -public class OidcDiscoveryDocument -{ - [JsonPropertyName("authorization_endpoint")] - public string? AuthorizationEndpoint { get; set; } - - [JsonPropertyName("token_endpoint")] public string? TokenEndpoint { get; set; } - - [JsonPropertyName("userinfo_endpoint")] - public string? UserinfoEndpoint { get; set; } - - [JsonPropertyName("jwks_uri")] public string? JwksUri { get; set; } -} - -/// -/// Response from the token endpoint -/// -public class OidcTokenResponse -{ - [JsonPropertyName("access_token")] public string? AccessToken { get; set; } - - [JsonPropertyName("token_type")] public string? TokenType { get; set; } - - [JsonPropertyName("expires_in")] public int ExpiresIn { get; set; } - - [JsonPropertyName("refresh_token")] public string? RefreshToken { get; set; } - - [JsonPropertyName("id_token")] public string? IdToken { get; set; } -} - -/// -/// Data received in the callback from an OIDC provider -/// -public class OidcCallbackData -{ - public string Code { get; set; } = ""; - public string IdToken { get; set; } = ""; - public string? State { get; set; } - public string? RawData { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/OidcState.cs b/DysonNetwork.Sphere/Auth/OpenId/OidcState.cs deleted file mode 100644 index 608956e..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/OidcState.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Auth.OpenId; - -/// -/// Represents the state parameter used in OpenID Connect flows. -/// Handles serialization and deserialization of the state parameter. -/// -public class OidcState -{ - /// - /// The type of OIDC flow (login or connect). - /// - public OidcFlowType FlowType { get; set; } - - /// - /// The account ID (for connect flow). - /// - public Guid? AccountId { get; set; } - - - /// - /// The OIDC provider name. - /// - public string? Provider { get; set; } - - - /// - /// The nonce for CSRF protection. - /// - public string? Nonce { get; set; } - - - /// - /// The device ID for the authentication request. - /// - public string? DeviceId { get; set; } - - - /// - /// The return URL after authentication (for login flow). - /// - public string? ReturnUrl { get; set; } - - - /// - /// Creates a new OidcState for a connection flow. - /// - public static OidcState ForConnection(Guid accountId, string provider, string nonce, string? deviceId = null) - { - return new OidcState - { - FlowType = OidcFlowType.Connect, - AccountId = accountId, - Provider = provider, - Nonce = nonce, - DeviceId = deviceId - }; - } - - /// - /// Creates a new OidcState for a login flow. - /// - public static OidcState ForLogin(string returnUrl = "/", string? deviceId = null) - { - return new OidcState - { - FlowType = OidcFlowType.Login, - ReturnUrl = returnUrl, - DeviceId = deviceId - }; - } - - /// - /// The version of the state format. - /// - public int Version { get; set; } = 1; - - /// - /// Serializes the state to a JSON string for use in OIDC flows. - /// - public string Serialize() - { - return JsonSerializer.Serialize(this, new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull - }); - } - - /// - /// Attempts to parse a state string into an OidcState object. - /// - public static bool TryParse(string? stateString, out OidcState? state) - { - state = null; - - if (string.IsNullOrEmpty(stateString)) - return false; - - try - { - // First try to parse as JSON - try - { - state = JsonSerializer.Deserialize(stateString); - return state != null; - } - catch (JsonException) - { - // Not a JSON string, try legacy format for backward compatibility - return TryParseLegacyFormat(stateString, out state); - } - } - catch - { - return false; - } - } - - private static bool TryParseLegacyFormat(string stateString, out OidcState? state) - { - state = null; - var parts = stateString.Split('|'); - - // Check for connection flow format: {accountId}|{provider}|{nonce}|{deviceId}|connect - if (parts.Length >= 5 && - Guid.TryParse(parts[0], out var accountId) && - string.Equals(parts[^1], "connect", StringComparison.OrdinalIgnoreCase)) - { - state = new OidcState - { - FlowType = OidcFlowType.Connect, - AccountId = accountId, - Provider = parts[1], - Nonce = parts[2], - DeviceId = parts.Length >= 4 && !string.IsNullOrEmpty(parts[3]) ? parts[3] : null - }; - return true; - } - - // Check for login flow format: {returnUrl}|{deviceId}|login - if (parts.Length >= 2 && - parts.Length <= 3 && - (parts.Length < 3 || string.Equals(parts[^1], "login", StringComparison.OrdinalIgnoreCase))) - { - state = new OidcState - { - FlowType = OidcFlowType.Login, - ReturnUrl = parts[0], - DeviceId = parts.Length >= 2 && !string.IsNullOrEmpty(parts[1]) ? parts[1] : null - }; - return true; - } - - // Legacy format support (for backward compatibility) - if (parts.Length == 1) - { - state = new OidcState - { - FlowType = OidcFlowType.Login, - ReturnUrl = parts[0], - DeviceId = null - }; - return true; - } - - - return false; - } -} - -/// -/// Represents the type of OIDC flow. -/// -public enum OidcFlowType -{ - /// - /// Login or registration flow. - /// - Login, - - - /// - /// Account connection flow. - /// - Connect -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/OpenId/OidcUserInfo.cs b/DysonNetwork.Sphere/Auth/OpenId/OidcUserInfo.cs deleted file mode 100644 index fda81a1..0000000 --- a/DysonNetwork.Sphere/Auth/OpenId/OidcUserInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace DysonNetwork.Sphere.Auth.OpenId; - -/// -/// Represents the user information from an OIDC provider -/// -public class OidcUserInfo -{ - public string? UserId { get; set; } - public string? Email { get; set; } - public bool EmailVerified { get; set; } - public string FirstName { get; set; } = ""; - public string LastName { get; set; } = ""; - public string DisplayName { get; set; } = ""; - public string PreferredUsername { get; set; } = ""; - public string? ProfilePictureUrl { get; set; } - public string Provider { get; set; } = ""; - public string? RefreshToken { get; set; } - public string? AccessToken { get; set; } - - public Dictionary ToMetadata() - { - var metadata = new Dictionary(); - - if (!string.IsNullOrWhiteSpace(UserId)) - metadata["user_id"] = UserId; - - if (!string.IsNullOrWhiteSpace(Email)) - metadata["email"] = Email; - - metadata["email_verified"] = EmailVerified; - - if (!string.IsNullOrWhiteSpace(FirstName)) - metadata["first_name"] = FirstName; - - if (!string.IsNullOrWhiteSpace(LastName)) - metadata["last_name"] = LastName; - - if (!string.IsNullOrWhiteSpace(DisplayName)) - metadata["display_name"] = DisplayName; - - if (!string.IsNullOrWhiteSpace(PreferredUsername)) - metadata["preferred_username"] = PreferredUsername; - - if (!string.IsNullOrWhiteSpace(ProfilePictureUrl)) - metadata["profile_picture_url"] = ProfilePictureUrl; - - return metadata; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Auth/Session.cs b/DysonNetwork.Sphere/Auth/Session.cs deleted file mode 100644 index ac00ab8..0000000 --- a/DysonNetwork.Sphere/Auth/Session.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Developer; -using NodaTime; -using Point = NetTopologySuite.Geometries.Point; - -namespace DysonNetwork.Sphere.Auth; - -public class Session : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(1024)] public string? Label { get; set; } - public Instant? LastGrantedAt { get; set; } - public Instant? ExpiredAt { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account.Account Account { get; set; } = null!; - public Guid ChallengeId { get; set; } - public Challenge Challenge { get; set; } = null!; - public Guid? AppId { get; set; } - public CustomApp? App { get; set; } -} - -public enum ChallengeType -{ - Login, - OAuth, // Trying to authorize other platforms - Oidc // Trying to connect other platforms -} - -public enum ChallengePlatform -{ - Unidentified, - Web, - Ios, - Android, - MacOs, - Windows, - Linux -} - -public class Challenge : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public Instant? ExpiredAt { get; set; } - public int StepRemain { get; set; } - public int StepTotal { get; set; } - public int FailedAttempts { get; set; } - public ChallengePlatform Platform { get; set; } = ChallengePlatform.Unidentified; - public ChallengeType Type { get; set; } = ChallengeType.Login; - [Column(TypeName = "jsonb")] public List BlacklistFactors { get; set; } = new(); - [Column(TypeName = "jsonb")] public List Audiences { get; set; } = new(); - [Column(TypeName = "jsonb")] public List Scopes { get; set; } = new(); - [MaxLength(128)] public string? IpAddress { get; set; } - [MaxLength(512)] public string? UserAgent { get; set; } - [MaxLength(256)] public string? DeviceId { get; set; } - [MaxLength(1024)] public string? Nonce { get; set; } - public Point? Location { get; set; } - - public Guid AccountId { get; set; } - [JsonIgnore] public Account.Account Account { get; set; } = null!; - - public Challenge Normalize() - { - if (StepRemain == 0 && BlacklistFactors.Count == 0) StepRemain = StepTotal; - return this; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Chat/ChatController.cs b/DysonNetwork.Sphere/Chat/ChatController.cs index 212592e..dc1a5db 100644 --- a/DysonNetwork.Sphere/Chat/ChatController.cs +++ b/DysonNetwork.Sphere/Chat/ChatController.cs @@ -1,7 +1,9 @@ using System.ComponentModel.DataAnnotations; using System.Text.RegularExpressions; +using DysonNetwork.Shared.Content; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Storage; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -10,7 +12,12 @@ namespace DysonNetwork.Sphere.Chat; [ApiController] [Route("/api/chat")] -public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomService crs) : ControllerBase +public partial class ChatController( + AppDatabase db, + ChatService cs, + ChatRoomService crs, + FileService.FileServiceClient files +) : ControllerBase { public class MarkMessageReadRequest { @@ -32,10 +39,11 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [Authorize] public async Task>> GetChatSummary() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var unreadMessages = await cs.CountUnreadMessageForUser(currentUser.Id); - var lastMessages = await cs.ListLastMessageForUser(currentUser.Id); + var accountId = Guid.Parse(currentUser.Id); + var unreadMessages = await cs.CountUnreadMessageForUser(accountId); + var lastMessages = await cs.ListLastMessageForUser(accountId); var result = unreadMessages.Keys .Union(lastMessages.Keys) @@ -65,7 +73,7 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ public async Task>> ListMessages(Guid roomId, [FromQuery] int offset, [FromQuery] int take = 20) { - var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; + var currentUser = HttpContext.Items["CurrentUser"] as Account; var room = await db.ChatRooms.FirstOrDefaultAsync(r => r.Id == roomId); if (room is null) return NotFound(); @@ -74,8 +82,9 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ { if (currentUser is null) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.ChatMembers - .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) + .Where(m => m.AccountId == accountId && m.ChatRoomId == roomId) .FirstOrDefaultAsync(); if (member == null || member.Role < ChatMemberRole.Member) return StatusCode(403, "You are not a member of this chat room."); @@ -102,7 +111,7 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [HttpGet("{roomId:guid}/messages/{messageId:guid}")] public async Task> GetMessage(Guid roomId, Guid messageId) { - var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; + var currentUser = HttpContext.Items["CurrentUser"] as Account; var room = await db.ChatRooms.FirstOrDefaultAsync(r => r.Id == roomId); if (room is null) return NotFound(); @@ -111,8 +120,9 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ { if (currentUser is null) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.ChatMembers - .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) + .Where(m => m.AccountId == accountId && m.ChatRoomId == roomId) .FirstOrDefaultAsync(); if (member == null || member.Role < ChatMemberRole.Member) return StatusCode(403, "You are not a member of this chat room."); @@ -139,14 +149,14 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [RequiredPermission("global", "chat.messages.create")] public async Task SendMessage([FromBody] SendMessageRequest request, Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); request.Content = TextSanitizer.Sanitize(request.Content); if (string.IsNullOrWhiteSpace(request.Content) && (request.AttachmentsId == null || request.AttachmentsId.Count == 0)) return BadRequest("You cannot send an empty message."); - var member = await crs.GetRoomMember(currentUser.Id, roomId); + var member = await crs.GetRoomMember(Guid.Parse(currentUser.Id), roomId); if (member == null || member.Role < ChatMemberRole.Member) return StatusCode(403, "You need to be a normal member to send messages here."); @@ -162,12 +172,12 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ message.Content = request.Content; if (request.AttachmentsId is not null) { - var attachments = await db.Files - .Where(f => request.AttachmentsId.Contains(f.Id)) - .ToListAsync(); - message.Attachments = attachments + var queryRequest = new GetFileBatchRequest(); + queryRequest.Ids.AddRange(request.AttachmentsId); + var queryResponse = await files.GetFileBatchAsync(queryRequest); + message.Attachments = queryResponse.Files .OrderBy(f => request.AttachmentsId.IndexOf(f.Id)) - .Select(f => f.ToReferenceObject()) + .Select(CloudFileReferenceObject.FromProtoValue) .ToList(); } @@ -216,7 +226,7 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [Authorize] public async Task UpdateMessage([FromBody] SendMessageRequest request, Guid roomId, Guid messageId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); request.Content = TextSanitizer.Sanitize(request.Content); @@ -229,7 +239,8 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ if (message == null) return NotFound(); - if (message.Sender.AccountId != currentUser.Id) + var accountId = Guid.Parse(currentUser.Id); + if (message.Sender.AccountId != accountId) return StatusCode(403, "You can only edit your own messages."); if (string.IsNullOrWhiteSpace(request.Content) && @@ -269,7 +280,7 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [Authorize] public async Task DeleteMessage(Guid roomId, Guid messageId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var message = await db.ChatMessages .Include(m => m.Sender) @@ -278,7 +289,8 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ if (message == null) return NotFound(); - if (message.Sender.AccountId != currentUser.Id) + var accountId = Guid.Parse(currentUser.Id); + if (message.Sender.AccountId != accountId) return StatusCode(403, "You can only delete your own messages."); // Call service method to delete the message @@ -295,15 +307,16 @@ public partial class ChatController(AppDatabase db, ChatService cs, ChatRoomServ [HttpPost("{roomId:guid}/sync")] public async Task> GetSyncData([FromBody] SyncRequest request, Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var isMember = await db.ChatMembers - .AnyAsync(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId); + .AnyAsync(m => m.AccountId == accountId && m.ChatRoomId == roomId); if (!isMember) return StatusCode(403, "You are not a member of this chat room."); var response = await cs.GetSyncDataAsync(roomId, request.LastSyncTimestamp); return Ok(response); } -} +} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Chat/ChatRoom.cs b/DysonNetwork.Sphere/Chat/ChatRoom.cs index 5fd9d53..c37684c 100644 --- a/DysonNetwork.Sphere/Chat/ChatRoom.cs +++ b/DysonNetwork.Sphere/Chat/ChatRoom.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Storage; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using NodaTime; namespace DysonNetwork.Sphere.Chat; @@ -38,7 +39,7 @@ public class ChatRoom : ModelBase, IIdentifiedResource public ICollection DirectMembers { get; set; } = new List(); - public string ResourceIdentifier => $"chatroom/{Id}"; + public string ResourceIdentifier => $"chatroom:{Id}"; } public abstract class ChatMemberRole @@ -73,7 +74,7 @@ public class ChatMember : ModelBase public Guid ChatRoomId { get; set; } public ChatRoom ChatRoom { get; set; } = null!; public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; + public Account Account { get; set; } = null!; [MaxLength(1024)] public string? Nick { get; set; } @@ -105,7 +106,7 @@ public class ChatMemberTransmissionObject : ModelBase public Guid Id { get; set; } public Guid ChatRoomId { get; set; } public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; + public Account Account { get; set; } = null!; [MaxLength(1024)] public string? Nick { get; set; } diff --git a/DysonNetwork.Sphere/Chat/ChatRoomController.cs b/DysonNetwork.Sphere/Chat/ChatRoomController.cs index 8d8b0c4..f9cb452 100644 --- a/DysonNetwork.Sphere/Chat/ChatRoomController.cs +++ b/DysonNetwork.Sphere/Chat/ChatRoomController.cs @@ -1,11 +1,10 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Account; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Localization; using DysonNetwork.Sphere.Permission; using DysonNetwork.Sphere.Realm; -using DysonNetwork.Sphere.Storage; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization; using NodaTime; @@ -16,14 +15,12 @@ namespace DysonNetwork.Sphere.Chat; [Route("/api/chat")] public class ChatRoomController( AppDatabase db, - FileReferenceService fileRefService, ChatRoomService crs, RealmService rs, - ActionLogService als, - NotificationService nty, - RelationshipService rels, IStringLocalizer localizer, - AccountEventService aes + AccountService.AccountServiceClient accounts, + FileService.FileServiceClient files, + FileReferenceService.FileReferenceServiceClient fileRefs ) : ControllerBase { [HttpGet("{id:guid}")] @@ -36,8 +33,8 @@ public class ChatRoomController( if (chatRoom is null) return NotFound(); if (chatRoom.Type != ChatRoomType.DirectMessage) return Ok(chatRoom); - if (HttpContext.Items["CurrentUser"] is Account.Account currentUser) - chatRoom = await crs.LoadDirectMessageMembers(chatRoom, currentUser.Id); + if (HttpContext.Items["CurrentUser"] is Account currentUser) + chatRoom = await crs.LoadDirectMessageMembers(chatRoom, Guid.Parse(currentUser.Id)); return Ok(chatRoom); } @@ -46,18 +43,18 @@ public class ChatRoomController( [Authorize] public async Task>> ListJoinedChatRooms() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); - var userId = currentUser.Id; + var accountId = Guid.Parse(currentUser.Id); var chatRooms = await db.ChatMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.JoinedAt != null) .Where(m => m.LeaveAt == null) .Include(m => m.ChatRoom) .Select(m => m.ChatRoom) .ToListAsync(); - chatRooms = await crs.LoadDirectMessageMembers(chatRooms, userId); + chatRooms = await crs.LoadDirectMessageMembers(chatRooms, accountId); chatRooms = await crs.SortChatRoomByLastMessage(chatRooms); return Ok(chatRooms); @@ -72,21 +69,29 @@ public class ChatRoomController( [Authorize] public async Task> CreateDirectMessage([FromBody] DirectMessageRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); - var relatedUser = await db.Accounts.FindAsync(request.RelatedUserId); + var relatedUser = await accounts.GetAccountAsync( + new GetAccountRequest { Id = request.RelatedUserId.ToString() } + ); if (relatedUser is null) return BadRequest("Related user was not found"); - if (await rels.HasRelationshipWithStatus(currentUser.Id, relatedUser.Id, RelationshipStatus.Blocked)) + var hasBlocked = await accounts.HasRelationshipAsync(new GetRelationshipRequest() + { + AccountId = currentUser.Id, + RelatedId = request.RelatedUserId.ToString(), + Status = -100 + }); + if (hasBlocked?.Value ?? false) return StatusCode(403, "You cannot create direct message with a user that blocked you."); // Check if DM already exists between these users var existingDm = await db.ChatRooms .Include(c => c.Members) .Where(c => c.Type == ChatRoomType.DirectMessage && c.Members.Count == 2) - .Where(c => c.Members.Any(m => m.AccountId == currentUser.Id)) + .Where(c => c.Members.Any(m => m.AccountId == Guid.Parse(currentUser.Id))) .Where(c => c.Members.Any(m => m.AccountId == request.RelatedUserId)) .FirstOrDefaultAsync(); @@ -102,9 +107,9 @@ public class ChatRoomController( { new() { - AccountId = currentUser.Id, + AccountId = Guid.Parse(currentUser.Id), Role = ChatMemberRole.Owner, - JoinedAt = NodaTime.Instant.FromDateTimeUtc(DateTime.UtcNow) + JoinedAt = Instant.FromDateTimeUtc(DateTime.UtcNow) }, new() { @@ -130,18 +135,18 @@ public class ChatRoomController( return Ok(dmRoom); } - [HttpGet("direct/{userId:guid}")] + [HttpGet("direct/{accountId:guid}")] [Authorize] - public async Task> GetDirectChatRoom(Guid userId) + public async Task> GetDirectChatRoom(Guid accountId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); var room = await db.ChatRooms .Include(c => c.Members) .Where(c => c.Type == ChatRoomType.DirectMessage && c.Members.Count == 2) - .Where(c => c.Members.Any(m => m.AccountId == currentUser.Id)) - .Where(c => c.Members.Any(m => m.AccountId == userId)) + .Where(c => c.Members.Any(m => m.AccountId == Guid.Parse(currentUser.Id))) + .Where(c => c.Members.Any(m => m.AccountId == accountId)) .FirstOrDefaultAsync(); if (room is null) return NotFound(); @@ -164,7 +169,7 @@ public class ChatRoomController( [RequiredPermission("global", "chat.create")] public async Task> CreateChatRoom(ChatRoomRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); if (request.Name is null) return BadRequest("You cannot create a chat room without a name."); var chatRoom = new ChatRoom @@ -179,7 +184,7 @@ public class ChatRoomController( new() { Role = ChatMemberRole.Owner, - AccountId = currentUser.Id, + AccountId = Guid.Parse(currentUser.Id), JoinedAt = NodaTime.Instant.FromDateTimeUtc(DateTime.UtcNow) } } @@ -187,7 +192,8 @@ public class ChatRoomController( if (request.RealmId is not null) { - if (!await rs.IsMemberWithRole(request.RealmId.Value, currentUser.Id, RealmMemberRole.Moderator)) + if (!await rs.IsMemberWithRole(request.RealmId.Value, Guid.Parse(currentUser.Id), + RealmMemberRole.Moderator)) return StatusCode(403, "You need at least be a moderator to create chat linked to the realm."); chatRoom.RealmId = request.RealmId; } @@ -196,6 +202,14 @@ public class ChatRoomController( { chatRoom.Picture = (await db.Files.FindAsync(request.PictureId))?.ToReferenceObject(); if (chatRoom.Picture is null) return BadRequest("Invalid picture id, unable to find the file on cloud."); + await fileRefs.CreateReferenceAsync( + new CreateReferenceRequest + { + FileId = publisher.Picture.Id, + Usage = "publisher.picture", + ResourceId = publisher.ResourceIdentifier, + } + ); } if (request.BackgroundId is not null) @@ -236,7 +250,7 @@ public class ChatRoomController( [HttpPatch("{id:guid}")] public async Task> UpdateChatRoom(Guid id, [FromBody] ChatRoomRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(e => e.Id == id) @@ -245,16 +259,17 @@ public class ChatRoomController( if (chatRoom.RealmId is not null) { - if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, currentUser.Id, RealmMemberRole.Moderator)) + if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, Guid.Parse(currentUser.Id), + RealmMemberRole.Moderator)) return StatusCode(403, "You need at least be a realm moderator to update the chat."); } - else if (!await crs.IsMemberWithRole(chatRoom.Id, currentUser.Id, ChatMemberRole.Moderator)) + else if (!await crs.IsMemberWithRole(chatRoom.Id, Guid.Parse(currentUser.Id), ChatMemberRole.Moderator)) return StatusCode(403, "You need at least be a moderator to update the chat."); if (request.RealmId is not null) { var member = await db.RealmMembers - .Where(m => m.AccountId == currentUser.Id) + .Where(m => m.AccountId == Guid.Parse(currentUser.Id)) .Where(m => m.RealmId == request.RealmId) .FirstOrDefaultAsync(); if (member is null || member.Role < RealmMemberRole.Moderator) @@ -321,7 +336,7 @@ public class ChatRoomController( [HttpDelete("{id:guid}")] public async Task DeleteChatRoom(Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(e => e.Id == id) @@ -330,10 +345,11 @@ public class ChatRoomController( if (chatRoom.RealmId is not null) { - if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, currentUser.Id, RealmMemberRole.Moderator)) + if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, Guid.Parse(currentUser.Id), + RealmMemberRole.Moderator)) return StatusCode(403, "You need at least be a realm moderator to delete the chat."); } - else if (!await crs.IsMemberWithRole(chatRoom.Id, currentUser.Id, ChatMemberRole.Owner)) + else if (!await crs.IsMemberWithRole(chatRoom.Id, Guid.Parse(currentUser.Id), ChatMemberRole.Owner)) return StatusCode(403, "You need at least be the owner to delete the chat."); var chatRoomResourceId = $"chatroom:{chatRoom.Id}"; @@ -356,11 +372,11 @@ public class ChatRoomController( [Authorize] public async Task> GetRoomIdentity(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); var member = await db.ChatMembers - .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) + .Where(m => m.AccountId == Guid.Parse(currentUser.Id) && m.ChatRoomId == roomId) .Include(m => m.Account) .Include(m => m.Account.Profile) .FirstOrDefaultAsync(); @@ -375,7 +391,7 @@ public class ChatRoomController( public async Task>> ListMembers(Guid roomId, [FromQuery] int take = 20, [FromQuery] int skip = 0, [FromQuery] bool withStatus = false, [FromQuery] string? status = null) { - var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; + var currentUser = HttpContext.Items["CurrentUser"] as Shared.Proto.Account; var room = await db.ChatRooms .FirstOrDefaultAsync(r => r.Id == roomId); @@ -385,7 +401,7 @@ public class ChatRoomController( { if (currentUser is null) return Unauthorized(); var member = await db.ChatMembers - .FirstOrDefaultAsync(m => m.ChatRoomId == roomId && m.AccountId == currentUser.Id); + .FirstOrDefaultAsync(m => m.ChatRoomId == roomId && m.AccountId == Guid.Parse(currentUser.Id)); if (member is null) return StatusCode(403, "You need to be a member to see members of private chat room."); } @@ -435,7 +451,6 @@ public class ChatRoomController( } } - public class ChatMemberRequest { @@ -448,13 +463,14 @@ public class ChatRoomController( public async Task> InviteMember(Guid roomId, [FromBody] ChatMemberRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - var userId = currentUser.Id; + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var relatedUser = await db.Accounts.FindAsync(request.RelatedUserId); if (relatedUser is null) return BadRequest("Related user was not found"); - if (await rels.HasRelationshipWithStatus(currentUser.Id, relatedUser.Id, RelationshipStatus.Blocked)) + if (await rels.HasRelationshipWithStatus(Guid.Parse(currentUser.Id), relatedUser.Id, + RelationshipStatus.Blocked)) return StatusCode(403, "You cannot invite a user that blocked you."); var chatRoom = await db.ChatRooms @@ -466,7 +482,7 @@ public class ChatRoomController( if (chatRoom.RealmId is not null) { var realmMember = await db.RealmMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.RealmId == chatRoom.RealmId) .FirstOrDefaultAsync(); if (realmMember is null || realmMember.Role < RealmMemberRole.Moderator) @@ -475,7 +491,7 @@ public class ChatRoomController( else { var chatMember = await db.ChatMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.ChatRoomId == roomId) .FirstOrDefaultAsync(); if (chatMember is null) return StatusCode(403, "You are not even a member of the targeted chat room."); @@ -519,11 +535,11 @@ public class ChatRoomController( [Authorize] public async Task>> ListChatInvites() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - var userId = currentUser.Id; + if (HttpContext.Items["CurrentUser"] is not Shared.Proto.Account currentUser) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var members = await db.ChatMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.JoinedAt == null) .Include(e => e.ChatRoom) .Include(e => e.Account) @@ -532,7 +548,7 @@ public class ChatRoomController( var chatRooms = members.Select(m => m.ChatRoom).ToList(); var directMembers = - (await crs.LoadDirectMessageMembers(chatRooms, userId)).ToDictionary(c => c.Id, c => c.Members); + (await crs.LoadDirectMessageMembers(chatRooms, accountId)).ToDictionary(c => c.Id, c => c.Members); foreach (var member in members.Where(member => member.ChatRoom.Type == ChatRoomType.DirectMessage)) member.ChatRoom.Members = directMembers[member.ChatRoom.Id]; @@ -544,11 +560,11 @@ public class ChatRoomController( [Authorize] public async Task> AcceptChatInvite(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - var userId = currentUser.Id; + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.ChatMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.ChatRoomId == roomId) .Where(m => m.JoinedAt == null) .FirstOrDefaultAsync(); @@ -571,11 +587,11 @@ public class ChatRoomController( [Authorize] public async Task DeclineChatInvite(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - var userId = currentUser.Id; + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.ChatMembers - .Where(m => m.AccountId == userId) + .Where(m => m.AccountId == accountId) .Where(m => m.ChatRoomId == roomId) .Where(m => m.JoinedAt == null) .FirstOrDefaultAsync(); @@ -600,15 +616,16 @@ public class ChatRoomController( [FromBody] ChatMemberNotifyRequest request ) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(r => r.Id == roomId) .FirstOrDefaultAsync(); if (chatRoom is null) return NotFound(); + var accountId = Guid.Parse(currentUser.Id); var targetMember = await db.ChatMembers - .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) + .Where(m => m.AccountId == accountId && m.ChatRoomId == roomId) .FirstOrDefaultAsync(); if (targetMember is null) return BadRequest("You have not joined this chat room."); if (request.NotifyLevel is not null) @@ -629,7 +646,7 @@ public class ChatRoomController( public async Task> UpdateChatMemberRole(Guid roomId, Guid memberId, [FromBody] int newRole) { if (newRole >= ChatMemberRole.Owner) return BadRequest("Unable to set chat member to owner or greater role."); - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(r => r.Id == roomId) @@ -640,7 +657,7 @@ public class ChatRoomController( if (chatRoom.RealmId is not null) { var realmMember = await db.RealmMembers - .Where(m => m.AccountId == currentUser.Id) + .Where(m => m.AccountId == Guid.Parse(currentUser.Id)) .Where(m => m.RealmId == chatRoom.RealmId) .FirstOrDefaultAsync(); if (realmMember is null || realmMember.Role < RealmMemberRole.Moderator) @@ -657,7 +674,7 @@ public class ChatRoomController( if ( !await crs.IsMemberWithRole( chatRoom.Id, - currentUser.Id, + Guid.Parse(currentUser.Id), ChatMemberRole.Moderator, targetMember.Role, newRole @@ -688,7 +705,7 @@ public class ChatRoomController( [Authorize] public async Task RemoveChatMember(Guid roomId, Guid memberId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(r => r.Id == roomId) @@ -698,12 +715,13 @@ public class ChatRoomController( // Check if the chat room is owned by a realm if (chatRoom.RealmId is not null) { - if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, currentUser.Id, RealmMemberRole.Moderator)) + if (!await rs.IsMemberWithRole(chatRoom.RealmId.Value, Guid.Parse(currentUser.Id), + RealmMemberRole.Moderator)) return StatusCode(403, "You need at least be a realm moderator to remove members."); } else { - if (!await crs.IsMemberWithRole(chatRoom.Id, currentUser.Id, ChatMemberRole.Moderator)) + if (!await crs.IsMemberWithRole(chatRoom.Id, Guid.Parse(currentUser.Id), ChatMemberRole.Moderator)) return StatusCode(403, "You need at least be a moderator to remove members."); // Find the target member @@ -736,7 +754,7 @@ public class ChatRoomController( [Authorize] public async Task> JoinChatRoom(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var chatRoom = await db.ChatRooms .Where(r => r.Id == roomId) @@ -746,13 +764,13 @@ public class ChatRoomController( return StatusCode(403, "This chat room isn't a community. You need an invitation to join."); var existingMember = await db.ChatMembers - .FirstOrDefaultAsync(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId); + .FirstOrDefaultAsync(m => m.AccountId == Guid.Parse(currentUser.Id) && m.ChatRoomId == roomId); if (existingMember != null) return BadRequest("You are already a member of this chat room."); var newMember = new ChatMember { - AccountId = currentUser.Id, + AccountId = Guid.Parse(currentUser.Id), ChatRoomId = roomId, Role = ChatMemberRole.Member, JoinedAt = NodaTime.Instant.FromDateTimeUtc(DateTime.UtcNow) @@ -774,10 +792,10 @@ public class ChatRoomController( [Authorize] public async Task LeaveChat(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var member = await db.ChatMembers - .Where(m => m.AccountId == currentUser.Id) + .Where(m => m.AccountId == Guid.Parse(currentUser.Id)) .Where(m => m.ChatRoomId == roomId) .FirstOrDefaultAsync(); if (member is null) return NotFound(); @@ -788,7 +806,7 @@ public class ChatRoomController( var otherOwners = await db.ChatMembers .Where(m => m.ChatRoomId == roomId) .Where(m => m.Role == ChatMemberRole.Owner) - .Where(m => m.AccountId != currentUser.Id) + .Where(m => m.AccountId != Guid.Parse(currentUser.Id)) .AnyAsync(); if (!otherOwners) @@ -807,7 +825,7 @@ public class ChatRoomController( return NoContent(); } - private async Task _SendInviteNotify(ChatMember member, Account.Account sender) + private async Task _SendInviteNotify(ChatMember member, Account sender) { string title = localizer["ChatInviteTitle"]; diff --git a/DysonNetwork.Sphere/Chat/ChatRoomService.cs b/DysonNetwork.Sphere/Chat/ChatRoomService.cs index be57a69..1e23d19 100644 --- a/DysonNetwork.Sphere/Chat/ChatRoomService.cs +++ b/DysonNetwork.Sphere/Chat/ChatRoomService.cs @@ -1,4 +1,4 @@ -using DysonNetwork.Sphere.Storage; +using DysonNetwork.Shared.Cache; using Microsoft.EntityFrameworkCore; using NodaTime; diff --git a/DysonNetwork.Sphere/Chat/ChatService.cs b/DysonNetwork.Sphere/Chat/ChatService.cs index 1ff92ed..bdad2d9 100644 --- a/DysonNetwork.Sphere/Chat/ChatService.cs +++ b/DysonNetwork.Sphere/Chat/ChatService.cs @@ -241,7 +241,7 @@ public partial class ChatService( Priority = 10, }; - List accountsToNotify = []; + List accountsToNotify = []; foreach (var member in members) { scopedWs.SendPacketToAccount(member.AccountId, new WebSocketPacket diff --git a/DysonNetwork.Sphere/Chat/Message.cs b/DysonNetwork.Sphere/Chat/Message.cs index a0ef968..9865823 100644 --- a/DysonNetwork.Sphere/Chat/Message.cs +++ b/DysonNetwork.Sphere/Chat/Message.cs @@ -1,8 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; +using DysonNetwork.Shared.Data; using NodaTime; namespace DysonNetwork.Sphere.Chat; @@ -19,8 +18,6 @@ public class Message : ModelBase, IIdentifiedResource [Column(TypeName = "jsonb")] public List Attachments { get; set; } = []; - // Outdated fields, keep for backward compability - public ICollection OutdatedAttachments { get; set; } = new List(); public ICollection Reactions { get; set; } = new List(); public Guid? RepliedMessageId { get; set; } @@ -33,7 +30,7 @@ public class Message : ModelBase, IIdentifiedResource public Guid ChatRoomId { get; set; } [JsonIgnore] public ChatRoom ChatRoom { get; set; } = null!; - public string ResourceIdentifier => $"message/{Id}"; + public string ResourceIdentifier => $"message:{Id}"; } public enum MessageReactionAttitude diff --git a/DysonNetwork.Sphere/Chat/Realtime/IRealtimeService.cs b/DysonNetwork.Sphere/Chat/Realtime/IRealtimeService.cs index b7c7509..cd34f8b 100644 --- a/DysonNetwork.Sphere/Chat/Realtime/IRealtimeService.cs +++ b/DysonNetwork.Sphere/Chat/Realtime/IRealtimeService.cs @@ -36,7 +36,7 @@ public interface IRealtimeService /// The session identifier /// The user is the admin of session /// User-specific token for the session - string GetUserToken(Account.Account account, string sessionId, bool isAdmin = false); + string GetUserToken(Account account, string sessionId, bool isAdmin = false); /// /// Processes incoming webhook requests from the realtime service provider diff --git a/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs b/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs index 8e07d05..4313910 100644 --- a/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs +++ b/DysonNetwork.Sphere/Chat/Realtime/LivekitService.cs @@ -111,7 +111,7 @@ public class LivekitRealtimeService : IRealtimeService } /// - public string GetUserToken(Account.Account account, string sessionId, bool isAdmin = false) + public string GetUserToken(Account account, string sessionId, bool isAdmin = false) { var token = _accessToken.WithIdentity(account.Name) .WithName(account.Nick) diff --git a/DysonNetwork.Sphere/Chat/RealtimeCallController.cs b/DysonNetwork.Sphere/Chat/RealtimeCallController.cs index e26bcd9..6d300a2 100644 --- a/DysonNetwork.Sphere/Chat/RealtimeCallController.cs +++ b/DysonNetwork.Sphere/Chat/RealtimeCallController.cs @@ -46,7 +46,7 @@ public class RealtimeCallController( [Authorize] public async Task> GetOngoingCall(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var member = await db.ChatMembers .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) @@ -71,7 +71,7 @@ public class RealtimeCallController( [Authorize] public async Task> JoinCall(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); // Check if the user is a member of the chat room var member = await db.ChatMembers @@ -144,7 +144,7 @@ public class RealtimeCallController( [Authorize] public async Task> StartCall(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var member = await db.ChatMembers .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) @@ -163,7 +163,7 @@ public class RealtimeCallController( [Authorize] public async Task> EndCall(Guid roomId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var member = await db.ChatMembers .Where(m => m.AccountId == currentUser.Id && m.ChatRoomId == roomId) diff --git a/DysonNetwork.Sphere/Connection/AutoCompletionController.cs b/DysonNetwork.Sphere/Connection/AutoCompletionController.cs deleted file mode 100644 index 94eae1c..0000000 --- a/DysonNetwork.Sphere/Connection/AutoCompletionController.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Connection; - -[ApiController] -[Route("completion")] -public class AutoCompletionController(AppDatabase db) - : ControllerBase -{ - [HttpPost] - public async Task> GetCompletions([FromBody] AutoCompletionRequest request) - { - if (string.IsNullOrWhiteSpace(request?.Content)) - { - return BadRequest("Content is required"); - } - - var result = new AutoCompletionResponse(); - var lastWord = request.Content.Trim().Split(' ').LastOrDefault() ?? string.Empty; - - if (lastWord.StartsWith("@")) - { - var searchTerm = lastWord[1..]; // Remove the @ - result.Items = await GetAccountCompletions(searchTerm); - result.Type = "account"; - } - else if (lastWord.StartsWith(":")) - { - var searchTerm = lastWord[1..]; // Remove the : - result.Items = await GetStickerCompletions(searchTerm); - result.Type = "sticker"; - } - - return Ok(result); - } - - private async Task> GetAccountCompletions(string searchTerm) - { - return await db.Accounts - .Where(a => EF.Functions.ILike(a.Name, $"%{searchTerm}%")) - .OrderBy(a => a.Name) - .Take(10) - .Select(a => new CompletionItem - { - Id = a.Id.ToString(), - DisplayName = a.Name, - SecondaryText = a.Nick, - Type = "account", - Data = a - }) - .ToListAsync(); - } - - private async Task> GetStickerCompletions(string searchTerm) - { - return await db.Stickers - .Include(s => s.Pack) - .Where(s => EF.Functions.ILike(s.Pack.Prefix + s.Slug, $"%{searchTerm}%")) - .OrderBy(s => s.Slug) - .Take(10) - .Select(s => new CompletionItem - { - Id = s.Id.ToString(), - DisplayName = s.Slug, - Type = "sticker", - Data = s - }) - .ToListAsync(); - } -} - -public class AutoCompletionRequest -{ - [Required] public string Content { get; set; } = string.Empty; -} - -public class AutoCompletionResponse -{ - public string Type { get; set; } = string.Empty; - public List Items { get; set; } = new(); -} - -public class CompletionItem -{ - public string Id { get; set; } = string.Empty; - public string DisplayName { get; set; } = string.Empty; - public string? SecondaryText { get; set; } - public string Type { get; set; } = string.Empty; - public object? Data { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs b/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs deleted file mode 100644 index 8a305aa..0000000 --- a/DysonNetwork.Sphere/Connection/ClientTypeMiddleware.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace DysonNetwork.Sphere.Connection; - -public class ClientTypeMiddleware(RequestDelegate next) -{ - public async Task Invoke(HttpContext context) - { - var headers = context.Request.Headers; - bool isWebPage; - - // Priority 1: Check for custom header - if (headers.TryGetValue("X-Client", out var clientType)) - { - isWebPage = clientType.ToString().Length == 0; - } - else - { - var userAgent = headers.UserAgent.ToString(); - var accept = headers.Accept.ToString(); - - // Priority 2: Check known app User-Agent (backward compatibility) - if (!string.IsNullOrEmpty(userAgent) && userAgent.Contains("Solian")) - isWebPage = false; - // Priority 3: Accept header can help infer intent - else if (!string.IsNullOrEmpty(accept) && accept.Contains("text/html")) - isWebPage = true; - else if (!string.IsNullOrEmpty(accept) && accept.Contains("application/json")) - isWebPage = false; - else - isWebPage = true; - } - - context.Items["IsWebPage"] = isWebPage; - - if (!isWebPage && context.Request.Path != "/ws" && !context.Request.Path.StartsWithSegments("/api")) - context.Response.Redirect( - $"/api{context.Request.Path.Value}{context.Request.QueryString.Value}", - permanent: false - ); - else - await next(context); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/GeoIpService.cs b/DysonNetwork.Sphere/Connection/GeoIpService.cs deleted file mode 100644 index c4ef31d..0000000 --- a/DysonNetwork.Sphere/Connection/GeoIpService.cs +++ /dev/null @@ -1,56 +0,0 @@ -using MaxMind.GeoIP2; -using NetTopologySuite.Geometries; -using Microsoft.Extensions.Options; -using Point = NetTopologySuite.Geometries.Point; - -namespace DysonNetwork.Sphere.Connection; - -public class GeoIpOptions -{ - public string DatabasePath { get; set; } = null!; -} - -public class GeoIpService(IOptions options) -{ - private readonly string _databasePath = options.Value.DatabasePath; - private readonly GeometryFactory _geometryFactory = new(new PrecisionModel(), 4326); // 4326 is the SRID for WGS84 - - public Point? GetPointFromIp(string? ipAddress) - { - if (string.IsNullOrEmpty(ipAddress)) - return null; - - try - { - using var reader = new DatabaseReader(_databasePath); - var city = reader.City(ipAddress); - - if (city?.Location == null || !city.Location.HasCoordinates) - return null; - - return _geometryFactory.CreatePoint(new Coordinate( - city.Location.Longitude ?? 0, - city.Location.Latitude ?? 0)); - } - catch (Exception) - { - return null; - } - } - - public MaxMind.GeoIP2.Responses.CityResponse? GetFromIp(string? ipAddress) - { - if (string.IsNullOrEmpty(ipAddress)) - return null; - - try - { - using var reader = new DatabaseReader(_databasePath); - return reader.City(ipAddress); - } - catch (Exception) - { - return null; - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/Handlers/MessageReadHandler.cs b/DysonNetwork.Sphere/Connection/Handlers/MessageReadHandler.cs deleted file mode 100644 index ee072d2..0000000 --- a/DysonNetwork.Sphere/Connection/Handlers/MessageReadHandler.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Net.WebSockets; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Internal; -using SystemClock = NodaTime.SystemClock; - -namespace DysonNetwork.Sphere.Connection.Handlers; - -public class MessageReadHandler( - ChatRoomService crs, - FlushBufferService buffer -) - : IWebSocketPacketHandler -{ - public string PacketType => "messages.read"; - - public const string ChatMemberCacheKey = "ChatMember_{0}_{1}"; - - public async Task HandleAsync( - Account.Account currentUser, - string deviceId, - WebSocketPacket packet, - WebSocket socket, - WebSocketService srv - ) - { - var request = packet.GetData(); - if (request is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "Mark message as read requires you provide the ChatRoomId and MessageId" - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - var sender = await crs.GetRoomMember(currentUser.Id, request.ChatRoomId); - if (sender is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "User is not a member of the chat room." - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - var readReceipt = new MessageReadReceipt - { - SenderId = sender.Id, - }; - - buffer.Enqueue(readReceipt); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/Handlers/MessageTypingHandler.cs b/DysonNetwork.Sphere/Connection/Handlers/MessageTypingHandler.cs deleted file mode 100644 index b6447db..0000000 --- a/DysonNetwork.Sphere/Connection/Handlers/MessageTypingHandler.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Net.WebSockets; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Connection.Handlers; - -public class MessageTypingHandler(ChatRoomService crs) : IWebSocketPacketHandler -{ - public string PacketType => "messages.typing"; - - public async Task HandleAsync( - Account.Account currentUser, - string deviceId, - WebSocketPacket packet, - WebSocket socket, - WebSocketService srv - ) - { - var request = packet.GetData(); - if (request is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "Mark message as read requires you provide the ChatRoomId" - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - var sender = await crs.GetRoomMember(currentUser.Id, request.ChatRoomId); - if (sender is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "User is not a member of the chat room." - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - var responsePacket = new WebSocketPacket - { - Type = "messages.typing", - Data = new Dictionary() - { - ["room_id"] = sender.ChatRoomId, - ["sender_id"] = sender.Id, - ["sender"] = sender - } - }; - - // Broadcast read statuses - var otherMembers = (await crs.ListRoomMembers(request.ChatRoomId)).Select(m => m.AccountId).ToList(); - foreach (var member in otherMembers) - srv.SendPacketToAccount(member, responsePacket); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/Handlers/MessagesSubscribeHandler.cs b/DysonNetwork.Sphere/Connection/Handlers/MessagesSubscribeHandler.cs deleted file mode 100644 index cf5792b..0000000 --- a/DysonNetwork.Sphere/Connection/Handlers/MessagesSubscribeHandler.cs +++ /dev/null @@ -1,53 +0,0 @@ - -using System.Net.WebSockets; -using DysonNetwork.Sphere.Chat; - -namespace DysonNetwork.Sphere.Connection.Handlers; - -public class MessagesSubscribeHandler(ChatRoomService crs) : IWebSocketPacketHandler -{ - public string PacketType => "messages.subscribe"; - - public async Task HandleAsync( - Account.Account currentUser, - string deviceId, - WebSocketPacket packet, - WebSocket socket, - WebSocketService srv - ) - { - var request = packet.GetData(); - if (request is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "messages.subscribe requires you provide the ChatRoomId" - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - var sender = await crs.GetRoomMember(currentUser.Id, request.ChatRoomId); - if (sender is null) - { - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = "User is not a member of the chat room." - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - return; - } - - srv.SubscribeToChatRoom(sender.ChatRoomId.ToString(), deviceId); - } -} diff --git a/DysonNetwork.Sphere/Connection/Handlers/MessagesUnsubscribeHandler.cs b/DysonNetwork.Sphere/Connection/Handlers/MessagesUnsubscribeHandler.cs deleted file mode 100644 index cc507ac..0000000 --- a/DysonNetwork.Sphere/Connection/Handlers/MessagesUnsubscribeHandler.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Net.WebSockets; -using DysonNetwork.Sphere.Chat; - -namespace DysonNetwork.Sphere.Connection.Handlers; - -public class MessagesUnsubscribeHandler() : IWebSocketPacketHandler -{ - public string PacketType => "messages.unsubscribe"; - - public Task HandleAsync( - Account.Account currentUser, - string deviceId, - WebSocketPacket packet, - WebSocket socket, - WebSocketService srv - ) - { - srv.UnsubscribeFromChatRoom(deviceId); - return Task.CompletedTask; - } -} diff --git a/DysonNetwork.Sphere/Connection/IWebSocketPacketHandler.cs b/DysonNetwork.Sphere/Connection/IWebSocketPacketHandler.cs deleted file mode 100644 index b625a01..0000000 --- a/DysonNetwork.Sphere/Connection/IWebSocketPacketHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Net.WebSockets; - -namespace DysonNetwork.Sphere.Connection; - -public interface IWebSocketPacketHandler -{ - string PacketType { get; } - Task HandleAsync(Account.Account currentUser, string deviceId, WebSocketPacket packet, WebSocket socket, WebSocketService srv); -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/WebSocketController.cs b/DysonNetwork.Sphere/Connection/WebSocketController.cs deleted file mode 100644 index 3bf61cf..0000000 --- a/DysonNetwork.Sphere/Connection/WebSocketController.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Concurrent; -using System.Net.WebSockets; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore.Metadata.Internal; -using Swashbuckle.AspNetCore.Annotations; - -namespace DysonNetwork.Sphere.Connection; - -[ApiController] -[Route("/ws")] -public class WebSocketController(WebSocketService ws, ILogger logger) : ControllerBase -{ - [Route("/ws")] - [Authorize] - [SwaggerIgnore] - public async Task TheGateway() - { - HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - HttpContext.Items.TryGetValue("CurrentSession", out var currentSessionValue); - if (currentUserValue is not Account.Account currentUser || - currentSessionValue is not Auth.Session currentSession) - { - HttpContext.Response.StatusCode = StatusCodes.Status401Unauthorized; - return; - } - - var accountId = currentUser.Id; - var deviceId = currentSession.Challenge.DeviceId; - - if (string.IsNullOrEmpty(deviceId)) - { - HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest; - return; - } - - using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(); - var cts = new CancellationTokenSource(); - var connectionKey = (accountId, deviceId); - - if (!ws.TryAdd(connectionKey, webSocket, cts)) - { - await webSocket.CloseAsync( - WebSocketCloseStatus.InternalServerError, - "Failed to establish connection.", - CancellationToken.None - ); - return; - } - - logger.LogInformation( - $"Connection established with user @{currentUser.Name}#{currentUser.Id} and device #{deviceId}"); - - try - { - await _ConnectionEventLoop(deviceId, currentUser, webSocket, cts.Token); - } - catch (Exception ex) - { - Console.WriteLine($"WebSocket Error: {ex.Message}"); - } - finally - { - ws.Disconnect(connectionKey); - logger.LogInformation( - $"Connection disconnected with user @{currentUser.Name}#{currentUser.Id} and device #{deviceId}"); - } - } - - private async Task _ConnectionEventLoop( - string deviceId, - Account.Account currentUser, - WebSocket webSocket, - CancellationToken cancellationToken - ) - { - var connectionKey = (AccountId: currentUser.Id, DeviceId: deviceId); - - var buffer = new byte[1024 * 4]; - try - { - var receiveResult = await webSocket.ReceiveAsync( - new ArraySegment(buffer), - cancellationToken - ); - while (!receiveResult.CloseStatus.HasValue) - { - receiveResult = await webSocket.ReceiveAsync( - new ArraySegment(buffer), - cancellationToken - ); - - var packet = WebSocketPacket.FromBytes(buffer[..receiveResult.Count]); - _ = ws.HandlePacket(currentUser, connectionKey.DeviceId, packet, webSocket); - } - } - catch (OperationCanceledException) - { - if ( - webSocket.State != WebSocketState.Closed - && webSocket.State != WebSocketState.Aborted - ) - { - ws.Disconnect(connectionKey); - } - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/WebSocketPacket.cs b/DysonNetwork.Sphere/Connection/WebSocketPacket.cs deleted file mode 100644 index 745a961..0000000 --- a/DysonNetwork.Sphere/Connection/WebSocketPacket.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Text.Json; -using NodaTime; -using NodaTime.Serialization.SystemTextJson; - -public class WebSocketPacketType -{ - public const string Error = "error"; - public const string MessageNew = "messages.new"; - public const string MessageUpdate = "messages.update"; - public const string MessageDelete = "messages.delete"; - public const string CallParticipantsUpdate = "call.participants.update"; -} - -public class WebSocketPacket -{ - public string Type { get; set; } = null!; - public object Data { get; set; } = null!; - public string? ErrorMessage { get; set; } - - /// - /// Creates a WebSocketPacket from raw WebSocket message bytes - /// - /// Raw WebSocket message bytes - /// Deserialized WebSocketPacket - public static WebSocketPacket FromBytes(byte[] bytes) - { - var json = System.Text.Encoding.UTF8.GetString(bytes); - var jsonOpts = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, - DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower, - }; - return JsonSerializer.Deserialize(json, jsonOpts) ?? - throw new JsonException("Failed to deserialize WebSocketPacket"); - } - - /// - /// Deserializes the Data property to the specified type T - /// - /// Target type to deserialize to - /// Deserialized data of type T - public T? GetData() - { - if (Data is T typedData) - return typedData; - - var jsonOpts = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, - DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower, - }; - return JsonSerializer.Deserialize( - JsonSerializer.Serialize(Data, jsonOpts), - jsonOpts - ); - } - - /// - /// Serializes this WebSocketPacket to a byte array for sending over WebSocket - /// - /// Byte array representation of the packet - public byte[] ToBytes() - { - var jsonOpts = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, - DictionaryKeyPolicy = JsonNamingPolicy.SnakeCaseLower, - }.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); - var json = JsonSerializer.Serialize(this, jsonOpts); - return System.Text.Encoding.UTF8.GetBytes(json); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/WebSocketService.cs b/DysonNetwork.Sphere/Connection/WebSocketService.cs deleted file mode 100644 index c63575c..0000000 --- a/DysonNetwork.Sphere/Connection/WebSocketService.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Collections.Concurrent; -using System.Net.WebSockets; - -namespace DysonNetwork.Sphere.Connection; - -public class WebSocketService -{ - private readonly IDictionary _handlerMap; - - public WebSocketService(IEnumerable handlers) - { - _handlerMap = handlers.ToDictionary(h => h.PacketType); - } - - private static readonly ConcurrentDictionary< - (Guid AccountId, string DeviceId), - (WebSocket Socket, CancellationTokenSource Cts) - > ActiveConnections = new(); - - private static readonly ConcurrentDictionary ActiveSubscriptions = new(); // deviceId -> chatRoomId - - public void SubscribeToChatRoom(string chatRoomId, string deviceId) - { - ActiveSubscriptions[deviceId] = chatRoomId; - } - - public void UnsubscribeFromChatRoom(string deviceId) - { - ActiveSubscriptions.TryRemove(deviceId, out _); - } - - public bool IsUserSubscribedToChatRoom(Guid accountId, string chatRoomId) - { - var userDeviceIds = ActiveConnections.Keys.Where(k => k.AccountId == accountId).Select(k => k.DeviceId); - foreach (var deviceId in userDeviceIds) - { - if (ActiveSubscriptions.TryGetValue(deviceId, out var subscribedChatRoomId) && subscribedChatRoomId == chatRoomId) - { - return true; - } - } - return false; - } - - public bool TryAdd( - (Guid AccountId, string DeviceId) key, - WebSocket socket, - CancellationTokenSource cts - ) - { - if (ActiveConnections.TryGetValue(key, out _)) - Disconnect(key, - "Just connected somewhere else with the same identifier."); // Disconnect the previous one using the same identifier - return ActiveConnections.TryAdd(key, (socket, cts)); - } - - public void Disconnect((Guid AccountId, string DeviceId) key, string? reason = null) - { - if (!ActiveConnections.TryGetValue(key, out var data)) return; - data.Socket.CloseAsync( - WebSocketCloseStatus.NormalClosure, - reason ?? "Server just decided to disconnect.", - CancellationToken.None - ); - data.Cts.Cancel(); - ActiveConnections.TryRemove(key, out _); - UnsubscribeFromChatRoom(key.DeviceId); - } - - public bool GetAccountIsConnected(Guid accountId) - { - return ActiveConnections.Any(c => c.Key.AccountId == accountId); - } - - public void SendPacketToAccount(Guid userId, WebSocketPacket packet) - { - var connections = ActiveConnections.Where(c => c.Key.AccountId == userId); - var packetBytes = packet.ToBytes(); - var segment = new ArraySegment(packetBytes); - - foreach (var connection in connections) - { - connection.Value.Socket.SendAsync( - segment, - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - } - } - - public void SendPacketToDevice(string deviceId, WebSocketPacket packet) - { - var connections = ActiveConnections.Where(c => c.Key.DeviceId == deviceId); - var packetBytes = packet.ToBytes(); - var segment = new ArraySegment(packetBytes); - - foreach (var connection in connections) - { - connection.Value.Socket.SendAsync( - segment, - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - } - } - - public async Task HandlePacket(Account.Account currentUser, string deviceId, WebSocketPacket packet, - WebSocket socket) - { - if (_handlerMap.TryGetValue(packet.Type, out var handler)) - { - await handler.HandleAsync(currentUser, deviceId, packet, socket, this); - return; - } - - await socket.SendAsync( - new ArraySegment(new WebSocketPacket - { - Type = WebSocketPacketType.Error, - ErrorMessage = $"Unprocessable packet: {packet.Type}" - }.ToBytes()), - WebSocketMessageType.Binary, - true, - CancellationToken.None - ); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.Designer.cs b/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.Designer.cs deleted file mode 100644 index 96facd5..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.Designer.cs +++ /dev/null @@ -1,4000 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250628172328_AddOidcProviderSupport")] - partial class AddOidcProviderSupport - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Config") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AllowOfflineAccess") - .HasColumnType("boolean") - .HasColumnName("allow_offline_access"); - - b.Property("AllowedGrantTypes") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("allowed_grant_types"); - - b.Property("AllowedScopes") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("allowed_scopes"); - - b.Property("ClientUri") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("client_uri"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LogoUri") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("logo_uri"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostLogoutRedirectUris") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("post_logout_redirect_uris"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RedirectUris") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("redirect_uris"); - - b.Property("RequirePkce") - .HasColumnType("boolean") - .HasColumnName("require_pkce"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IsOidc") - .HasColumnType("boolean") - .HasColumnName("is_oidc"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.HasIndex("Secret") - .IsUnique() - .HasDatabaseName("ix_custom_app_secrets_secret"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("TagId") - .HasColumnType("uuid") - .HasColumnName("tag_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "TagId") - .HasName("pk_realm_tags"); - - b.HasIndex("TagId") - .HasDatabaseName("ix_realm_tags_tag_id"); - - b.ToTable("realm_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_tags"); - - b.ToTable("tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany("Secrets") - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("RealmTags") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_realms_realm_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag") - .WithMany("RealmTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_tags_tag_id"); - - b.Navigation("Realm"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Navigation("Secrets"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.cs b/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.cs deleted file mode 100644 index 2d3ae2a..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250628172328_AddOidcProviderSupport.cs +++ /dev/null @@ -1,139 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - /// - public partial class AddOidcProviderSupport : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "remarks", - table: "custom_app_secrets", - newName: "description"); - - migrationBuilder.AddColumn( - name: "allow_offline_access", - table: "custom_apps", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "allowed_grant_types", - table: "custom_apps", - type: "character varying(256)", - maxLength: 256, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "allowed_scopes", - table: "custom_apps", - type: "character varying(256)", - maxLength: 256, - nullable: true); - - migrationBuilder.AddColumn( - name: "client_uri", - table: "custom_apps", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.AddColumn( - name: "logo_uri", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn( - name: "post_logout_redirect_uris", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn( - name: "redirect_uris", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "require_pkce", - table: "custom_apps", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "is_oidc", - table: "custom_app_secrets", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.CreateIndex( - name: "ix_custom_app_secrets_secret", - table: "custom_app_secrets", - column: "secret", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "ix_custom_app_secrets_secret", - table: "custom_app_secrets"); - - migrationBuilder.DropColumn( - name: "allow_offline_access", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "allowed_grant_types", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "allowed_scopes", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "client_uri", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "logo_uri", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "post_logout_redirect_uris", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "redirect_uris", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "require_pkce", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "is_oidc", - table: "custom_app_secrets"); - - migrationBuilder.RenameColumn( - name: "description", - table: "custom_app_secrets", - newName: "remarks"); - } - } -} diff --git a/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.Designer.cs b/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.Designer.cs deleted file mode 100644 index 2f59182..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.Designer.cs +++ /dev/null @@ -1,4014 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250629084150_AuthSessionWithApp")] - partial class AuthSessionWithApp - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_auth_sessions_app_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Config") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AllowOfflineAccess") - .HasColumnType("boolean") - .HasColumnName("allow_offline_access"); - - b.Property("AllowedGrantTypes") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("allowed_grant_types"); - - b.Property("AllowedScopes") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("allowed_scopes"); - - b.Property("ClientUri") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("client_uri"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LogoUri") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("logo_uri"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostLogoutRedirectUris") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("post_logout_redirect_uris"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RedirectUris") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("redirect_uris"); - - b.Property("RequirePkce") - .HasColumnType("boolean") - .HasColumnName("require_pkce"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IsOidc") - .HasColumnType("boolean") - .HasColumnName("is_oidc"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.HasIndex("Secret") - .IsUnique() - .HasDatabaseName("ix_custom_app_secrets_secret"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("TagId") - .HasColumnType("uuid") - .HasColumnName("tag_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "TagId") - .HasName("pk_realm_tags"); - - b.HasIndex("TagId") - .HasDatabaseName("ix_realm_tags_tag_id"); - - b.ToTable("realm_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_tags"); - - b.ToTable("tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .HasConstraintName("fk_auth_sessions_custom_apps_app_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("App"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany("Secrets") - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("RealmTags") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_realms_realm_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag") - .WithMany("RealmTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_tags_tag_id"); - - b.Navigation("Realm"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Navigation("Secrets"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.cs b/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.cs deleted file mode 100644 index 80d7f52..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250629084150_AuthSessionWithApp.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - /// - public partial class AuthSessionWithApp : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "app_id", - table: "auth_sessions", - type: "uuid", - nullable: true); - - migrationBuilder.CreateIndex( - name: "ix_auth_sessions_app_id", - table: "auth_sessions", - column: "app_id"); - - migrationBuilder.AddForeignKey( - name: "fk_auth_sessions_custom_apps_app_id", - table: "auth_sessions", - column: "app_id", - principalTable: "custom_apps", - principalColumn: "id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_auth_sessions_custom_apps_app_id", - table: "auth_sessions"); - - migrationBuilder.DropIndex( - name: "ix_auth_sessions_app_id", - table: "auth_sessions"); - - migrationBuilder.DropColumn( - name: "app_id", - table: "auth_sessions"); - } - } -} diff --git a/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.Designer.cs b/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.Designer.cs deleted file mode 100644 index 5a31d1a..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.Designer.cs +++ /dev/null @@ -1,3993 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Developer; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250629123136_CustomAppsRefine")] - partial class CustomAppsRefine - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_auth_sessions_app_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Config") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Links") - .HasColumnType("jsonb") - .HasColumnName("links"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("OauthConfig") - .HasColumnType("jsonb") - .HasColumnName("oauth_config"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IsOidc") - .HasColumnType("boolean") - .HasColumnName("is_oidc"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.HasIndex("Secret") - .IsUnique() - .HasDatabaseName("ix_custom_app_secrets_secret"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("TagId") - .HasColumnType("uuid") - .HasColumnName("tag_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "TagId") - .HasName("pk_realm_tags"); - - b.HasIndex("TagId") - .HasDatabaseName("ix_realm_tags_tag_id"); - - b.ToTable("realm_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_tags"); - - b.ToTable("tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .HasConstraintName("fk_auth_sessions_custom_apps_app_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("App"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany("Secrets") - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Features") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("RealmTags") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_realms_realm_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag") - .WithMany("RealmTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_tags_tag_id"); - - b.Navigation("Realm"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Navigation("Secrets"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Features"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.cs b/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.cs deleted file mode 100644 index ff6d5ad..0000000 --- a/DysonNetwork.Sphere/Data/Migrations/20250629123136_CustomAppsRefine.cs +++ /dev/null @@ -1,182 +0,0 @@ -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Developer; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Data.Migrations -{ - /// - public partial class CustomAppsRefine : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "allow_offline_access", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "allowed_grant_types", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "allowed_scopes", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "client_uri", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "logo_uri", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "post_logout_redirect_uris", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "redirect_uris", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "require_pkce", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "verified_at", - table: "custom_apps"); - - migrationBuilder.RenameColumn( - name: "verified_as", - table: "custom_apps", - newName: "description"); - - migrationBuilder.AddColumn( - name: "background", - table: "custom_apps", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "links", - table: "custom_apps", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "oauth_config", - table: "custom_apps", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "picture", - table: "custom_apps", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "verification", - table: "custom_apps", - type: "jsonb", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "background", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "links", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "oauth_config", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "picture", - table: "custom_apps"); - - migrationBuilder.DropColumn( - name: "verification", - table: "custom_apps"); - - migrationBuilder.RenameColumn( - name: "description", - table: "custom_apps", - newName: "verified_as"); - - migrationBuilder.AddColumn( - name: "allow_offline_access", - table: "custom_apps", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "allowed_grant_types", - table: "custom_apps", - type: "character varying(256)", - maxLength: 256, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "allowed_scopes", - table: "custom_apps", - type: "character varying(256)", - maxLength: 256, - nullable: true); - - migrationBuilder.AddColumn( - name: "client_uri", - table: "custom_apps", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.AddColumn( - name: "logo_uri", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn( - name: "post_logout_redirect_uris", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn( - name: "redirect_uris", - table: "custom_apps", - type: "character varying(4096)", - maxLength: 4096, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "require_pkce", - table: "custom_apps", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "verified_at", - table: "custom_apps", - type: "timestamp with time zone", - nullable: true); - } - } -} diff --git a/DysonNetwork.Sphere/Developer/CustomApp.cs b/DysonNetwork.Sphere/Developer/CustomApp.cs index d1aaaeb..0d3ba5d 100644 --- a/DysonNetwork.Sphere/Developer/CustomApp.cs +++ b/DysonNetwork.Sphere/Developer/CustomApp.cs @@ -35,7 +35,7 @@ public class CustomApp : ModelBase, IIdentifiedResource public Guid PublisherId { get; set; } public Publisher.Publisher Developer { get; set; } = null!; - [NotMapped] public string ResourceIdentifier => "custom-app/" + Id; + [NotMapped] public string ResourceIdentifier => "custom-app:" + Id; } public class CustomAppLinks diff --git a/DysonNetwork.Sphere/Developer/CustomAppController.cs b/DysonNetwork.Sphere/Developer/CustomAppController.cs index 4b354d4..c0e42ec 100644 --- a/DysonNetwork.Sphere/Developer/CustomAppController.cs +++ b/DysonNetwork.Sphere/Developer/CustomAppController.cs @@ -47,7 +47,7 @@ public class CustomAppController(CustomAppService customApps, PublisherService p [Authorize] public async Task CreateApp([FromRoute] string pubName, [FromBody] CustomAppRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (string.IsNullOrWhiteSpace(request.Name) || string.IsNullOrWhiteSpace(request.Slug)) return BadRequest("Name and slug are required"); @@ -79,7 +79,7 @@ public class CustomAppController(CustomAppService customApps, PublisherService p [FromBody] CustomAppRequest request ) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); @@ -109,7 +109,7 @@ public class CustomAppController(CustomAppService customApps, PublisherService p [FromRoute] Guid id ) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); diff --git a/DysonNetwork.Sphere/Developer/DeveloperController.cs b/DysonNetwork.Sphere/Developer/DeveloperController.cs index 8408141..4981bf6 100644 --- a/DysonNetwork.Sphere/Developer/DeveloperController.cs +++ b/DysonNetwork.Sphere/Developer/DeveloperController.cs @@ -63,7 +63,7 @@ public class DeveloperController( [Authorize] public async Task>> ListJoinedDevelopers() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var members = await db.PublisherMembers @@ -93,7 +93,7 @@ public class DeveloperController( [RequiredPermission("global", "developers.create")] public async Task> EnrollDeveloperProgram(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var publisher = await db.Publishers diff --git a/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj b/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj index ca9d807..3ddb288 100644 --- a/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj +++ b/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj @@ -85,7 +85,7 @@ - + @@ -164,6 +164,19 @@ <_ContentIncludedByDefault Remove="app\publish\Keys\Solian.json" /> <_ContentIncludedByDefault Remove="app\publish\package-lock.json" /> <_ContentIncludedByDefault Remove="app\publish\package.json" /> + <_ContentIncludedByDefault Remove="Pages\Account\Profile.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\Authorize.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\Callback.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\Challenge.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\Login.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\SelectFactor.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\VerifyFactor.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Checkpoint\CheckpointPage.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Spell\MagicSpellPage.cshtml" /> + + + + diff --git a/DysonNetwork.Sphere/Email/EmailModels.cs b/DysonNetwork.Sphere/Email/EmailModels.cs deleted file mode 100644 index 1a53142..0000000 --- a/DysonNetwork.Sphere/Email/EmailModels.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace DysonNetwork.Sphere.Email; - -public class LandingEmailModel -{ - public required string Name { get; set; } - public required string Link { get; set; } -} - -public class AccountDeletionEmailModel -{ - public required string Name { get; set; } - public required string Link { get; set; } -} - -public class PasswordResetEmailModel -{ - public required string Name { get; set; } - public required string Link { get; set; } -} - -public class VerificationEmailModel -{ - public required string Name { get; set; } - public required string Code { get; set; } -} - -public class ContactVerificationEmailModel -{ - public required string Name { get; set; } - public required string Link { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Email/EmailService.cs b/DysonNetwork.Sphere/Email/EmailService.cs deleted file mode 100644 index f533e57..0000000 --- a/DysonNetwork.Sphere/Email/EmailService.cs +++ /dev/null @@ -1,106 +0,0 @@ -using MailKit.Net.Smtp; -using Microsoft.AspNetCore.Components; -using MimeKit; - -namespace DysonNetwork.Sphere.Email; - -public class EmailServiceConfiguration -{ - public string Server { get; set; } = null!; - public int Port { get; set; } - public bool UseSsl { get; set; } - public string Username { get; set; } = null!; - public string Password { get; set; } = null!; - public string FromAddress { get; set; } = null!; - public string FromName { get; set; } = null!; - public string SubjectPrefix { get; set; } = null!; -} - -public class EmailService -{ - private readonly EmailServiceConfiguration _configuration; - private readonly RazorViewRenderer _viewRenderer; - private readonly ILogger _logger; - - public EmailService(IConfiguration configuration, RazorViewRenderer viewRenderer, ILogger logger) - { - var cfg = configuration.GetSection("Email").Get(); - _configuration = cfg ?? throw new ArgumentException("Email service was not configured."); - _viewRenderer = viewRenderer; - _logger = logger; - } - - public async Task SendEmailAsync(string? recipientName, string recipientEmail, string subject, string textBody) - { - await SendEmailAsync(recipientName, recipientEmail, subject, textBody, null); - } - - public async Task SendEmailAsync(string? recipientName, string recipientEmail, string subject, string textBody, - string? htmlBody) - { - subject = $"[{_configuration.SubjectPrefix}] {subject}"; - - var emailMessage = new MimeMessage(); - emailMessage.From.Add(new MailboxAddress(_configuration.FromName, _configuration.FromAddress)); - emailMessage.To.Add(new MailboxAddress(recipientName, recipientEmail)); - emailMessage.Subject = subject; - - var bodyBuilder = new BodyBuilder - { - TextBody = textBody - }; - - if (!string.IsNullOrEmpty(htmlBody)) - bodyBuilder.HtmlBody = htmlBody; - - emailMessage.Body = bodyBuilder.ToMessageBody(); - - using var client = new SmtpClient(); - await client.ConnectAsync(_configuration.Server, _configuration.Port, _configuration.UseSsl); - await client.AuthenticateAsync(_configuration.Username, _configuration.Password); - await client.SendAsync(emailMessage); - await client.DisconnectAsync(true); - } - - private static string _ConvertHtmlToPlainText(string html) - { - // Remove style tags and their contents - html = System.Text.RegularExpressions.Regex.Replace(html, "]*>.*?", "", - System.Text.RegularExpressions.RegexOptions.Singleline); - - // Replace header tags with text + newlines - html = System.Text.RegularExpressions.Regex.Replace(html, "]*>(.*?)", "$1\n\n", - System.Text.RegularExpressions.RegexOptions.IgnoreCase); - - // Replace line breaks - html = html.Replace("
", "\n").Replace("
", "\n").Replace("
", "\n"); - - // Remove all remaining HTML tags - html = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]+>", ""); - - // Decode HTML entities - html = System.Net.WebUtility.HtmlDecode(html); - - // Remove excess whitespace - html = System.Text.RegularExpressions.Regex.Replace(html, @"\s+", " ").Trim(); - - return html; - } - - public async Task SendTemplatedEmailAsync(string? recipientName, string recipientEmail, - string subject, TModel model) - where TComponent : IComponent - { - try - { - var htmlBody = await _viewRenderer.RenderComponentToStringAsync(model); - var fallbackTextBody = _ConvertHtmlToPlainText(htmlBody); - await SendEmailAsync(recipientName, recipientEmail, subject, fallbackTextBody, htmlBody); - } - catch (Exception err) - { - _logger.LogError(err, "Failed to render email template..."); - throw; - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Email/RazorViewRenderer.cs b/DysonNetwork.Sphere/Email/RazorViewRenderer.cs deleted file mode 100644 index 72331f9..0000000 --- a/DysonNetwork.Sphere/Email/RazorViewRenderer.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Abstractions; -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.Razor; -using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.ViewEngines; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using RouteData = Microsoft.AspNetCore.Routing.RouteData; - -namespace DysonNetwork.Sphere.Email; - -public class RazorViewRenderer( - IServiceProvider serviceProvider, - ILoggerFactory loggerFactory, - ILogger logger -) -{ - public async Task RenderComponentToStringAsync(TModel? model) - where TComponent : IComponent - { - await using var htmlRenderer = new HtmlRenderer(serviceProvider, loggerFactory); - - return await htmlRenderer.Dispatcher.InvokeAsync(async () => - { - try - { - var dictionary = model?.GetType().GetProperties() - .ToDictionary( - prop => prop.Name, - prop => prop.GetValue(model, null) - ) ?? new Dictionary(); - var parameterView = ParameterView.FromDictionary(dictionary); - var output = await htmlRenderer.RenderComponentAsync(parameterView); - return output.ToHtmlString(); - } - catch (Exception ex) - { - logger.LogError(ex, "Error rendering component {ComponentName}", typeof(TComponent).Name); - throw; - } - }); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.Designer.cs b/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.Designer.cs deleted file mode 100644 index 9f0f5ba..0000000 --- a/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.Designer.cs +++ /dev/null @@ -1,3426 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250520160525_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_id"); - - b.HasIndex("DeviceToken") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("MessageId", "SenderId") - .HasName("pk_chat_read_receipts"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_read_receipts_sender_id"); - - b.HasIndex("MessageId", "SenderId") - .IsUnique() - .HasDatabaseName("ix_chat_read_receipts_message_id_sender_id"); - - b.ToTable("chat_read_receipts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Title") - .HasColumnType("text") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Statuses") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - - b.Navigation("Statuses"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.cs b/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.cs deleted file mode 100644 index 5b82f9a..0000000 --- a/DysonNetwork.Sphere/Migrations/20250520160525_InitialMigration.cs +++ /dev/null @@ -1,1992 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore.Migrations; -using NetTopologySuite.Geometries; -using NodaTime; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class InitialMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:PostgresExtension:postgis", ",,"); - - migrationBuilder.CreateTable( - name: "accounts", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - nick = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - language = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - activated_at = table.Column(type: "timestamp with time zone", nullable: true), - is_superuser = table.Column(type: "boolean", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_accounts", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "permission_groups", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - key = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_permission_groups", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "post_categories", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_post_categories", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "post_tags", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_post_tags", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "account_auth_factors", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "integer", nullable: false), - secret = table.Column(type: "character varying(8196)", maxLength: 8196, nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_account_auth_factors", x => x.id); - table.ForeignKey( - name: "fk_account_auth_factors_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "account_check_in_results", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - level = table.Column(type: "integer", nullable: false), - reward_points = table.Column(type: "numeric", nullable: true), - reward_experience = table.Column(type: "integer", nullable: true), - tips = table.Column>(type: "jsonb", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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( - name: "account_contacts", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "integer", nullable: false), - verified_at = table.Column(type: "timestamp with time zone", nullable: true), - content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_account_contacts", x => x.id); - table.ForeignKey( - name: "fk_account_contacts_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "account_relationships", - columns: table => new - { - account_id = table.Column(type: "uuid", nullable: false), - related_id = table.Column(type: "uuid", nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - status = table.Column(type: "integer", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_account_relationships", x => new { x.account_id, x.related_id }); - table.ForeignKey( - name: "fk_account_relationships_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_account_relationships_accounts_related_id", - column: x => x.related_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "account_statuses", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - attitude = table.Column(type: "integer", nullable: false), - is_invisible = table.Column(type: "boolean", nullable: false), - is_not_disturb = table.Column(type: "boolean", nullable: false), - label = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - cleared_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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( - name: "activities", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - resource_identifier = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - visibility = table.Column(type: "integer", nullable: false), - meta = table.Column>(type: "jsonb", nullable: false), - users_visible = table.Column>(type: "jsonb", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_activities", x => x.id); - table.ForeignKey( - name: "fk_activities_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "auth_challenges", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - step_remain = table.Column(type: "integer", nullable: false), - step_total = table.Column(type: "integer", nullable: false), - failed_attempts = table.Column(type: "integer", nullable: false), - platform = table.Column(type: "integer", nullable: false), - type = table.Column(type: "integer", nullable: false), - blacklist_factors = table.Column>(type: "jsonb", nullable: false), - audiences = table.Column>(type: "jsonb", nullable: false), - scopes = table.Column>(type: "jsonb", nullable: false), - ip_address = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - user_agent = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - device_id = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - nonce = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - location = table.Column(type: "geometry", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_auth_challenges", x => x.id); - table.ForeignKey( - name: "fk_auth_challenges_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "badges", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - label = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - caption = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - meta = table.Column>(type: "jsonb", nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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( - name: "magic_spells", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - spell = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - type = table.Column(type: "integer", nullable: false), - expires_at = table.Column(type: "timestamp with time zone", nullable: true), - affected_at = table.Column(type: "timestamp with time zone", nullable: true), - meta = table.Column>(type: "jsonb", nullable: false), - account_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_magic_spells", x => x.id); - table.ForeignKey( - name: "fk_magic_spells_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "notification_push_subscriptions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - device_id = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - device_token = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - provider = table.Column(type: "integer", nullable: false), - last_used_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_notification_push_subscriptions", x => x.id); - table.ForeignKey( - name: "fk_notification_push_subscriptions_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "notifications", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - topic = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - title = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - subtitle = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true), - content = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - meta = table.Column>(type: "jsonb", nullable: true), - priority = table.Column(type: "integer", nullable: false), - viewed_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_notifications", x => x.id); - table.ForeignKey( - name: "fk_notifications_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "wallets", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_wallets", x => x.id); - table.ForeignKey( - name: "fk_wallets_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "permission_group_members", - columns: table => new - { - group_id = table.Column(type: "uuid", nullable: false), - actor = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - affected_at = table.Column(type: "timestamp with time zone", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_permission_group_members", x => new { x.group_id, x.actor }); - table.ForeignKey( - name: "fk_permission_group_members_permission_groups_group_id", - column: x => x.group_id, - principalTable: "permission_groups", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "permission_nodes", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - actor = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - area = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - key = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - value = table.Column(type: "jsonb", nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - affected_at = table.Column(type: "timestamp with time zone", nullable: true), - group_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_permission_nodes", x => x.id); - table.ForeignKey( - name: "fk_permission_nodes_permission_groups_group_id", - column: x => x.group_id, - principalTable: "permission_groups", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "auth_sessions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - label = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - last_granted_at = table.Column(type: "timestamp with time zone", nullable: true), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - challenge_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_auth_sessions", x => x.id); - table.ForeignKey( - name: "fk_auth_sessions_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_auth_sessions_auth_challenges_challenge_id", - column: x => x.challenge_id, - principalTable: "auth_challenges", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "payment_transactions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - currency = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - amount = table.Column(type: "numeric", nullable: false), - remarks = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - type = table.Column(type: "integer", nullable: false), - payer_wallet_id = table.Column(type: "uuid", nullable: true), - payee_wallet_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_payment_transactions", x => x.id); - table.ForeignKey( - name: "fk_payment_transactions_wallets_payee_wallet_id", - column: x => x.payee_wallet_id, - principalTable: "wallets", - principalColumn: "id"); - table.ForeignKey( - name: "fk_payment_transactions_wallets_payer_wallet_id", - column: x => x.payer_wallet_id, - principalTable: "wallets", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "wallet_pockets", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - currency = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - amount = table.Column(type: "numeric", nullable: false), - wallet_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_wallet_pockets", x => x.id); - table.ForeignKey( - name: "fk_wallet_pockets_wallets_wallet_id", - column: x => x.wallet_id, - principalTable: "wallets", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "action_logs", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - action = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - meta = table.Column>(type: "jsonb", nullable: false), - user_agent = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), - ip_address = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - location = table.Column(type: "geometry", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - session_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_action_logs", x => x.id); - table.ForeignKey( - name: "fk_action_logs_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_action_logs_auth_sessions_session_id", - column: x => x.session_id, - principalTable: "auth_sessions", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "account_profiles", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - first_name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - middle_name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - last_name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - bio = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - experience = table.Column(type: "integer", nullable: false), - picture_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - background_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_account_profiles", x => x.id); - table.ForeignKey( - name: "fk_account_profiles_accounts_id", - column: x => x.id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "chat_members", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - chat_room_id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - nick = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - role = table.Column(type: "integer", nullable: false), - notify = table.Column(type: "integer", nullable: false), - joined_at = table.Column(type: "timestamp with time zone", nullable: true), - leave_at = table.Column(type: "timestamp with time zone", nullable: true), - is_bot = table.Column(type: "boolean", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_chat_members", x => x.id); - table.UniqueConstraint("ak_chat_members_chat_room_id_account_id", x => new { x.chat_room_id, x.account_id }); - table.ForeignKey( - name: "fk_chat_members_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "chat_messages", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "text", nullable: false), - content = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - meta = table.Column>(type: "jsonb", nullable: true), - members_mentioned = table.Column>(type: "jsonb", nullable: true), - nonce = table.Column(type: "character varying(36)", maxLength: 36, nullable: false), - edited_at = table.Column(type: "timestamp with time zone", nullable: true), - replied_message_id = table.Column(type: "uuid", nullable: true), - forwarded_message_id = table.Column(type: "uuid", nullable: true), - sender_id = table.Column(type: "uuid", nullable: false), - chat_room_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_chat_messages", x => x.id); - table.ForeignKey( - name: "fk_chat_messages_chat_members_sender_id", - column: x => x.sender_id, - principalTable: "chat_members", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_chat_messages_chat_messages_forwarded_message_id", - column: x => x.forwarded_message_id, - principalTable: "chat_messages", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_chat_messages_chat_messages_replied_message_id", - column: x => x.replied_message_id, - principalTable: "chat_messages", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "chat_reactions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - message_id = table.Column(type: "uuid", nullable: false), - sender_id = table.Column(type: "uuid", nullable: false), - symbol = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - attitude = table.Column(type: "integer", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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( - name: "chat_read_receipts", - columns: table => new - { - message_id = table.Column(type: "uuid", nullable: false), - sender_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_chat_read_receipts", x => new { x.message_id, x.sender_id }); - table.ForeignKey( - name: "fk_chat_read_receipts_chat_members_sender_id", - column: x => x.sender_id, - principalTable: "chat_members", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_chat_read_receipts_chat_messages_message_id", - column: x => x.message_id, - principalTable: "chat_messages", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "chat_realtime_call", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - title = table.Column(type: "text", nullable: true), - ended_at = table.Column(type: "timestamp with time zone", nullable: true), - sender_id = table.Column(type: "uuid", nullable: false), - room_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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); - }); - - migrationBuilder.CreateTable( - name: "chat_rooms", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - type = table.Column(type: "integer", nullable: false), - is_community = table.Column(type: "boolean", nullable: false), - is_public = table.Column(type: "boolean", nullable: false), - picture_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - background_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - realm_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_chat_rooms", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "custom_app_secrets", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - secret = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - remarks = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - app_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_custom_app_secrets", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "custom_apps", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - status = table.Column(type: "integer", nullable: false), - verified_at = table.Column(type: "timestamp with time zone", nullable: true), - verified_as = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_custom_apps", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "payment_orders", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - status = table.Column(type: "integer", nullable: false), - currency = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - remarks = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - amount = table.Column(type: "numeric", nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: false), - payee_wallet_id = table.Column(type: "uuid", nullable: false), - transaction_id = table.Column(type: "uuid", nullable: true), - issuer_app_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_payment_orders", x => x.id); - table.ForeignKey( - name: "fk_payment_orders_custom_apps_issuer_app_id", - column: x => x.issuer_app_id, - principalTable: "custom_apps", - principalColumn: "id"); - table.ForeignKey( - name: "fk_payment_orders_payment_transactions_transaction_id", - column: x => x.transaction_id, - principalTable: "payment_transactions", - principalColumn: "id"); - table.ForeignKey( - name: "fk_payment_orders_wallets_payee_wallet_id", - column: x => x.payee_wallet_id, - principalTable: "wallets", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "files", - columns: table => new - { - id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - file_meta = table.Column>(type: "jsonb", nullable: true), - user_meta = table.Column>(type: "jsonb", nullable: true), - sensitive_marks = table.Column>(type: "jsonb", nullable: true), - mime_type = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - hash = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - size = table.Column(type: "bigint", nullable: false), - uploaded_at = table.Column(type: "timestamp with time zone", nullable: true), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - uploaded_to = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - has_compression = table.Column(type: "boolean", nullable: false), - storage_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - storage_url = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - used_count = table.Column(type: "integer", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - message_id = table.Column(type: "uuid", nullable: true), - post_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_files", x => x.id); - table.ForeignKey( - name: "fk_files_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_files_chat_messages_message_id", - column: x => x.message_id, - principalTable: "chat_messages", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "realms", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - verified_as = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - verified_at = table.Column(type: "timestamp with time zone", nullable: true), - is_community = table.Column(type: "boolean", nullable: false), - is_public = table.Column(type: "boolean", nullable: false), - picture_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - background_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_realms", x => x.id); - table.ForeignKey( - name: "fk_realms_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_realms_files_background_id", - column: x => x.background_id, - principalTable: "files", - principalColumn: "id"); - table.ForeignKey( - name: "fk_realms_files_picture_id", - column: x => x.picture_id, - principalTable: "files", - principalColumn: "id"); - }); - - migrationBuilder.CreateTable( - name: "publishers", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - type = table.Column(type: "integer", nullable: false), - name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - nick = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - bio = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - picture_id = table.Column(type: "character varying(32)", nullable: true), - background_id = table.Column(type: "character varying(32)", nullable: true), - account_id = table.Column(type: "uuid", nullable: true), - realm_id = table.Column(type: "uuid", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - role = table.Column(type: "integer", nullable: false), - joined_at = table.Column(type: "timestamp with time zone", nullable: true), - leave_at = table.Column(type: "timestamp with time zone", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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( - name: "post_collections", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_post_collections", x => x.id); - table.ForeignKey( - name: "fk_post_collections_publishers_publisher_id", - column: x => x.publisher_id, - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "posts", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - title = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - language = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), - edited_at = table.Column(type: "timestamp with time zone", nullable: true), - published_at = table.Column(type: "timestamp with time zone", nullable: true), - visibility = table.Column(type: "integer", nullable: false), - content = table.Column(type: "text", nullable: true), - type = table.Column(type: "integer", nullable: false), - meta = table.Column>(type: "jsonb", nullable: true), - views_unique = table.Column(type: "integer", nullable: false), - views_total = table.Column(type: "integer", nullable: false), - upvotes = table.Column(type: "integer", nullable: false), - downvotes = table.Column(type: "integer", nullable: false), - threaded_post_id = table.Column(type: "uuid", nullable: true), - replied_post_id = table.Column(type: "uuid", nullable: true), - forwarded_post_id = table.Column(type: "uuid", nullable: true), - search_vector = table.Column(type: "tsvector", nullable: false) - .Annotation("Npgsql:TsVectorConfig", "simple") - .Annotation("Npgsql:TsVectorProperties", new[] { "title", "description", "content" }), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_posts", x => x.id); - table.ForeignKey( - name: "fk_posts_posts_forwarded_post_id", - column: x => x.forwarded_post_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_posts_posts_replied_post_id", - column: x => x.replied_post_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_posts_posts_threaded_post_id", - column: x => x.threaded_post_id, - principalTable: "posts", - principalColumn: "id"); - table.ForeignKey( - name: "fk_posts_publishers_publisher_id", - column: x => x.publisher_id, - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "publisher_features", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - flag = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_publisher_features", x => x.id); - table.ForeignKey( - name: "fk_publisher_features_publishers_publisher_id", - column: x => x.publisher_id, - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "publisher_members", - columns: table => new - { - publisher_id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - role = table.Column(type: "integer", nullable: false), - joined_at = table.Column(type: "timestamp with time zone", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_publisher_members", x => new { x.publisher_id, x.account_id }); - table.ForeignKey( - name: "fk_publisher_members_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_publisher_members_publishers_publisher_id", - column: x => x.publisher_id, - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "publisher_subscriptions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - publisher_id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - status = table.Column(type: "integer", nullable: false), - tier = table.Column(type: "integer", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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.CreateTable( - name: "sticker_packs", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - prefix = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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: "post_category_links", - columns: table => new - { - categories_id = table.Column(type: "uuid", nullable: false), - posts_id = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_post_category_links", x => new { x.categories_id, x.posts_id }); - table.ForeignKey( - name: "fk_post_category_links_post_categories_categories_id", - column: x => x.categories_id, - principalTable: "post_categories", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_post_category_links_posts_posts_id", - column: x => x.posts_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "post_collection_links", - columns: table => new - { - collections_id = table.Column(type: "uuid", nullable: false), - posts_id = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_post_collection_links", x => new { x.collections_id, x.posts_id }); - table.ForeignKey( - name: "fk_post_collection_links_post_collections_collections_id", - column: x => x.collections_id, - principalTable: "post_collections", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_post_collection_links_posts_posts_id", - column: x => x.posts_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "post_reactions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - symbol = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), - attitude = table.Column(type: "integer", nullable: false), - post_id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_post_reactions", x => x.id); - table.ForeignKey( - name: "fk_post_reactions_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_post_reactions_posts_post_id", - column: x => x.post_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "post_tag_links", - columns: table => new - { - posts_id = table.Column(type: "uuid", nullable: false), - tags_id = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_post_tag_links", x => new { x.posts_id, x.tags_id }); - table.ForeignKey( - name: "fk_post_tag_links_post_tags_tags_id", - column: x => x.tags_id, - principalTable: "post_tags", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_post_tag_links_posts_posts_id", - column: x => x.posts_id, - principalTable: "posts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "stickers", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), - image_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - pack_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(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_account_auth_factors_account_id", - table: "account_auth_factors", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_check_in_results_account_id", - table: "account_check_in_results", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_contacts_account_id", - table: "account_contacts", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_profiles_background_id", - table: "account_profiles", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_profiles_picture_id", - table: "account_profiles", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_relationships_related_id", - table: "account_relationships", - column: "related_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_statuses_account_id", - table: "account_statuses", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_accounts_name", - table: "accounts", - column: "name", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_action_logs_account_id", - table: "action_logs", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_action_logs_session_id", - table: "action_logs", - column: "session_id"); - - migrationBuilder.CreateIndex( - name: "ix_activities_account_id", - table: "activities", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_auth_challenges_account_id", - table: "auth_challenges", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_auth_sessions_account_id", - table: "auth_sessions", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_auth_sessions_challenge_id", - table: "auth_sessions", - column: "challenge_id"); - - migrationBuilder.CreateIndex( - name: "ix_badges_account_id", - table: "badges", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_members_account_id", - table: "chat_members", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_messages_chat_room_id", - table: "chat_messages", - column: "chat_room_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_messages_forwarded_message_id", - table: "chat_messages", - column: "forwarded_message_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_messages_replied_message_id", - table: "chat_messages", - column: "replied_message_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_messages_sender_id", - table: "chat_messages", - 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_read_receipts_message_id_sender_id", - table: "chat_read_receipts", - columns: new[] { "message_id", "sender_id" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_chat_read_receipts_sender_id", - table: "chat_read_receipts", - 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( - name: "ix_chat_rooms_background_id", - table: "chat_rooms", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_rooms_picture_id", - table: "chat_rooms", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_rooms_realm_id", - table: "chat_rooms", - column: "realm_id"); - - migrationBuilder.CreateIndex( - name: "ix_custom_app_secrets_app_id", - table: "custom_app_secrets", - column: "app_id"); - - migrationBuilder.CreateIndex( - name: "ix_custom_apps_publisher_id", - table: "custom_apps", - column: "publisher_id"); - - migrationBuilder.CreateIndex( - name: "ix_files_account_id", - table: "files", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_files_message_id", - table: "files", - column: "message_id"); - - migrationBuilder.CreateIndex( - name: "ix_files_post_id", - table: "files", - column: "post_id"); - - migrationBuilder.CreateIndex( - name: "ix_magic_spells_account_id", - table: "magic_spells", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_magic_spells_spell", - table: "magic_spells", - column: "spell", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_account_id", - table: "notification_push_subscriptions", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_id", - table: "notification_push_subscriptions", - column: "device_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_token", - table: "notification_push_subscriptions", - column: "device_token", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_notifications_account_id", - table: "notifications", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_payment_orders_issuer_app_id", - table: "payment_orders", - column: "issuer_app_id"); - - migrationBuilder.CreateIndex( - name: "ix_payment_orders_payee_wallet_id", - table: "payment_orders", - column: "payee_wallet_id"); - - migrationBuilder.CreateIndex( - name: "ix_payment_orders_transaction_id", - table: "payment_orders", - column: "transaction_id"); - - migrationBuilder.CreateIndex( - name: "ix_payment_transactions_payee_wallet_id", - table: "payment_transactions", - column: "payee_wallet_id"); - - migrationBuilder.CreateIndex( - name: "ix_payment_transactions_payer_wallet_id", - table: "payment_transactions", - column: "payer_wallet_id"); - - migrationBuilder.CreateIndex( - name: "ix_permission_nodes_group_id", - table: "permission_nodes", - column: "group_id"); - - migrationBuilder.CreateIndex( - name: "ix_permission_nodes_key_area_actor", - table: "permission_nodes", - columns: new[] { "key", "area", "actor" }); - - migrationBuilder.CreateIndex( - name: "ix_post_category_links_posts_id", - table: "post_category_links", - column: "posts_id"); - - migrationBuilder.CreateIndex( - name: "ix_post_collection_links_posts_id", - table: "post_collection_links", - column: "posts_id"); - - migrationBuilder.CreateIndex( - name: "ix_post_collections_publisher_id", - table: "post_collections", - column: "publisher_id"); - - migrationBuilder.CreateIndex( - name: "ix_post_reactions_account_id", - table: "post_reactions", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_post_reactions_post_id", - table: "post_reactions", - column: "post_id"); - - migrationBuilder.CreateIndex( - name: "ix_post_tag_links_tags_id", - table: "post_tag_links", - column: "tags_id"); - - migrationBuilder.CreateIndex( - name: "ix_posts_forwarded_post_id", - table: "posts", - column: "forwarded_post_id"); - - migrationBuilder.CreateIndex( - name: "ix_posts_publisher_id", - table: "posts", - column: "publisher_id"); - - migrationBuilder.CreateIndex( - name: "ix_posts_replied_post_id", - table: "posts", - column: "replied_post_id"); - - migrationBuilder.CreateIndex( - name: "ix_posts_search_vector", - table: "posts", - column: "search_vector") - .Annotation("Npgsql:IndexMethod", "GIN"); - - migrationBuilder.CreateIndex( - name: "ix_posts_threaded_post_id", - table: "posts", - column: "threaded_post_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_publisher_features_publisher_id", - table: "publisher_features", - column: "publisher_id"); - - migrationBuilder.CreateIndex( - name: "ix_publisher_members_account_id", - table: "publisher_members", - 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( - name: "ix_publishers_account_id", - table: "publishers", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_publishers_background_id", - table: "publishers", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_publishers_name", - table: "publishers", - column: "name", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_publishers_picture_id", - table: "publishers", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_publishers_realm_id", - table: "publishers", - column: "realm_id"); - - migrationBuilder.CreateIndex( - name: "ix_realm_members_account_id", - table: "realm_members", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_account_id", - table: "realms", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_background_id", - table: "realms", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_picture_id", - table: "realms", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_slug", - table: "realms", - column: "slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_sticker_packs_prefix", - table: "sticker_packs", - column: "prefix", - 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.CreateIndex( - name: "ix_stickers_slug", - table: "stickers", - column: "slug"); - - migrationBuilder.CreateIndex( - name: "ix_wallet_pockets_wallet_id", - table: "wallet_pockets", - column: "wallet_id"); - - migrationBuilder.CreateIndex( - name: "ix_wallets_account_id", - table: "wallets", - column: "account_id"); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_files_background_id", - table: "account_profiles", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_files_picture_id", - table: "account_profiles", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_chat_members_chat_rooms_chat_room_id", - table: "chat_members", - column: "chat_room_id", - principalTable: "chat_rooms", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_chat_messages_chat_rooms_chat_room_id", - table: "chat_messages", - column: "chat_room_id", - principalTable: "chat_rooms", - principalColumn: "id", - 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( - name: "fk_chat_rooms_files_background_id", - table: "chat_rooms", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_chat_rooms_files_picture_id", - table: "chat_rooms", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_chat_rooms_realms_realm_id", - table: "chat_rooms", - column: "realm_id", - principalTable: "realms", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_custom_app_secrets_custom_apps_app_id", - table: "custom_app_secrets", - column: "app_id", - principalTable: "custom_apps", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_custom_apps_publishers_publisher_id", - table: "custom_apps", - column: "publisher_id", - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "fk_files_posts_post_id", - table: "files", - column: "post_id", - principalTable: "posts", - principalColumn: "id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_chat_members_accounts_account_id", - table: "chat_members"); - - migrationBuilder.DropForeignKey( - name: "fk_files_accounts_account_id", - table: "files"); - - migrationBuilder.DropForeignKey( - name: "fk_publishers_accounts_account_id", - table: "publishers"); - - migrationBuilder.DropForeignKey( - name: "fk_realms_accounts_account_id", - table: "realms"); - - migrationBuilder.DropForeignKey( - name: "fk_chat_rooms_files_background_id", - table: "chat_rooms"); - - migrationBuilder.DropForeignKey( - name: "fk_chat_rooms_files_picture_id", - table: "chat_rooms"); - - migrationBuilder.DropForeignKey( - name: "fk_publishers_files_background_id", - table: "publishers"); - - migrationBuilder.DropForeignKey( - name: "fk_publishers_files_picture_id", - table: "publishers"); - - migrationBuilder.DropForeignKey( - name: "fk_realms_files_background_id", - table: "realms"); - - migrationBuilder.DropForeignKey( - name: "fk_realms_files_picture_id", - table: "realms"); - - migrationBuilder.DropTable( - name: "account_auth_factors"); - - migrationBuilder.DropTable( - name: "account_check_in_results"); - - migrationBuilder.DropTable( - name: "account_contacts"); - - migrationBuilder.DropTable( - name: "account_profiles"); - - migrationBuilder.DropTable( - name: "account_relationships"); - - migrationBuilder.DropTable( - name: "account_statuses"); - - migrationBuilder.DropTable( - name: "action_logs"); - - migrationBuilder.DropTable( - name: "activities"); - - migrationBuilder.DropTable( - name: "badges"); - - migrationBuilder.DropTable( - name: "chat_reactions"); - - migrationBuilder.DropTable( - name: "chat_read_receipts"); - - migrationBuilder.DropTable( - name: "chat_realtime_call"); - - migrationBuilder.DropTable( - name: "custom_app_secrets"); - - migrationBuilder.DropTable( - name: "magic_spells"); - - migrationBuilder.DropTable( - name: "notification_push_subscriptions"); - - migrationBuilder.DropTable( - name: "notifications"); - - migrationBuilder.DropTable( - name: "payment_orders"); - - migrationBuilder.DropTable( - name: "permission_group_members"); - - migrationBuilder.DropTable( - name: "permission_nodes"); - - migrationBuilder.DropTable( - name: "post_category_links"); - - migrationBuilder.DropTable( - name: "post_collection_links"); - - migrationBuilder.DropTable( - name: "post_reactions"); - - migrationBuilder.DropTable( - name: "post_tag_links"); - - migrationBuilder.DropTable( - name: "publisher_features"); - - migrationBuilder.DropTable( - name: "publisher_members"); - - migrationBuilder.DropTable( - name: "publisher_subscriptions"); - - migrationBuilder.DropTable( - name: "realm_members"); - - migrationBuilder.DropTable( - name: "stickers"); - - migrationBuilder.DropTable( - name: "wallet_pockets"); - - migrationBuilder.DropTable( - name: "auth_sessions"); - - migrationBuilder.DropTable( - name: "custom_apps"); - - migrationBuilder.DropTable( - name: "payment_transactions"); - - migrationBuilder.DropTable( - name: "permission_groups"); - - migrationBuilder.DropTable( - name: "post_categories"); - - migrationBuilder.DropTable( - name: "post_collections"); - - migrationBuilder.DropTable( - name: "post_tags"); - - migrationBuilder.DropTable( - name: "sticker_packs"); - - migrationBuilder.DropTable( - name: "auth_challenges"); - - migrationBuilder.DropTable( - name: "wallets"); - - migrationBuilder.DropTable( - name: "accounts"); - - migrationBuilder.DropTable( - name: "files"); - - migrationBuilder.DropTable( - name: "chat_messages"); - - migrationBuilder.DropTable( - name: "posts"); - - migrationBuilder.DropTable( - name: "chat_members"); - - migrationBuilder.DropTable( - name: "publishers"); - - migrationBuilder.DropTable( - name: "chat_rooms"); - - migrationBuilder.DropTable( - name: "realms"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.Designer.cs b/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.Designer.cs deleted file mode 100644 index 19f36e5..0000000 --- a/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.Designer.cs +++ /dev/null @@ -1,3444 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250521142845_EnrichAccountProfile")] - partial class EnrichAccountProfile - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_id"); - - b.HasIndex("DeviceToken") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("MessageId", "SenderId") - .HasName("pk_chat_read_receipts"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_read_receipts_sender_id"); - - b.HasIndex("MessageId", "SenderId") - .IsUnique() - .HasDatabaseName("ix_chat_read_receipts_message_id_sender_id"); - - b.ToTable("chat_read_receipts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Title") - .HasColumnType("text") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Statuses") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - - b.Navigation("Statuses"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.cs b/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.cs deleted file mode 100644 index 207965b..0000000 --- a/DysonNetwork.Sphere/Migrations/20250521142845_EnrichAccountProfile.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class EnrichAccountProfile : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "birthday", - table: "account_profiles", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "gender", - table: "account_profiles", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.AddColumn( - name: "last_seen_at", - table: "account_profiles", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "pronouns", - table: "account_profiles", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "birthday", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "gender", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "last_seen_at", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "pronouns", - table: "account_profiles"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.Designer.cs b/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.Designer.cs deleted file mode 100644 index 3ca5e4d..0000000 --- a/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.Designer.cs +++ /dev/null @@ -1,3449 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250521181143_FixProfileRelationship")] - partial class FixProfileRelationship - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_id"); - - b.HasIndex("DeviceToken") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("MessageId", "SenderId") - .HasName("pk_chat_read_receipts"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_read_receipts_sender_id"); - - b.HasIndex("MessageId", "SenderId") - .IsUnique() - .HasDatabaseName("ix_chat_read_receipts_message_id_sender_id"); - - b.ToTable("chat_read_receipts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Title") - .HasColumnType("text") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReadReceipt", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Statuses") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_read_receipts_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - - b.Navigation("Statuses"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.cs b/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.cs deleted file mode 100644 index 5a8d814..0000000 --- a/DysonNetwork.Sphere/Migrations/20250521181143_FixProfileRelationship.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class FixProfileRelationship : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_account_profiles_accounts_id", - table: "account_profiles"); - - migrationBuilder.CreateIndex( - name: "ix_account_profiles_account_id", - table: "account_profiles", - column: "account_id", - unique: true); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_accounts_account_id", - table: "account_profiles", - column: "account_id", - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_account_profiles_accounts_account_id", - table: "account_profiles"); - - migrationBuilder.DropIndex( - name: "ix_account_profiles_account_id", - table: "account_profiles"); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_accounts_id", - table: "account_profiles", - column: "id", - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.Designer.cs b/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.Designer.cs deleted file mode 100644 index fe36868..0000000 --- a/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.Designer.cs +++ /dev/null @@ -1,3396 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250523172951_RefactorChatLastRead")] - partial class RefactorChatLastRead - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_id"); - - b.HasIndex("DeviceToken") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Title") - .HasColumnType("text") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.cs b/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.cs deleted file mode 100644 index c3e5fda..0000000 --- a/DysonNetwork.Sphere/Migrations/20250523172951_RefactorChatLastRead.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class RefactorChatLastRead : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "chat_read_receipts"); - - migrationBuilder.AlterColumn( - name: "type", - table: "chat_messages", - type: "character varying(1024)", - maxLength: 1024, - nullable: false, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AddColumn( - name: "last_read_at", - table: "chat_members", - type: "timestamp with time zone", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "last_read_at", - table: "chat_members"); - - migrationBuilder.AlterColumn( - name: "type", - table: "chat_messages", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1024)", - oldMaxLength: 1024); - - migrationBuilder.CreateTable( - name: "chat_read_receipts", - columns: table => new - { - message_id = table.Column(type: "uuid", nullable: false), - sender_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true), - updated_at = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_chat_read_receipts", x => new { x.message_id, x.sender_id }); - table.ForeignKey( - name: "fk_chat_read_receipts_chat_members_sender_id", - column: x => x.sender_id, - principalTable: "chat_members", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_chat_read_receipts_chat_messages_message_id", - column: x => x.message_id, - principalTable: "chat_messages", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_chat_read_receipts_message_id_sender_id", - table: "chat_read_receipts", - columns: new[] { "message_id", "sender_id" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_chat_read_receipts_sender_id", - table: "chat_read_receipts", - column: "sender_id"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.Designer.cs b/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.Designer.cs deleted file mode 100644 index c758b4f..0000000 --- a/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.Designer.cs +++ /dev/null @@ -1,3400 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250524215045_UpdateRealtimeChat")] - partial class UpdateRealtimeChat - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.cs b/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.cs deleted file mode 100644 index 27d5a3e..0000000 --- a/DysonNetwork.Sphere/Migrations/20250524215045_UpdateRealtimeChat.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class UpdateRealtimeChat : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "ix_notification_push_subscriptions_device_id", - table: "notification_push_subscriptions"); - - migrationBuilder.DropIndex( - name: "ix_notification_push_subscriptions_device_token", - table: "notification_push_subscriptions"); - - migrationBuilder.RenameColumn( - name: "title", - table: "chat_realtime_call", - newName: "session_id"); - - migrationBuilder.AddColumn( - name: "provider_name", - table: "chat_realtime_call", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "upstream", - table: "chat_realtime_call", - type: "jsonb", - nullable: true); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_token_device_id", - table: "notification_push_subscriptions", - columns: new[] { "device_token", "device_id" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "ix_notification_push_subscriptions_device_token_device_id", - table: "notification_push_subscriptions"); - - migrationBuilder.DropColumn( - name: "provider_name", - table: "chat_realtime_call"); - - migrationBuilder.DropColumn( - name: "upstream", - table: "chat_realtime_call"); - - migrationBuilder.RenameColumn( - name: "session_id", - table: "chat_realtime_call", - newName: "title"); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_id", - table: "notification_push_subscriptions", - column: "device_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_token", - table: "notification_push_subscriptions", - column: "device_token", - unique: true); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.Designer.cs b/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.Designer.cs deleted file mode 100644 index 9192fe8..0000000 --- a/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.Designer.cs +++ /dev/null @@ -1,3400 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250525083412_ModifyRelationshipStatusType")] - partial class ModifyRelationshipStatusType - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.cs b/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.cs deleted file mode 100644 index 18cc8b4..0000000 --- a/DysonNetwork.Sphere/Migrations/20250525083412_ModifyRelationshipStatusType.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class ModifyRelationshipStatusType : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "status", - table: "account_relationships", - type: "smallint", - nullable: false, - oldClrType: typeof(int), - oldType: "integer"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "status", - table: "account_relationships", - type: "integer", - nullable: false, - oldClrType: typeof(short), - oldType: "smallint"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.Designer.cs b/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.Designer.cs deleted file mode 100644 index fd69a6e..0000000 --- a/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.Designer.cs +++ /dev/null @@ -1,3402 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250527144902_LimitedSizeForPictureIdOnPub")] - partial class LimitedSizeForPictureIdOnPub - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.cs b/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.cs deleted file mode 100644 index 3f85ea3..0000000 --- a/DysonNetwork.Sphere/Migrations/20250527144902_LimitedSizeForPictureIdOnPub.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class LimitedSizeForPictureIdOnPub : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.Designer.cs b/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.Designer.cs deleted file mode 100644 index 3ced012..0000000 --- a/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.Designer.cs +++ /dev/null @@ -1,3407 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250528171935_AddCloudFileUsage")] - partial class AddCloudFileUsage - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_account_profiles_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_account_profiles_picture_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_chat_rooms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_chat_rooms_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("ThreadedPostId") - .HasColumnType("uuid") - .HasColumnName("threaded_post_id"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.HasIndex("ThreadedPostId") - .IsUnique() - .HasDatabaseName("ix_posts_threaded_post_id"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_publishers_background_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_publishers_picture_id"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("BackgroundId") - .HasDatabaseName("ix_realms_background_id"); - - b.HasIndex("PictureId") - .HasDatabaseName("ix_realms_picture_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ImageId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("ImageId") - .HasDatabaseName("ix_stickers_image_id"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property("Usage") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.Property("UsedCount") - .HasColumnType("integer") - .HasColumnName("used_count"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_account_profiles_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_account_profiles_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_chat_rooms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_chat_rooms_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "ThreadedPost") - .WithOne() - .HasForeignKey("DysonNetwork.Sphere.Post.Post", "ThreadedPostId") - .HasConstraintName("fk_posts_posts_threaded_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - - b.Navigation("ThreadedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_publishers_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_publishers_files_picture_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Background") - .WithMany() - .HasForeignKey("BackgroundId") - .HasConstraintName("fk_realms_files_background_id"); - - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Picture") - .WithMany() - .HasForeignKey("PictureId") - .HasConstraintName("fk_realms_files_picture_id"); - - b.Navigation("Account"); - - b.Navigation("Background"); - - b.Navigation("Picture"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "Image") - .WithMany() - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_files_image_id"); - - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Image"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("Attachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("Attachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("Attachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.cs b/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.cs deleted file mode 100644 index 6c57900..0000000 --- a/DysonNetwork.Sphere/Migrations/20250528171935_AddCloudFileUsage.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class AddCloudFileUsage : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "usage", - table: "files", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "usage", - table: "files"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.Designer.cs b/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.Designer.cs deleted file mode 100644 index 156a99d..0000000 --- a/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.Designer.cs +++ /dev/null @@ -1,3394 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250601142048_RefactorCloudFileReference")] - partial class RefactorCloudFileReference - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.cs b/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.cs deleted file mode 100644 index 1be30f6..0000000 --- a/DysonNetwork.Sphere/Migrations/20250601142048_RefactorCloudFileReference.cs +++ /dev/null @@ -1,436 +0,0 @@ -using System; -using System.Collections.Generic; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class RefactorCloudFileReference : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_account_profiles_files_background_id", - table: "account_profiles"); - - migrationBuilder.DropForeignKey( - name: "fk_account_profiles_files_picture_id", - table: "account_profiles"); - - migrationBuilder.DropForeignKey( - name: "fk_chat_rooms_files_background_id", - table: "chat_rooms"); - - migrationBuilder.DropForeignKey( - name: "fk_chat_rooms_files_picture_id", - table: "chat_rooms"); - - migrationBuilder.DropForeignKey( - name: "fk_posts_posts_threaded_post_id", - table: "posts"); - - migrationBuilder.DropForeignKey( - name: "fk_publishers_files_background_id", - table: "publishers"); - - migrationBuilder.DropForeignKey( - name: "fk_publishers_files_picture_id", - table: "publishers"); - - migrationBuilder.DropForeignKey( - name: "fk_realms_files_background_id", - table: "realms"); - - migrationBuilder.DropForeignKey( - name: "fk_realms_files_picture_id", - table: "realms"); - - migrationBuilder.DropForeignKey( - name: "fk_stickers_files_image_id", - table: "stickers"); - - migrationBuilder.DropIndex( - name: "ix_stickers_image_id", - table: "stickers"); - - migrationBuilder.DropIndex( - name: "ix_realms_background_id", - table: "realms"); - - migrationBuilder.DropIndex( - name: "ix_realms_picture_id", - table: "realms"); - - migrationBuilder.DropIndex( - name: "ix_publishers_background_id", - table: "publishers"); - - migrationBuilder.DropIndex( - name: "ix_publishers_picture_id", - table: "publishers"); - - migrationBuilder.DropIndex( - name: "ix_posts_threaded_post_id", - table: "posts"); - - migrationBuilder.DropIndex( - name: "ix_chat_rooms_background_id", - table: "chat_rooms"); - - migrationBuilder.DropIndex( - name: "ix_chat_rooms_picture_id", - table: "chat_rooms"); - - migrationBuilder.DropIndex( - name: "ix_account_profiles_background_id", - table: "account_profiles"); - - migrationBuilder.DropIndex( - name: "ix_account_profiles_picture_id", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "threaded_post_id", - table: "posts"); - - migrationBuilder.DropColumn( - name: "expired_at", - table: "files"); - - migrationBuilder.DropColumn( - name: "usage", - table: "files"); - - migrationBuilder.DropColumn( - name: "used_count", - table: "files"); - - migrationBuilder.AlterColumn( - name: "image_id", - table: "stickers", - type: "character varying(32)", - maxLength: 32, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32); - - migrationBuilder.AddColumn( - name: "image", - table: "stickers", - type: "jsonb", - nullable: true, - defaultValueSql: "'[]'::jsonb" - ); - - migrationBuilder.AddColumn( - name: "background", - table: "realms", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "picture", - table: "realms", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "background", - table: "publishers", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "picture", - table: "publishers", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn>( - name: "attachments", - table: "posts", - type: "jsonb", - nullable: false, - defaultValueSql: "'[]'::jsonb" - ); - - migrationBuilder.AddColumn( - name: "background", - table: "chat_rooms", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "picture", - table: "chat_rooms", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn>( - name: "attachments", - table: "chat_messages", - type: "jsonb", - nullable: false, - defaultValueSql: "'[]'::jsonb" - ); - - migrationBuilder.AddColumn( - name: "background", - table: "account_profiles", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "picture", - table: "account_profiles", - type: "jsonb", - nullable: true); - - migrationBuilder.CreateTable( - name: "file_references", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - file_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), - usage = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - resource_id = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_file_references", x => x.id); - table.ForeignKey( - name: "fk_file_references_files_file_id", - column: x => x.file_id, - principalTable: "files", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_file_references_file_id", - table: "file_references", - column: "file_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "file_references"); - - migrationBuilder.DropColumn( - name: "image", - table: "stickers"); - - migrationBuilder.DropColumn( - name: "background", - table: "realms"); - - migrationBuilder.DropColumn( - name: "picture", - table: "realms"); - - migrationBuilder.DropColumn( - name: "background", - table: "publishers"); - - migrationBuilder.DropColumn( - name: "picture", - table: "publishers"); - - migrationBuilder.DropColumn( - name: "attachments", - table: "posts"); - - migrationBuilder.DropColumn( - name: "background", - table: "chat_rooms"); - - migrationBuilder.DropColumn( - name: "picture", - table: "chat_rooms"); - - migrationBuilder.DropColumn( - name: "attachments", - table: "chat_messages"); - - migrationBuilder.DropColumn( - name: "background", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "picture", - table: "account_profiles"); - - migrationBuilder.AlterColumn( - name: "image_id", - table: "stickers", - type: "character varying(32)", - maxLength: 32, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(32)", - oldMaxLength: 32, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "threaded_post_id", - table: "posts", - type: "uuid", - nullable: true); - - migrationBuilder.AddColumn( - name: "expired_at", - table: "files", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "usage", - table: "files", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.AddColumn( - name: "used_count", - table: "files", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateIndex( - name: "ix_stickers_image_id", - table: "stickers", - column: "image_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_background_id", - table: "realms", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_realms_picture_id", - table: "realms", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_publishers_background_id", - table: "publishers", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_publishers_picture_id", - table: "publishers", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_posts_threaded_post_id", - table: "posts", - column: "threaded_post_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_chat_rooms_background_id", - table: "chat_rooms", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_chat_rooms_picture_id", - table: "chat_rooms", - column: "picture_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_profiles_background_id", - table: "account_profiles", - column: "background_id"); - - migrationBuilder.CreateIndex( - name: "ix_account_profiles_picture_id", - table: "account_profiles", - column: "picture_id"); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_files_background_id", - table: "account_profiles", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_account_profiles_files_picture_id", - table: "account_profiles", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_chat_rooms_files_background_id", - table: "chat_rooms", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_chat_rooms_files_picture_id", - table: "chat_rooms", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_posts_posts_threaded_post_id", - table: "posts", - column: "threaded_post_id", - principalTable: "posts", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_publishers_files_background_id", - table: "publishers", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_publishers_files_picture_id", - table: "publishers", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_realms_files_background_id", - table: "realms", - column: "background_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_realms_files_picture_id", - table: "realms", - column: "picture_id", - principalTable: "files", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_stickers_files_image_id", - table: "stickers", - column: "image_id", - principalTable: "files", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.Designer.cs b/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.Designer.cs deleted file mode 100644 index c90f7a8..0000000 --- a/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.Designer.cs +++ /dev/null @@ -1,3394 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250602144445_FixPushNotificationIndex")] - partial class FixPushNotificationIndex - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.cs b/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.cs deleted file mode 100644 index bcfa0d9..0000000 --- a/DysonNetwork.Sphere/Migrations/20250602144445_FixPushNotificationIndex.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class FixPushNotificationIndex : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "ix_notification_push_subscriptions_device_token_device_id", - table: "notification_push_subscriptions"); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_token_device_id_acco", - table: "notification_push_subscriptions", - columns: new[] { "device_token", "device_id", "account_id" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "ix_notification_push_subscriptions_device_token_device_id_acco", - table: "notification_push_subscriptions"); - - migrationBuilder.CreateIndex( - name: "ix_notification_push_subscriptions_device_token_device_id", - table: "notification_push_subscriptions", - columns: new[] { "device_token", "device_id" }, - unique: true); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.Designer.cs b/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.Designer.cs deleted file mode 100644 index 9e08655..0000000 --- a/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.Designer.cs +++ /dev/null @@ -1,3410 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250603153937_BetterAuthFactor")] - partial class BetterAuthFactor - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.cs b/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.cs deleted file mode 100644 index 2f95a5c..0000000 --- a/DysonNetwork.Sphere/Migrations/20250603153937_BetterAuthFactor.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class BetterAuthFactor : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "config", - table: "account_auth_factors", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "enabled_at", - table: "account_auth_factors", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "expired_at", - table: "account_auth_factors", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "trustworthy", - table: "account_auth_factors", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "config", - table: "account_auth_factors"); - - migrationBuilder.DropColumn( - name: "enabled_at", - table: "account_auth_factors"); - - migrationBuilder.DropColumn( - name: "expired_at", - table: "account_auth_factors"); - - migrationBuilder.DropColumn( - name: "trustworthy", - table: "account_auth_factors"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.Designer.cs b/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.Designer.cs deleted file mode 100644 index 7f554cd..0000000 --- a/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.Designer.cs +++ /dev/null @@ -1,3414 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250608114100_AccountContactCanBePrimary")] - partial class AccountContactCanBePrimary - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property>("UsersVisible") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("users_visible"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_activities"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_activities_account_id"); - - b.ToTable("activities", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Activity.Activity", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_activities_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.cs b/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.cs deleted file mode 100644 index 5506b05..0000000 --- a/DysonNetwork.Sphere/Migrations/20250608114100_AccountContactCanBePrimary.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class AccountContactCanBePrimary : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "is_primary", - table: "account_contacts", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "is_primary", - table: "account_contacts"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.Designer.cs b/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.Designer.cs deleted file mode 100644 index 97da94d..0000000 --- a/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.Designer.cs +++ /dev/null @@ -1,3344 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250608152205_RemoveActivities")] - partial class RemoveActivities - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.cs b/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.cs deleted file mode 100644 index e5d715c..0000000 --- a/DysonNetwork.Sphere/Migrations/20250608152205_RemoveActivities.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class RemoveActivities : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "activities"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "activities", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true), - meta = table.Column>(type: "jsonb", nullable: false), - resource_identifier = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - type = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - users_visible = table.Column>(type: "jsonb", nullable: false), - visibility = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_activities", x => x.id); - table.ForeignKey( - name: "fk_activities_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_activities_account_id", - table: "activities", - column: "account_id"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.Designer.cs b/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.Designer.cs deleted file mode 100644 index 94216de..0000000 --- a/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.Designer.cs +++ /dev/null @@ -1,3357 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250609153232_EnrichChatMembers")] - partial class EnrichChatMembers - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.cs b/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.cs deleted file mode 100644 index 0f25d8f..0000000 --- a/DysonNetwork.Sphere/Migrations/20250609153232_EnrichChatMembers.cs +++ /dev/null @@ -1,50 +0,0 @@ -using DysonNetwork.Sphere.Chat; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class EnrichChatMembers : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "break_until", - table: "chat_members", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "timeout_cause", - table: "chat_members", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "timeout_until", - table: "chat_members", - type: "timestamp with time zone", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "break_until", - table: "chat_members"); - - migrationBuilder.DropColumn( - name: "timeout_cause", - table: "chat_members"); - - migrationBuilder.DropColumn( - name: "timeout_until", - table: "chat_members"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.Designer.cs b/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.Designer.cs deleted file mode 100644 index 82f5e94..0000000 --- a/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.Designer.cs +++ /dev/null @@ -1,3368 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250610151739_ActiveBadgeAndVerification")] - partial class ActiveBadgeAndVerification - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.cs b/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.cs deleted file mode 100644 index a4e2dd5..0000000 --- a/DysonNetwork.Sphere/Migrations/20250610151739_ActiveBadgeAndVerification.cs +++ /dev/null @@ -1,91 +0,0 @@ -using DysonNetwork.Sphere.Account; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class ActiveBadgeAndVerification : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "verified_as", - table: "realms"); - - migrationBuilder.DropColumn( - name: "verified_at", - table: "realms"); - - migrationBuilder.AddColumn( - name: "verification", - table: "realms", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "verification", - table: "publishers", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "activated_at", - table: "badges", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "active_badge", - table: "account_profiles", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "verification", - table: "account_profiles", - type: "jsonb", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "verification", - table: "realms"); - - migrationBuilder.DropColumn( - name: "verification", - table: "publishers"); - - migrationBuilder.DropColumn( - name: "activated_at", - table: "badges"); - - migrationBuilder.DropColumn( - name: "active_badge", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "verification", - table: "account_profiles"); - - migrationBuilder.AddColumn( - name: "verified_as", - table: "realms", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn( - name: "verified_at", - table: "realms", - type: "timestamp with time zone", - nullable: true); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.Designer.cs b/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.Designer.cs deleted file mode 100644 index 336f229..0000000 --- a/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.Designer.cs +++ /dev/null @@ -1,3550 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250611165902_BetterRecyclingFilesAndWalletSubscriptions")] - partial class BetterRecyclingFilesAndWalletSubscriptions - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.cs b/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.cs deleted file mode 100644 index 2c411b1..0000000 --- a/DysonNetwork.Sphere/Migrations/20250611165902_BetterRecyclingFilesAndWalletSubscriptions.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class BetterRecyclingFilesAndWalletSubscriptions : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "is_marked_recycle", - table: "files", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "location", - table: "account_profiles", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.AddColumn( - name: "stellar_membership", - table: "account_profiles", - type: "jsonb", - nullable: true); - - migrationBuilder.AddColumn( - name: "time_zone", - table: "account_profiles", - type: "character varying(1024)", - maxLength: 1024, - nullable: true); - - migrationBuilder.CreateTable( - name: "wallet_coupons", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - identifier = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - code = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), - affected_at = table.Column(type: "timestamp with time zone", nullable: true), - expired_at = table.Column(type: "timestamp with time zone", nullable: true), - discount_amount = table.Column(type: "numeric", nullable: true), - discount_rate = table.Column(type: "double precision", nullable: true), - max_usage = table.Column(type: "integer", nullable: true), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_wallet_coupons", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "wallet_subscriptions", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - begun_at = table.Column(type: "timestamp with time zone", nullable: false), - ended_at = table.Column(type: "timestamp with time zone", nullable: true), - identifier = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - is_active = table.Column(type: "boolean", nullable: false), - is_free_trial = table.Column(type: "boolean", nullable: false), - status = table.Column(type: "integer", nullable: false), - payment_method = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - payment_details = table.Column(type: "jsonb", nullable: false), - base_price = table.Column(type: "numeric", nullable: false), - coupon_id = table.Column(type: "uuid", nullable: true), - renewal_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_wallet_subscriptions", x => x.id); - table.ForeignKey( - name: "fk_wallet_subscriptions_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_wallet_subscriptions_wallet_coupons_coupon_id", - column: x => x.coupon_id, - principalTable: "wallet_coupons", - principalColumn: "id"); - }); - - migrationBuilder.CreateIndex( - name: "ix_wallet_subscriptions_account_id", - table: "wallet_subscriptions", - column: "account_id"); - - migrationBuilder.CreateIndex( - name: "ix_wallet_subscriptions_coupon_id", - table: "wallet_subscriptions", - column: "coupon_id"); - - migrationBuilder.CreateIndex( - name: "ix_wallet_subscriptions_identifier", - table: "wallet_subscriptions", - column: "identifier"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "wallet_subscriptions"); - - migrationBuilder.DropTable( - name: "wallet_coupons"); - - migrationBuilder.DropColumn( - name: "is_marked_recycle", - table: "files"); - - migrationBuilder.DropColumn( - name: "location", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "stellar_membership", - table: "account_profiles"); - - migrationBuilder.DropColumn( - name: "time_zone", - table: "account_profiles"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.Designer.cs b/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.Designer.cs deleted file mode 100644 index 0fe5183..0000000 --- a/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.Designer.cs +++ /dev/null @@ -1,3622 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250615083256_AddAccountConnection")] - partial class AddAccountConnection - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.cs b/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.cs deleted file mode 100644 index 0fa3938..0000000 --- a/DysonNetwork.Sphere/Migrations/20250615083256_AddAccountConnection.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class AddAccountConnection : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "account_connections", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - provider = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - provided_identifier = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), - access_token = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - refresh_token = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - last_used_at = table.Column(type: "timestamp with time zone", nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_account_connections", x => x.id); - table.ForeignKey( - name: "fk_account_connections_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_account_connections_account_id", - table: "account_connections", - column: "account_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "account_connections"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.Designer.cs b/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.Designer.cs deleted file mode 100644 index 478a54b..0000000 --- a/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.Designer.cs +++ /dev/null @@ -1,3626 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250615154147_EnrichAccountConnection")] - partial class EnrichAccountConnection - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.cs b/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.cs deleted file mode 100644 index 15a9722..0000000 --- a/DysonNetwork.Sphere/Migrations/20250615154147_EnrichAccountConnection.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class EnrichAccountConnection : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "meta", - table: "account_connections", - type: "jsonb", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "meta", - table: "account_connections"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.Designer.cs b/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.Designer.cs deleted file mode 100644 index 3664182..0000000 --- a/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.Designer.cs +++ /dev/null @@ -1,3633 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250621191505_WalletOrderAppDX")] - partial class WalletOrderAppDX - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.HasIndex("SessionId") - .HasDatabaseName("ix_action_logs_session_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Session", "Session") - .WithMany() - .HasForeignKey("SessionId") - .HasConstraintName("fk_action_logs_auth_sessions_session_id"); - - b.Navigation("Account"); - - b.Navigation("Session"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.cs b/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.cs deleted file mode 100644 index bd433a9..0000000 --- a/DysonNetwork.Sphere/Migrations/20250621191505_WalletOrderAppDX.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class WalletOrderAppDX : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_payment_orders_wallets_payee_wallet_id", - table: "payment_orders"); - - migrationBuilder.AlterColumn( - name: "payee_wallet_id", - table: "payment_orders", - type: "uuid", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uuid"); - - migrationBuilder.AddColumn( - name: "app_identifier", - table: "payment_orders", - type: "character varying(4096)", - maxLength: 4096, - nullable: true); - - migrationBuilder.AddColumn>( - name: "meta", - table: "payment_orders", - type: "jsonb", - nullable: true); - - migrationBuilder.AddForeignKey( - name: "fk_payment_orders_wallets_payee_wallet_id", - table: "payment_orders", - column: "payee_wallet_id", - principalTable: "wallets", - principalColumn: "id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_payment_orders_wallets_payee_wallet_id", - table: "payment_orders"); - - migrationBuilder.DropColumn( - name: "app_identifier", - table: "payment_orders"); - - migrationBuilder.DropColumn( - name: "meta", - table: "payment_orders"); - - migrationBuilder.AlterColumn( - name: "payee_wallet_id", - table: "payment_orders", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uuid", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "fk_payment_orders_wallets_payee_wallet_id", - table: "payment_orders", - column: "payee_wallet_id", - principalTable: "wallets", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.Designer.cs b/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.Designer.cs deleted file mode 100644 index 67da21b..0000000 --- a/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.Designer.cs +++ /dev/null @@ -1,3623 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250624160304_DropActionLogSessionFk")] - partial class DropActionLogSessionFk - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.cs b/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.cs deleted file mode 100644 index ca67273..0000000 --- a/DysonNetwork.Sphere/Migrations/20250624160304_DropActionLogSessionFk.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class DropActionLogSessionFk : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_action_logs_auth_sessions_session_id", - table: "action_logs"); - - migrationBuilder.DropIndex( - name: "ix_action_logs_session_id", - table: "action_logs"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateIndex( - name: "ix_action_logs_session_id", - table: "action_logs", - column: "session_id"); - - migrationBuilder.AddForeignKey( - name: "fk_action_logs_auth_sessions_session_id", - table: "action_logs", - column: "session_id", - principalTable: "auth_sessions", - principalColumn: "id"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.Designer.cs b/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.Designer.cs deleted file mode 100644 index 4d0d6e3..0000000 --- a/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.Designer.cs +++ /dev/null @@ -1,3696 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250625150644_SafetyAbuseReport")] - partial class SafetyAbuseReport - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.cs b/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.cs deleted file mode 100644 index ef0e204..0000000 --- a/DysonNetwork.Sphere/Migrations/20250625150644_SafetyAbuseReport.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using DysonNetwork.Sphere.Storage; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class SafetyAbuseReport : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "sensitive_marks", - table: "posts", - type: "jsonb", - nullable: true); - - migrationBuilder.CreateTable( - name: "abuse_reports", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - resource_identifier = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - type = table.Column(type: "integer", nullable: false), - reason = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), - resolved_at = table.Column(type: "timestamp with time zone", nullable: true), - resolution = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: true), - account_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_abuse_reports", x => x.id); - table.ForeignKey( - name: "fk_abuse_reports_accounts_account_id", - column: x => x.account_id, - principalTable: "accounts", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_abuse_reports_account_id", - table: "abuse_reports", - column: "account_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "abuse_reports"); - - migrationBuilder.DropColumn( - name: "sensitive_marks", - table: "posts"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.Designer.cs b/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.Designer.cs deleted file mode 100644 index 99582d5..0000000 --- a/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.Designer.cs +++ /dev/null @@ -1,3852 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250626093051_AddWebArticles")] - partial class AddWebArticles - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.cs b/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.cs deleted file mode 100644 index 842e213..0000000 --- a/DysonNetwork.Sphere/Migrations/20250626093051_AddWebArticles.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using DysonNetwork.Sphere.Connection.WebReader; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class AddWebArticles : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "web_feeds", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - url = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), - title = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - description = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: true), - preview = table.Column(type: "jsonb", nullable: true), - publisher_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_web_feeds", x => x.id); - table.ForeignKey( - name: "fk_web_feeds_publishers_publisher_id", - column: x => x.publisher_id, - principalTable: "publishers", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "web_articles", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - title = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), - url = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), - author = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), - meta = table.Column>(type: "jsonb", nullable: true), - preview = table.Column(type: "jsonb", nullable: true), - content = table.Column(type: "text", nullable: true), - published_at = table.Column(type: "timestamp with time zone", nullable: true), - feed_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_web_articles", x => x.id); - table.ForeignKey( - name: "fk_web_articles_web_feeds_feed_id", - column: x => x.feed_id, - principalTable: "web_feeds", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_web_articles_feed_id", - table: "web_articles", - column: "feed_id"); - - migrationBuilder.CreateIndex( - name: "ix_web_articles_url", - table: "web_articles", - column: "url", - unique: true); - - migrationBuilder.CreateIndex( - name: "ix_web_feeds_publisher_id", - table: "web_feeds", - column: "publisher_id"); - - migrationBuilder.CreateIndex( - name: "ix_web_feeds_url", - table: "web_feeds", - column: "url", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "web_articles"); - - migrationBuilder.DropTable( - name: "web_feeds"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.Designer.cs b/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.Designer.cs deleted file mode 100644 index 308d6ba..0000000 --- a/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.Designer.cs +++ /dev/null @@ -1,3947 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - [Migration("20250626105203_AddRealmTags")] - partial class AddRealmTags - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Config") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAs") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("verified_as"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("TagId") - .HasColumnType("uuid") - .HasColumnName("tag_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "TagId") - .HasName("pk_realm_tags"); - - b.HasIndex("TagId") - .HasDatabaseName("ix_realm_tags_tag_id"); - - b.ToTable("realm_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_tags"); - - b.ToTable("tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("RealmTags") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_realms_realm_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag") - .WithMany("RealmTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_tags_tag_id"); - - b.Navigation("Realm"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.cs b/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.cs deleted file mode 100644 index 9782f04..0000000 --- a/DysonNetwork.Sphere/Migrations/20250626105203_AddRealmTags.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using DysonNetwork.Sphere.Connection.WebReader; -using Microsoft.EntityFrameworkCore.Migrations; -using NodaTime; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - /// - public partial class AddRealmTags : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "config", - table: "web_feeds", - type: "jsonb", - nullable: false); - - migrationBuilder.CreateTable( - name: "tags", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_tags", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "realm_tags", - columns: table => new - { - realm_id = table.Column(type: "uuid", nullable: false), - tag_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: false), - deleted_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_realm_tags", x => new { x.realm_id, x.tag_id }); - table.ForeignKey( - name: "fk_realm_tags_realms_realm_id", - column: x => x.realm_id, - principalTable: "realms", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "fk_realm_tags_tags_tag_id", - column: x => x.tag_id, - principalTable: "tags", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "ix_realm_tags_tag_id", - table: "realm_tags", - column: "tag_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "realm_tags"); - - migrationBuilder.DropTable( - name: "tags"); - - migrationBuilder.DropColumn( - name: "config", - table: "web_feeds"); - } - } -} diff --git a/DysonNetwork.Sphere/Migrations/AppDatabaseModelSnapshot.cs b/DysonNetwork.Sphere/Migrations/AppDatabaseModelSnapshot.cs deleted file mode 100644 index e252d08..0000000 --- a/DysonNetwork.Sphere/Migrations/AppDatabaseModelSnapshot.cs +++ /dev/null @@ -1,3990 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.Text.Json; -using DysonNetwork.Sphere; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Chat; -using DysonNetwork.Sphere.Connection.WebReader; -using DysonNetwork.Sphere.Developer; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetTopologySuite.Geometries; -using NodaTime; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; - -#nullable disable - -namespace DysonNetwork.Sphere.Migrations -{ - [DbContext(typeof(AppDatabase))] - partial class AppDatabaseModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("reason"); - - b.Property("Resolution") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("resolution"); - - b.Property("ResolvedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("resolved_at"); - - b.Property("ResourceIdentifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("resource_identifier"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_abuse_reports"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_abuse_reports_account_id"); - - b.ToTable("abuse_reports", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsSuperuser") - .HasColumnType("boolean") - .HasColumnName("is_superuser"); - - b.Property("Language") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("language"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_accounts"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_accounts_name"); - - b.ToTable("accounts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Config") - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EnabledAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("enabled_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Secret") - .HasMaxLength(8196) - .HasColumnType("character varying(8196)") - .HasColumnName("secret"); - - b.Property("Trustworthy") - .HasColumnType("integer") - .HasColumnName("trustworthy"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_auth_factors"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_auth_factors_account_id"); - - b.ToTable("account_auth_factors", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccessToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("access_token"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("ProvidedIdentifier") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("provided_identifier"); - - b.Property("Provider") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("provider"); - - b.Property("RefreshToken") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("refresh_token"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_connections"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_connections_account_id"); - - b.ToTable("account_connections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsPrimary") - .HasColumnType("boolean") - .HasColumnName("is_primary"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("verified_at"); - - b.HasKey("Id") - .HasName("pk_account_contacts"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_contacts_account_id"); - - b.ToTable("account_contacts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Action") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("action"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("SessionId") - .HasColumnType("uuid") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_action_logs"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_action_logs_account_id"); - - b.ToTable("action_logs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActivatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("activated_at"); - - b.Property("Caption") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("caption"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_badges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_badges_account_id"); - - b.ToTable("badges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("RewardExperience") - .HasColumnType("integer") - .HasColumnName("reward_experience"); - - b.Property("RewardPoints") - .HasColumnType("numeric") - .HasColumnName("reward_points"); - - b.Property>("Tips") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("tips"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_check_in_results"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_check_in_results_account_id"); - - b.ToTable("account_check_in_results", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expires_at"); - - b.Property>("Meta") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Spell") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("spell"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_magic_spells"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_magic_spells_account_id"); - - b.HasIndex("Spell") - .IsUnique() - .HasDatabaseName("ix_magic_spells_spell"); - - b.ToTable("magic_spells", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Priority") - .HasColumnType("integer") - .HasColumnName("priority"); - - b.Property("Subtitle") - .HasMaxLength(2048) - .HasColumnType("character varying(2048)") - .HasColumnName("subtitle"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("topic"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("ViewedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("viewed_at"); - - b.HasKey("Id") - .HasName("pk_notifications"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notifications_account_id"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_id"); - - b.Property("DeviceToken") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("device_token"); - - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_used_at"); - - b.Property("Provider") - .HasColumnType("integer") - .HasColumnName("provider"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_notification_push_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_notification_push_subscriptions_account_id"); - - b.HasIndex("DeviceToken", "DeviceId", "AccountId") - .IsUnique() - .HasDatabaseName("ix_notification_push_subscriptions_device_token_device_id_acco"); - - b.ToTable("notification_push_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("ActiveBadge") - .HasColumnType("jsonb") - .HasColumnName("active_badge"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("Birthday") - .HasColumnType("timestamp with time zone") - .HasColumnName("birthday"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Experience") - .HasColumnType("integer") - .HasColumnName("experience"); - - b.Property("FirstName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("first_name"); - - b.Property("Gender") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("gender"); - - b.Property("LastName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("last_name"); - - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_seen_at"); - - b.Property("Location") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("location"); - - b.Property("MiddleName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("middle_name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Pronouns") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("pronouns"); - - b.Property("StellarMembership") - .HasColumnType("jsonb") - .HasColumnName("stellar_membership"); - - b.Property("TimeZone") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("time_zone"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_account_profiles"); - - b.HasIndex("AccountId") - .IsUnique() - .HasDatabaseName("ix_account_profiles_account_id"); - - b.ToTable("account_profiles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("RelatedId") - .HasColumnType("uuid") - .HasColumnName("related_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Status") - .HasColumnType("smallint") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("AccountId", "RelatedId") - .HasName("pk_account_relationships"); - - b.HasIndex("RelatedId") - .HasDatabaseName("ix_account_relationships_related_id"); - - b.ToTable("account_relationships", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("ClearedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("cleared_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsInvisible") - .HasColumnType("boolean") - .HasColumnName("is_invisible"); - - b.Property("IsNotDisturb") - .HasColumnType("boolean") - .HasColumnName("is_not_disturb"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_account_statuses"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_account_statuses_account_id"); - - b.ToTable("account_statuses", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property>("Audiences") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("audiences"); - - b.Property>("BlacklistFactors") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("blacklist_factors"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("device_id"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FailedAttempts") - .HasColumnType("integer") - .HasColumnName("failed_attempts"); - - b.Property("IpAddress") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("ip_address"); - - b.Property("Location") - .HasColumnType("geometry") - .HasColumnName("location"); - - b.Property("Nonce") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nonce"); - - b.Property("Platform") - .HasColumnType("integer") - .HasColumnName("platform"); - - b.Property>("Scopes") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("scopes"); - - b.Property("StepRemain") - .HasColumnType("integer") - .HasColumnName("step_remain"); - - b.Property("StepTotal") - .HasColumnType("integer") - .HasColumnName("step_total"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UserAgent") - .HasMaxLength(512) - .HasColumnType("character varying(512)") - .HasColumnName("user_agent"); - - b.HasKey("Id") - .HasName("pk_auth_challenges"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_challenges_account_id"); - - b.ToTable("auth_challenges", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("ChallengeId") - .HasColumnType("uuid") - .HasColumnName("challenge_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Label") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("label"); - - b.Property("LastGrantedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_granted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_auth_sessions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_auth_sessions_account_id"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_auth_sessions_app_id"); - - b.HasIndex("ChallengeId") - .HasDatabaseName("ix_auth_sessions_challenge_id"); - - b.ToTable("auth_sessions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BreakUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("break_until"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("IsBot") - .HasColumnType("boolean") - .HasColumnName("is_bot"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LastReadAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("last_read_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Nick") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("nick"); - - b.Property("Notify") - .HasColumnType("integer") - .HasColumnName("notify"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("TimeoutCause") - .HasColumnType("jsonb") - .HasColumnName("timeout_cause"); - - b.Property("TimeoutUntil") - .HasColumnType("timestamp with time zone") - .HasColumnName("timeout_until"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_members"); - - b.HasAlternateKey("ChatRoomId", "AccountId") - .HasName("ak_chat_members_chat_room_id_account_id"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_chat_members_account_id"); - - b.ToTable("chat_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_rooms"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_chat_rooms_realm_id"); - - b.ToTable("chat_rooms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("ChatRoomId") - .HasColumnType("uuid") - .HasColumnName("chat_room_id"); - - b.Property("Content") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedMessageId") - .HasColumnType("uuid") - .HasColumnName("forwarded_message_id"); - - b.Property>("MembersMentioned") - .HasColumnType("jsonb") - .HasColumnName("members_mentioned"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Nonce") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character varying(36)") - .HasColumnName("nonce"); - - b.Property("RepliedMessageId") - .HasColumnType("uuid") - .HasColumnName("replied_message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_messages"); - - b.HasIndex("ChatRoomId") - .HasDatabaseName("ix_chat_messages_chat_room_id"); - - b.HasIndex("ForwardedMessageId") - .HasDatabaseName("ix_chat_messages_forwarded_message_id"); - - b.HasIndex("RepliedMessageId") - .HasDatabaseName("ix_chat_messages_replied_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_messages_sender_id"); - - b.ToTable("chat_messages", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_chat_reactions"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_chat_reactions_message_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_reactions_sender_id"); - - b.ToTable("chat_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("ProviderName") - .HasColumnType("text") - .HasColumnName("provider_name"); - - b.Property("RoomId") - .HasColumnType("uuid") - .HasColumnName("room_id"); - - b.Property("SenderId") - .HasColumnType("uuid") - .HasColumnName("sender_id"); - - b.Property("SessionId") - .HasColumnType("text") - .HasColumnName("session_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UpstreamConfigJson") - .HasColumnType("jsonb") - .HasColumnName("upstream"); - - b.HasKey("Id") - .HasName("pk_chat_realtime_call"); - - b.HasIndex("RoomId") - .HasDatabaseName("ix_chat_realtime_call_room_id"); - - b.HasIndex("SenderId") - .HasDatabaseName("ix_chat_realtime_call_sender_id"); - - b.ToTable("chat_realtime_call", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Author") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("author"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("FeedId") - .HasColumnType("uuid") - .HasColumnName("feed_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_articles"); - - b.HasIndex("FeedId") - .HasDatabaseName("ix_web_articles_feed_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_articles_url"); - - b.ToTable("web_articles", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Config") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("config"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("description"); - - b.Property("Preview") - .HasColumnType("jsonb") - .HasColumnName("preview"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(8192) - .HasColumnType("character varying(8192)") - .HasColumnName("url"); - - b.HasKey("Id") - .HasName("pk_web_feeds"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_web_feeds_publisher_id"); - - b.HasIndex("Url") - .IsUnique() - .HasDatabaseName("ix_web_feeds_url"); - - b.ToTable("web_feeds", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Links") - .HasColumnType("jsonb") - .HasColumnName("links"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("OauthConfig") - .HasColumnType("jsonb") - .HasColumnName("oauth_config"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_custom_apps"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_custom_apps_publisher_id"); - - b.ToTable("custom_apps", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AppId") - .HasColumnType("uuid") - .HasColumnName("app_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IsOidc") - .HasColumnType("boolean") - .HasColumnName("is_oidc"); - - b.Property("Secret") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("secret"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_custom_app_secrets"); - - b.HasIndex("AppId") - .HasDatabaseName("ix_custom_app_secrets_app_id"); - - b.HasIndex("Secret") - .IsUnique() - .HasDatabaseName("ix_custom_app_secrets_secret"); - - b.ToTable("custom_app_secrets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_permission_groups"); - - b.ToTable("permission_groups", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Actor") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("GroupId", "Actor") - .HasName("pk_permission_group_members"); - - b.ToTable("permission_group_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Actor") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("actor"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Area") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("area"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("GroupId") - .HasColumnType("uuid") - .HasColumnName("group_id"); - - b.Property("Key") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("key"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Value") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("value"); - - b.HasKey("Id") - .HasName("pk_permission_nodes"); - - b.HasIndex("GroupId") - .HasDatabaseName("ix_permission_nodes_group_id"); - - b.HasIndex("Key", "Area", "Actor") - .HasDatabaseName("ix_permission_nodes_key_area_actor"); - - b.ToTable("permission_nodes", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property>("Attachments") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("attachments"); - - b.Property("Content") - .HasColumnType("text") - .HasColumnName("content"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Downvotes") - .HasColumnType("integer") - .HasColumnName("downvotes"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("edited_at"); - - b.Property("ForwardedPostId") - .HasColumnType("uuid") - .HasColumnName("forwarded_post_id"); - - b.Property("Language") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("language"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PublishedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("published_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("RepliedPostId") - .HasColumnType("uuid") - .HasColumnName("replied_post_id"); - - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasColumnName("search_vector") - .HasAnnotation("Npgsql:TsVectorConfig", "simple") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title", "Description", "Content" }); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Title") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("title"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Upvotes") - .HasColumnType("integer") - .HasColumnName("upvotes"); - - b.Property("ViewsTotal") - .HasColumnType("integer") - .HasColumnName("views_total"); - - b.Property("ViewsUnique") - .HasColumnType("integer") - .HasColumnName("views_unique"); - - b.Property("Visibility") - .HasColumnType("integer") - .HasColumnName("visibility"); - - b.HasKey("Id") - .HasName("pk_posts"); - - b.HasIndex("ForwardedPostId") - .HasDatabaseName("ix_posts_forwarded_post_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_posts_publisher_id"); - - b.HasIndex("RepliedPostId") - .HasDatabaseName("ix_posts_replied_post_id"); - - b.HasIndex("SearchVector") - .HasDatabaseName("ix_posts_search_vector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - - b.ToTable("posts", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_categories"); - - b.ToTable("post_categories", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_collections"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_post_collections_publisher_id"); - - b.ToTable("post_collections", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Attitude") - .HasColumnType("integer") - .HasColumnName("attitude"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property("Symbol") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("symbol"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_reactions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_post_reactions_account_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_post_reactions_post_id"); - - b.ToTable("post_reactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_post_tags"); - - b.ToTable("post_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("bio"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("name"); - - b.Property("Nick") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("nick"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_publishers"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publishers_account_id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("ix_publishers_name"); - - b.HasIndex("RealmId") - .HasDatabaseName("ix_publishers_realm_id"); - - b.ToTable("publishers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Flag") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("flag"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_features"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_features_publisher_id"); - - b.ToTable("publisher_features", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("PublisherId", "AccountId") - .HasName("pk_publisher_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_members_account_id"); - - b.ToTable("publisher_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Tier") - .HasColumnType("integer") - .HasColumnName("tier"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_publisher_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_publisher_subscriptions_account_id"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_publisher_subscriptions_publisher_id"); - - b.ToTable("publisher_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("Background") - .HasColumnType("jsonb") - .HasColumnName("background"); - - b.Property("BackgroundId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("background_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("IsCommunity") - .HasColumnType("boolean") - .HasColumnName("is_community"); - - b.Property("IsPublic") - .HasColumnType("boolean") - .HasColumnName("is_public"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Picture") - .HasColumnType("jsonb") - .HasColumnName("picture"); - - b.Property("PictureId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("picture_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Verification") - .HasColumnType("jsonb") - .HasColumnName("verification"); - - b.HasKey("Id") - .HasName("pk_realms"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realms_account_id"); - - b.HasIndex("Slug") - .IsUnique() - .HasDatabaseName("ix_realms_slug"); - - b.ToTable("realms", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("JoinedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("joined_at"); - - b.Property("LeaveAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("leave_at"); - - b.Property("Role") - .HasColumnType("integer") - .HasColumnName("role"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "AccountId") - .HasName("pk_realm_members"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_realm_members_account_id"); - - b.ToTable("realm_members", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.Property("RealmId") - .HasColumnType("uuid") - .HasColumnName("realm_id"); - - b.Property("TagId") - .HasColumnType("uuid") - .HasColumnName("tag_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("RealmId", "TagId") - .HasName("pk_realm_tags"); - - b.HasIndex("TagId") - .HasDatabaseName("ix_realm_tags_tag_id"); - - b.ToTable("realm_tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_tags"); - - b.ToTable("tags", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Image") - .HasColumnType("jsonb") - .HasColumnName("image"); - - b.Property("ImageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("image_id"); - - b.Property("PackId") - .HasColumnType("uuid") - .HasColumnName("pack_id"); - - b.Property("Slug") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("slug"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_stickers"); - - b.HasIndex("PackId") - .HasDatabaseName("ix_stickers_pack_id"); - - b.HasIndex("Slug") - .HasDatabaseName("ix_stickers_slug"); - - b.ToTable("stickers", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("prefix"); - - b.Property("PublisherId") - .HasColumnType("uuid") - .HasColumnName("publisher_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_sticker_packs"); - - b.HasIndex("Prefix") - .IsUnique() - .HasDatabaseName("ix_sticker_packs_prefix"); - - b.HasIndex("PublisherId") - .HasDatabaseName("ix_sticker_packs_publisher_id"); - - b.ToTable("sticker_packs", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.Property("Id") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("Description") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("description"); - - b.Property>("FileMeta") - .HasColumnType("jsonb") - .HasColumnName("file_meta"); - - b.Property("HasCompression") - .HasColumnType("boolean") - .HasColumnName("has_compression"); - - b.Property("Hash") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("hash"); - - b.Property("IsMarkedRecycle") - .HasColumnType("boolean") - .HasColumnName("is_marked_recycle"); - - b.Property("MessageId") - .HasColumnType("uuid") - .HasColumnName("message_id"); - - b.Property("MimeType") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasColumnName("mime_type"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("name"); - - b.Property("PostId") - .HasColumnType("uuid") - .HasColumnName("post_id"); - - b.Property>("SensitiveMarks") - .HasColumnType("jsonb") - .HasColumnName("sensitive_marks"); - - b.Property("Size") - .HasColumnType("bigint") - .HasColumnName("size"); - - b.Property("StorageId") - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("storage_id"); - - b.Property("StorageUrl") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("storage_url"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("uploaded_at"); - - b.Property("UploadedTo") - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("uploaded_to"); - - b.Property>("UserMeta") - .HasColumnType("jsonb") - .HasColumnName("user_meta"); - - b.HasKey("Id") - .HasName("pk_files"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_files_account_id"); - - b.HasIndex("MessageId") - .HasDatabaseName("ix_files_message_id"); - - b.HasIndex("PostId") - .HasDatabaseName("ix_files_post_id"); - - b.ToTable("files", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("FileId") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasColumnName("file_id"); - - b.Property("ResourceId") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("resource_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("Usage") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("usage"); - - b.HasKey("Id") - .HasName("pk_file_references"); - - b.HasIndex("FileId") - .HasDatabaseName("ix_file_references_file_id"); - - b.ToTable("file_references", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Coupon", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AffectedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("affected_at"); - - b.Property("Code") - .HasMaxLength(1024) - .HasColumnType("character varying(1024)") - .HasColumnName("code"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("DiscountAmount") - .HasColumnType("numeric") - .HasColumnName("discount_amount"); - - b.Property("DiscountRate") - .HasColumnType("double precision") - .HasColumnName("discount_rate"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("Identifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("MaxUsage") - .HasColumnType("integer") - .HasColumnName("max_usage"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_coupons"); - - b.ToTable("wallet_coupons", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("AppIdentifier") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("app_identifier"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("ExpiredAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("expired_at"); - - b.Property("IssuerAppId") - .HasColumnType("uuid") - .HasColumnName("issuer_app_id"); - - b.Property>("Meta") - .HasColumnType("jsonb") - .HasColumnName("meta"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("TransactionId") - .HasColumnType("uuid") - .HasColumnName("transaction_id"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_orders"); - - b.HasIndex("IssuerAppId") - .HasDatabaseName("ix_payment_orders_issuer_app_id"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_orders_payee_wallet_id"); - - b.HasIndex("TransactionId") - .HasDatabaseName("ix_payment_orders_transaction_id"); - - b.ToTable("payment_orders", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("BasePrice") - .HasColumnType("numeric") - .HasColumnName("base_price"); - - b.Property("BegunAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("begun_at"); - - b.Property("CouponId") - .HasColumnType("uuid") - .HasColumnName("coupon_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("EndedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("ended_at"); - - b.Property("Identifier") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("identifier"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasColumnName("is_active"); - - b.Property("IsFreeTrial") - .HasColumnType("boolean") - .HasColumnName("is_free_trial"); - - b.Property("PaymentDetails") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("payment_details"); - - b.Property("PaymentMethod") - .IsRequired() - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("payment_method"); - - b.Property("RenewalAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("renewal_at"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallet_subscriptions"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallet_subscriptions_account_id"); - - b.HasIndex("CouponId") - .HasDatabaseName("ix_wallet_subscriptions_coupon_id"); - - b.HasIndex("Identifier") - .HasDatabaseName("ix_wallet_subscriptions_identifier"); - - b.ToTable("wallet_subscriptions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("PayeeWalletId") - .HasColumnType("uuid") - .HasColumnName("payee_wallet_id"); - - b.Property("PayerWalletId") - .HasColumnType("uuid") - .HasColumnName("payer_wallet_id"); - - b.Property("Remarks") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)") - .HasColumnName("remarks"); - - b.Property("Type") - .HasColumnType("integer") - .HasColumnName("type"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_payment_transactions"); - - b.HasIndex("PayeeWalletId") - .HasDatabaseName("ix_payment_transactions_payee_wallet_id"); - - b.HasIndex("PayerWalletId") - .HasDatabaseName("ix_payment_transactions_payer_wallet_id"); - - b.ToTable("payment_transactions", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("AccountId") - .HasColumnType("uuid") - .HasColumnName("account_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id") - .HasName("pk_wallets"); - - b.HasIndex("AccountId") - .HasDatabaseName("ix_wallets_account_id"); - - b.ToTable("wallets", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Amount") - .HasColumnType("numeric") - .HasColumnName("amount"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)") - .HasColumnName("currency"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("deleted_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WalletId") - .HasColumnType("uuid") - .HasColumnName("wallet_id"); - - b.HasKey("Id") - .HasName("pk_wallet_pockets"); - - b.HasIndex("WalletId") - .HasDatabaseName("ix_wallet_pockets_wallet_id"); - - b.ToTable("wallet_pockets", (string)null); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.Property("CategoriesId") - .HasColumnType("uuid") - .HasColumnName("categories_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CategoriesId", "PostsId") - .HasName("pk_post_category_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_category_links_posts_id"); - - b.ToTable("post_category_links", (string)null); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.Property("CollectionsId") - .HasColumnType("uuid") - .HasColumnName("collections_id"); - - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.HasKey("CollectionsId", "PostsId") - .HasName("pk_post_collection_links"); - - b.HasIndex("PostsId") - .HasDatabaseName("ix_post_collection_links_posts_id"); - - b.ToTable("post_collection_links", (string)null); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.Property("PostsId") - .HasColumnType("uuid") - .HasColumnName("posts_id"); - - b.Property("TagsId") - .HasColumnType("uuid") - .HasColumnName("tags_id"); - - b.HasKey("PostsId", "TagsId") - .HasName("pk_post_tag_links"); - - b.HasIndex("TagsId") - .HasDatabaseName("ix_post_tag_links_tags_id"); - - b.ToTable("post_tag_links", (string)null); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AbuseReport", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_abuse_reports_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("AuthFactors") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_auth_factors_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountConnection", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Connections") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_connections_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Contacts") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_contacts_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.ActionLog", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_action_logs_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Badge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Badges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_badges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.CheckInResult", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_check_in_results_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.MagicSpell", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_magic_spells_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notifications_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_notification_push_subscriptions_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithOne("Profile") - .HasForeignKey("DysonNetwork.Sphere.Account.Profile", "AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_profiles_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("OutgoingRelationships") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Account.Account", "Related") - .WithMany("IncomingRelationships") - .HasForeignKey("RelatedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_relationships_accounts_related_id"); - - b.Navigation("Account"); - - b.Navigation("Related"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Status", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_account_statuses_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Challenges") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_challenges_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Sessions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany() - .HasForeignKey("AppId") - .HasConstraintName("fk_auth_sessions_custom_apps_app_id"); - - b.HasOne("DysonNetwork.Sphere.Auth.Challenge", "Challenge") - .WithMany() - .HasForeignKey("ChallengeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_auth_sessions_auth_challenges_challenge_id"); - - b.Navigation("Account"); - - b.Navigation("App"); - - b.Navigation("Challenge"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany("Members") - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id"); - - b.Navigation("Account"); - - b.Navigation("ChatRoom"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("ChatRooms") - .HasForeignKey("RealmId") - .HasConstraintName("fk_chat_rooms_realms_realm_id"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "ChatRoom") - .WithMany() - .HasForeignKey("ChatRoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "ForwardedMessage") - .WithMany() - .HasForeignKey("ForwardedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", "RepliedMessage") - .WithMany() - .HasForeignKey("RepliedMessageId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_messages_chat_members_sender_id"); - - b.Navigation("ChatRoom"); - - b.Navigation("ForwardedMessage"); - - b.Navigation("RepliedMessage"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.MessageReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.Message", "Message") - .WithMany("Reactions") - .HasForeignKey("MessageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_reactions_chat_members_sender_id"); - - b.Navigation("Message"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b => - { - b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room") - .WithMany() - .HasForeignKey("RoomId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id"); - - b.Navigation("Room"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebArticle", b => - { - b.HasOne("DysonNetwork.Sphere.Connection.WebReader.WebFeed", "Feed") - .WithMany("Articles") - .HasForeignKey("FeedId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_articles_web_feeds_feed_id"); - - b.Navigation("Feed"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_web_feeds_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Developer") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_apps_publishers_publisher_id"); - - b.Navigation("Developer"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomAppSecret", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "App") - .WithMany("Secrets") - .HasForeignKey("AppId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_custom_app_secrets_custom_apps_app_id"); - - b.Navigation("App"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Members") - .HasForeignKey("GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_permission_group_members_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b => - { - b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group") - .WithMany("Nodes") - .HasForeignKey("GroupId") - .HasConstraintName("fk_permission_nodes_permission_groups_group_id"); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", "ForwardedPost") - .WithMany() - .HasForeignKey("ForwardedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_forwarded_post_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Posts") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_posts_publishers_publisher_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "RepliedPost") - .WithMany() - .HasForeignKey("RepliedPostId") - .OnDelete(DeleteBehavior.Restrict) - .HasConstraintName("fk_posts_posts_replied_post_id"); - - b.Navigation("ForwardedPost"); - - b.Navigation("Publisher"); - - b.Navigation("RepliedPost"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Collections") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collections_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.PostReaction", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", "Post") - .WithMany("Reactions") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_reactions_posts_post_id"); - - b.Navigation("Account"); - - b.Navigation("Post"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .HasConstraintName("fk_publishers_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany() - .HasForeignKey("RealmId") - .HasConstraintName("fk_publishers_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherFeature", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Features") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_features_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Members") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_members_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.PublisherSubscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany("Subscriptions") - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_publisher_subscriptions_publishers_publisher_id"); - - b.Navigation("Account"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realms_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmMember", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("Members") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_members_realms_realm_id"); - - b.Navigation("Account"); - - b.Navigation("Realm"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.RealmTag", b => - { - b.HasOne("DysonNetwork.Sphere.Realm.Realm", "Realm") - .WithMany("RealmTags") - .HasForeignKey("RealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_realms_realm_id"); - - b.HasOne("DysonNetwork.Sphere.Realm.Tag", "Tag") - .WithMany("RealmTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_realm_tags_tags_tag_id"); - - b.Navigation("Realm"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.Sticker", b => - { - b.HasOne("DysonNetwork.Sphere.Sticker.StickerPack", "Pack") - .WithMany() - .HasForeignKey("PackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_stickers_sticker_packs_pack_id"); - - b.Navigation("Pack"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Sticker.StickerPack", b => - { - b.HasOne("DysonNetwork.Sphere.Publisher.Publisher", "Publisher") - .WithMany() - .HasForeignKey("PublisherId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_sticker_packs_publishers_publisher_id"); - - b.Navigation("Publisher"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFile", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_files_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Chat.Message", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("MessageId") - .HasConstraintName("fk_files_chat_messages_message_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany("OutdatedAttachments") - .HasForeignKey("PostId") - .HasConstraintName("fk_files_posts_post_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Storage.CloudFileReference", b => - { - b.HasOne("DysonNetwork.Sphere.Storage.CloudFile", "File") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_file_references_files_file_id"); - - b.Navigation("File"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Order", b => - { - b.HasOne("DysonNetwork.Sphere.Developer.CustomApp", "IssuerApp") - .WithMany() - .HasForeignKey("IssuerAppId") - .HasConstraintName("fk_payment_orders_custom_apps_issuer_app_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_orders_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Transaction", "Transaction") - .WithMany() - .HasForeignKey("TransactionId") - .HasConstraintName("fk_payment_orders_payment_transactions_transaction_id"); - - b.Navigation("IssuerApp"); - - b.Navigation("PayeeWallet"); - - b.Navigation("Transaction"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Subscription", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany("Subscriptions") - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_subscriptions_accounts_account_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Coupon", "Coupon") - .WithMany() - .HasForeignKey("CouponId") - .HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id"); - - b.Navigation("Account"); - - b.Navigation("Coupon"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Transaction", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayeeWallet") - .WithMany() - .HasForeignKey("PayeeWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id"); - - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "PayerWallet") - .WithMany() - .HasForeignKey("PayerWalletId") - .HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id"); - - b.Navigation("PayeeWallet"); - - b.Navigation("PayerWallet"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.HasOne("DysonNetwork.Sphere.Account.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallets_accounts_account_id"); - - b.Navigation("Account"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.WalletPocket", b => - { - b.HasOne("DysonNetwork.Sphere.Wallet.Wallet", "Wallet") - .WithMany("Pockets") - .HasForeignKey("WalletId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_wallet_pockets_wallets_wallet_id"); - - b.Navigation("Wallet"); - }); - - modelBuilder.Entity("PostPostCategory", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCategory", null) - .WithMany() - .HasForeignKey("CategoriesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_post_categories_categories_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_category_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostCollection", b => - { - b.HasOne("DysonNetwork.Sphere.Post.PostCollection", null) - .WithMany() - .HasForeignKey("CollectionsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_post_collections_collections_id"); - - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_collection_links_posts_posts_id"); - }); - - modelBuilder.Entity("PostPostTag", b => - { - b.HasOne("DysonNetwork.Sphere.Post.Post", null) - .WithMany() - .HasForeignKey("PostsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_posts_posts_id"); - - b.HasOne("DysonNetwork.Sphere.Post.PostTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("fk_post_tag_links_post_tags_tags_id"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b => - { - b.Navigation("AuthFactors"); - - b.Navigation("Badges"); - - b.Navigation("Challenges"); - - b.Navigation("Connections"); - - b.Navigation("Contacts"); - - b.Navigation("IncomingRelationships"); - - b.Navigation("OutgoingRelationships"); - - b.Navigation("Profile") - .IsRequired(); - - b.Navigation("Sessions"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.ChatRoom", b => - { - b.Navigation("Members"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Chat.Message", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Connection.WebReader.WebFeed", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Developer.CustomApp", b => - { - b.Navigation("Secrets"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b => - { - b.Navigation("Members"); - - b.Navigation("Nodes"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Post.Post", b => - { - b.Navigation("OutdatedAttachments"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Publisher.Publisher", b => - { - b.Navigation("Collections"); - - b.Navigation("Features"); - - b.Navigation("Members"); - - b.Navigation("Posts"); - - b.Navigation("Subscriptions"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Realm", b => - { - b.Navigation("ChatRooms"); - - b.Navigation("Members"); - - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Realm.Tag", b => - { - b.Navigation("RealmTags"); - }); - - modelBuilder.Entity("DysonNetwork.Sphere.Wallet.Wallet", b => - { - b.Navigation("Pockets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DysonNetwork.Sphere/Pages/Account/Profile.cshtml b/DysonNetwork.Sphere/Pages/Account/Profile.cshtml deleted file mode 100644 index abdbcef..0000000 --- a/DysonNetwork.Sphere/Pages/Account/Profile.cshtml +++ /dev/null @@ -1,225 +0,0 @@ -@page "//account/profile" -@model DysonNetwork.Sphere.Pages.Account.ProfileModel -@{ - ViewData["Title"] = "Profile"; -} - -@if (Model.Account != null) -{ -
-
- -
-

Profile Settings

-

Manage your account information and preferences

-
- - -
- -
-
-
- -
-
- @Model.Account.Name?[..1].ToUpper() -
-
- - -

@Model.Account.Nick

-

@@@Model.Account.Name

- - -
-
-
Level
-
@Model.Account.Profile.Level
-
-
-
XP
-
@Model.Account.Profile.Experience
-
-
-
Member since
-
@Model.Account.CreatedAt.ToDateTimeUtc().ToString("yyyy/MM")
-
-
-
-
-
- - -
-
- -
-

Profile Information

- -
-
-

Basic Information

-
-
-
Full Name
-
@($"{Model.Account.Profile.FirstName} {Model.Account.Profile.MiddleName} {Model.Account.Profile.LastName}".Trim())
-
-
-
Username
-
@Model.Account.Name
-
-
-
Nickname
-
@Model.Account.Nick
-
-
-
Gender
-
@Model.Account.Profile.Gender
-
-
-
- -
-

Additional Details

-
-
-
Location
-
@Model.Account.Profile.Location
-
-
-
Birthday
-
@Model.Account.Profile.Birthday?.ToString("MMMM d, yyyy", System.Globalization.CultureInfo.InvariantCulture)
-
-
-
Bio
-
@(string.IsNullOrEmpty(Model.Account.Profile.Bio) ? "No bio provided" : Model.Account.Profile.Bio)
-
-
-
-
-
- - -
-

Security Settings

- -
-
-
-

Access Token

-

Use this token to authenticate with the API

-
-
- - -
-
-

Keep this token secure and do not share it with anyone.

-
-
-
-
- - -
-

Active Sessions

-

This is a list of devices that have logged into your account. Revoke any sessions that you do not recognize.

- -
-
-
- - - - - - -
-
-
-
- - - -
-
-
-
Current Session
-
@($"{Request.Headers["User-Agent"]} • {DateTime.Now:MMMM d, yyyy 'at' h:mm tt}")
-
-
-
-
-
- -
-
-
-
-
- - -
-
- -
-
-
-
-
-
-} -else -{ -
-
-
-
- -
-

Profile Not Found

-

User profile not found. Please log in to continue.

- Go to Login -
-
-
-} - -@section Scripts { - -} diff --git a/DysonNetwork.Sphere/Pages/Account/Profile.cshtml.cs b/DysonNetwork.Sphere/Pages/Account/Profile.cshtml.cs deleted file mode 100644 index 1dbb86b..0000000 --- a/DysonNetwork.Sphere/Pages/Account/Profile.cshtml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using DysonNetwork.Sphere.Auth; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace DysonNetwork.Sphere.Pages.Account; - -public class ProfileModel : PageModel -{ - public DysonNetwork.Sphere.Account.Account? Account { get; set; } - public string? AccessToken { get; set; } - - public Task OnGetAsync() - { - if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser) - return Task.FromResult(RedirectToPage("/Auth/Login")); - - Account = currentUser; - AccessToken = Request.Cookies.TryGetValue(AuthConstants.CookieTokenName, out var value) ? value : null; - - return Task.FromResult(Page()); - } - - public IActionResult OnPostLogout() - { - HttpContext.Response.Cookies.Delete(AuthConstants.CookieTokenName); - return RedirectToPage("/Auth/Login"); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml b/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml deleted file mode 100644 index 3cc992a..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml +++ /dev/null @@ -1,113 +0,0 @@ -@page "/auth/authorize" -@model DysonNetwork.Sphere.Pages.Auth.AuthorizeModel -@{ - ViewData["Title"] = "Authorize Application"; -} - -
-
-
-

- Authorize Application -

- @if (!string.IsNullOrEmpty(Model.AppName)) - { -
-
- @if (!string.IsNullOrEmpty(Model.AppLogo)) - { -
-
- @Model.AppName logo -
-
- } - else - { -
-
- @Model.AppName?[..1].ToUpper() -
-
- } -
-

@Model.AppName

- @if (!string.IsNullOrEmpty(Model.AppUri)) - { - - @Model.AppUri - - } -
-
-
- } -

- When you authorize this application, you consent to the following permissions: -

- -
- -
- -
- - - - - - - - - - - -
- - -
-
-
-
-
- -@functions { - private string GetScopeDisplayName(string scope) - { - return scope switch - { - "openid" => "View your basic profile information", - "profile" => "View your profile information (name, picture, etc.)", - "email" => "View your email address", - "offline_access" => "Access your information while you're not using the app", - _ => scope - }; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml.cs deleted file mode 100644 index 64249f6..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Authorize.cshtml.cs +++ /dev/null @@ -1,233 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using DysonNetwork.Sphere.Auth.OidcProvider.Services; -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Auth.OidcProvider.Responses; -using DysonNetwork.Sphere.Developer; - -namespace DysonNetwork.Sphere.Pages.Auth; - -public class AuthorizeModel(OidcProviderService oidcService, IConfiguration configuration) : PageModel -{ - [BindProperty(SupportsGet = true)] public string? ReturnUrl { get; set; } - - [BindProperty(SupportsGet = true, Name = "client_id")] - [Required(ErrorMessage = "The client_id parameter is required")] - public string? ClientIdString { get; set; } - - public Guid ClientId { get; set; } - - [BindProperty(SupportsGet = true, Name = "response_type")] - public string ResponseType { get; set; } = "code"; - - [BindProperty(SupportsGet = true, Name = "redirect_uri")] - public string? RedirectUri { get; set; } - - [BindProperty(SupportsGet = true)] public string? Scope { get; set; } - - [BindProperty(SupportsGet = true)] public string? State { get; set; } - - [BindProperty(SupportsGet = true)] public string? Nonce { get; set; } - - - [BindProperty(SupportsGet = true, Name = "code_challenge")] - public string? CodeChallenge { get; set; } - - [BindProperty(SupportsGet = true, Name = "code_challenge_method")] - public string? CodeChallengeMethod { get; set; } - - [BindProperty(SupportsGet = true, Name = "response_mode")] - public string? ResponseMode { get; set; } - - public string? AppName { get; set; } - public string? AppLogo { get; set; } - public string? AppUri { get; set; } - public string[]? RequestedScopes { get; set; } - - public async Task OnGetAsync() - { - // First check if user is authenticated - if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser) - { - var returnUrl = Uri.EscapeDataString($"{Request.Path}{Request.QueryString}"); - return RedirectToPage("/Auth/Login", new { returnUrl }); - } - - // Validate client_id - if (string.IsNullOrEmpty(ClientIdString) || !Guid.TryParse(ClientIdString, out var clientId)) - { - ModelState.AddModelError("client_id", "Invalid client_id format"); - return BadRequest("Invalid client_id format"); - } - - ClientId = clientId; - - // Get client info - var client = await oidcService.FindClientByIdAsync(ClientId); - if (client == null) - { - ModelState.AddModelError("client_id", "Client not found"); - return NotFound("Client not found"); - } - - var config = client.OauthConfig; - if (config is null) - { - ModelState.AddModelError("client_id", "Client was not available for use OAuth / OIDC"); - return BadRequest("Client was not enabled for OAuth / OIDC"); - } - - // Validate redirect URI for non-Developing apps - if (client.Status != CustomAppStatus.Developing) - { - if (!string.IsNullOrEmpty(RedirectUri) && !(config.RedirectUris?.Contains(RedirectUri) ?? false)) - { - return BadRequest(new ErrorResponse - { - Error = "invalid_request", - ErrorDescription = "Invalid redirect_uri" - }); - } - } - - // Check for an existing valid session - var existingSession = await oidcService.FindValidSessionAsync(currentUser.Id, clientId); - if (existingSession != null) - { - // Auto-approve since valid session exists - return await HandleApproval(currentUser, client, existingSession); - } - - // Show authorization page - var baseUrl = configuration["BaseUrl"]; - AppName = client.Name; - AppLogo = client.Picture is not null ? $"{baseUrl}/files/{client.Picture.Id}" : null; - AppUri = config.ClientUri; - RequestedScopes = (Scope ?? "openid profile").Split(' ').Distinct().ToArray(); - - return Page(); - } - - private async Task HandleApproval(Sphere.Account.Account currentUser, CustomApp client, Session? existingSession = null) - { - if (string.IsNullOrEmpty(RedirectUri)) - { - ModelState.AddModelError("redirect_uri", "No redirect_uri provided"); - return BadRequest("No redirect_uri provided"); - } - - string authCode; - - if (existingSession != null) - { - // Reuse existing session - authCode = await oidcService.GenerateAuthorizationCodeForReuseSessionAsync( - session: existingSession, - clientId: ClientId, - redirectUri: RedirectUri, - scopes: Scope?.Split(' ', StringSplitOptions.RemoveEmptyEntries) ?? [], - codeChallenge: CodeChallenge, - codeChallengeMethod: CodeChallengeMethod, - nonce: Nonce - ); - } - else - { - // Create a new session (existing flow) - authCode = await oidcService.GenerateAuthorizationCodeAsync( - clientId: ClientId, - userId: currentUser.Id, - redirectUri: RedirectUri, - scopes: Scope?.Split(' ', StringSplitOptions.RemoveEmptyEntries) ?? [], - codeChallenge: CodeChallenge, - codeChallengeMethod: CodeChallengeMethod, - nonce: Nonce - ); - } - - // Build the redirect URI with the authorization code - var redirectUriBuilder = new UriBuilder(RedirectUri); - var query = System.Web.HttpUtility.ParseQueryString(redirectUriBuilder.Query); - query["code"] = authCode; - if (!string.IsNullOrEmpty(State)) - query["state"] = State; - if (!string.IsNullOrEmpty(Scope)) - query["scope"] = Scope; - redirectUriBuilder.Query = query.ToString(); - - return Redirect(redirectUriBuilder.ToString()); - } - - public async Task OnPostAsync(bool allow) - { - if (HttpContext.Items["CurrentUser"] is not Sphere.Account.Account currentUser) return Unauthorized(); - - // First, validate the client ID - if (string.IsNullOrEmpty(ClientIdString) || !Guid.TryParse(ClientIdString, out var clientId)) - { - ModelState.AddModelError("client_id", "Invalid client_id format"); - return BadRequest("Invalid client_id format"); - } - - ClientId = clientId; - - // Check if a client exists - var client = await oidcService.FindClientByIdAsync(ClientId); - if (client == null) - { - ModelState.AddModelError("client_id", "Client not found"); - return NotFound("Client not found"); - } - - if (!allow) - { - // User denied the authorization request - if (string.IsNullOrEmpty(RedirectUri)) - return BadRequest("No redirect_uri provided"); - - var deniedUriBuilder = new UriBuilder(RedirectUri); - var deniedQuery = System.Web.HttpUtility.ParseQueryString(deniedUriBuilder.Query); - deniedQuery["error"] = "access_denied"; - deniedQuery["error_description"] = "The user denied the authorization request"; - if (!string.IsNullOrEmpty(State)) deniedQuery["state"] = State; - deniedUriBuilder.Query = deniedQuery.ToString(); - - return Redirect(deniedUriBuilder.ToString()); - } - - // User approved the request - if (string.IsNullOrEmpty(RedirectUri)) - { - ModelState.AddModelError("redirect_uri", "No redirect_uri provided"); - return BadRequest("No redirect_uri provided"); - } - - // Generate authorization code - var authCode = await oidcService.GenerateAuthorizationCodeAsync( - clientId: ClientId, - userId: currentUser.Id, - redirectUri: RedirectUri, - scopes: Scope?.Split(' ', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty(), - codeChallenge: CodeChallenge, - codeChallengeMethod: CodeChallengeMethod, - nonce: Nonce); - - // Build the redirect URI with the authorization code - var redirectUri = new UriBuilder(RedirectUri); - var query = System.Web.HttpUtility.ParseQueryString(redirectUri.Query); - - // Add the authorization code - query["code"] = authCode; - - // Add state if provided (for CSRF protection) - if (!string.IsNullOrEmpty(State)) - query["state"] = State; - - // Set the query string - redirectUri.Query = query.ToString(); - - // Redirect back to the client with the authorization code - return Redirect(redirectUri.ToString()); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml b/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml deleted file mode 100644 index 64e90fe..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml +++ /dev/null @@ -1,49 +0,0 @@ -@page "/auth/callback" -@model DysonNetwork.Sphere.Pages.Auth.TokenModel -@{ - ViewData["Title"] = "Authentication Successful"; - Layout = "_Layout"; -} - -
-
-
-

Authentication Successful

-

You can now close this window and return to the application.

-
-
-
- -@section Scripts { - -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml.cs deleted file mode 100644 index fdd6e87..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Callback.cshtml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace DysonNetwork.Sphere.Pages.Auth -{ - public class TokenModel : PageModel - { - public void OnGet() - { - } - } -} diff --git a/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml b/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml deleted file mode 100644 index d315620..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml +++ /dev/null @@ -1,16 +0,0 @@ -@page "//auth/challenge/{id:guid}" -@model DysonNetwork.Sphere.Pages.Auth.ChallengeModel -@{ - // This page is kept for backward compatibility - // It will automatically redirect to the new SelectFactor page - Response.Redirect($"//auth/challenge/{Model.Id}/select-factor"); -} - -
-
-
- -

Redirecting to authentication page...

-
-
-
diff --git a/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml.cs deleted file mode 100644 index 3c0dc79..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Challenge.cshtml.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace DysonNetwork.Sphere.Pages.Auth -{ - public class ChallengeModel() : PageModel - { - [BindProperty(SupportsGet = true)] - public Guid Id { get; set; } - - [BindProperty(SupportsGet = true)] - public string? ReturnUrl { get; set; } - - public IActionResult OnGet() - { - return RedirectToPage("SelectFactor", new { id = Id, returnUrl = ReturnUrl }); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Login.cshtml b/DysonNetwork.Sphere/Pages/Auth/Login.cshtml deleted file mode 100644 index 96e3618..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Login.cshtml +++ /dev/null @@ -1,40 +0,0 @@ -@page "//auth/login" -@model DysonNetwork.Sphere.Pages.Auth.LoginModel -@{ - ViewData["Title"] = "Login | Solar Network"; - var returnUrl = Model.ReturnUrl ?? ""; -} - -
-
-
-
-

Welcome back!

-

Login to your Solar Network account to continue.

-
- -
- - - -
-
- -
-
- Have no account?
- - Create a new account → - -
-
-
-
-
-
- -@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/Login.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/Login.cshtml.cs deleted file mode 100644 index 6b12db9..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/Login.cshtml.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Connection; -using NodaTime; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Pages.Auth -{ - public class LoginModel( - AppDatabase db, - AccountService accounts, - AuthService auth, - GeoIpService geo, - ActionLogService als - ) : PageModel - { - [BindProperty] [Required] public string Username { get; set; } = string.Empty; - - [BindProperty] - [FromQuery] - public string? ReturnUrl { get; set; } - - public void OnGet() - { - } - - public async Task OnPostAsync() - { - if (!ModelState.IsValid) - { - return Page(); - } - - var account = await accounts.LookupAccount(Username); - if (account is null) - { - ModelState.AddModelError(string.Empty, "Account was not found."); - return Page(); - } - - // Store the return URL in TempData to preserve it during the login flow - if (!string.IsNullOrEmpty(ReturnUrl) && Url.IsLocalUrl(ReturnUrl)) - { - TempData["ReturnUrl"] = ReturnUrl; - } - - var ipAddress = HttpContext.Connection.RemoteIpAddress?.ToString(); - var userAgent = HttpContext.Request.Headers.UserAgent.ToString(); - var now = Instant.FromDateTimeUtc(DateTime.UtcNow); - - var existingChallenge = await db.AuthChallenges - .Where(e => e.Account == account) - .Where(e => e.IpAddress == ipAddress) - .Where(e => e.UserAgent == userAgent) - .Where(e => e.StepRemain > 0) - .Where(e => e.ExpiredAt != null && now < e.ExpiredAt) - .FirstOrDefaultAsync(); - - if (existingChallenge is not null) - { - return RedirectToPage("Challenge", new { id = existingChallenge.Id }); - } - - var challenge = new Challenge - { - ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddHours(1)), - StepTotal = await auth.DetectChallengeRisk(Request, account), - Platform = ChallengePlatform.Web, - Audiences = new List(), - Scopes = new List(), - IpAddress = ipAddress, - UserAgent = userAgent, - Location = geo.GetPointFromIp(ipAddress), - DeviceId = "web-browser", - AccountId = account.Id - }.Normalize(); - - await db.AuthChallenges.AddAsync(challenge); - await db.SaveChangesAsync(); - - // If we have a return URL, pass it to the verify page - if (TempData.TryGetValue("ReturnUrl", out var returnUrl) && returnUrl is string url) - { - return RedirectToPage("SelectFactor", new { id = challenge.Id, returnUrl = url }); - } - - return RedirectToPage("SelectFactor", new { id = challenge.Id }); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml b/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml deleted file mode 100644 index 61af7d1..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml +++ /dev/null @@ -1,127 +0,0 @@ -@page "//auth/challenge/{id:guid}/select-factor" -@using DysonNetwork.Sphere.Account -@model DysonNetwork.Sphere.Pages.Auth.SelectFactorModel -@{ - ViewData["Title"] = "Select Authentication Method | Solar Network"; -} - -
-
-
-
-

Select Authentication Method

- - @if (Model.AuthChallenge != null && Model.AuthChallenge.StepRemain > 0) - { -
-

Progress: @(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain) of @Model.AuthChallenge.StepTotal steps completed

- -
- } - - @if (Model.AuthChallenge == null) - { -
- - - - Challenge not found or expired. -
- } - else if (Model.AuthChallenge.StepRemain == 0) - { -
- - - - Challenge completed. Redirecting... -
- } - else - { -

Please select an authentication method:

- -
- @foreach (var factor in Model.AuthFactors) - { -
- - - @if (factor.Type == AccountAuthFactorType.EmailCode) - { -
-
-
-

@GetFactorDisplayName(factor.Type)

-

@GetFactorDescription(factor.Type)

-
-
-
- -
- -
-
-
- } - else - { -
-
-
-

@GetFactorDisplayName(factor.Type)

-

@GetFactorDescription(factor.Type)

-
-
- -
-
-
- } -
- } -
- } -
-
-
-
- -@functions { - - private string GetFactorDisplayName(AccountAuthFactorType type) => type switch - { - AccountAuthFactorType.InAppCode => "Authenticator App", - AccountAuthFactorType.EmailCode => "Email", - AccountAuthFactorType.TimedCode => "Timed Code", - AccountAuthFactorType.PinCode => "PIN Code", - AccountAuthFactorType.Password => "Password", - _ => type.ToString() - }; - - private string GetFactorDescription(AccountAuthFactorType type) => type switch - { - AccountAuthFactorType.InAppCode => "Enter a code from your authenticator app", - AccountAuthFactorType.EmailCode => "Receive a verification code via email", - AccountAuthFactorType.TimedCode => "Use a time-based verification code", - AccountAuthFactorType.PinCode => "Enter your PIN code", - AccountAuthFactorType.Password => "Enter your password", - _ => string.Empty - }; - -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml.cs deleted file mode 100644 index aed783d..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/SelectFactor.cshtml.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.EntityFrameworkCore; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Account; - -namespace DysonNetwork.Sphere.Pages.Auth; - -public class SelectFactorModel( - AppDatabase db, - AccountService accounts -) - : PageModel -{ - [BindProperty(SupportsGet = true)] public Guid Id { get; set; } - [BindProperty(SupportsGet = true)] public string? ReturnUrl { get; set; } - [BindProperty] public Guid SelectedFactorId { get; set; } - [BindProperty] public string? Hint { get; set; } - - public Challenge? AuthChallenge { get; set; } - public List AuthFactors { get; set; } = []; - - public async Task OnGetAsync() - { - await LoadChallengeAndFactors(); - if (AuthChallenge == null) return NotFound(); - if (AuthChallenge.StepRemain == 0) return await ExchangeTokenAndRedirect(); - return Page(); - } - - public async Task OnPostSelectFactorAsync() - { - var challenge = await db.AuthChallenges - .Include(e => e.Account) - .FirstOrDefaultAsync(e => e.Id == Id); - - if (challenge == null) return NotFound(); - - var factor = await db.AccountAuthFactors.FindAsync(SelectedFactorId); - if (factor?.EnabledAt == null || factor.Trustworthy <= 0) - return BadRequest("Invalid authentication method."); - - // Store return URL in TempData to pass to the next step - if (!string.IsNullOrEmpty(ReturnUrl)) - { - TempData["ReturnUrl"] = ReturnUrl; - } - - // For OTP factors that require code delivery - try - { - // For OTP factors that require code delivery - if ( - factor.Type == AccountAuthFactorType.EmailCode - && string.IsNullOrWhiteSpace(Hint) - ) - { - ModelState.AddModelError(string.Empty, - $"Please provide a {factor.Type.ToString().ToLower().Replace("code", "")} to send the code to." - ); - await LoadChallengeAndFactors(); - return Page(); - } - - await accounts.SendFactorCode(challenge.Account, factor, Hint); - } - catch (Exception ex) - { - ModelState.AddModelError(string.Empty, - $"An error occurred while sending the verification code: {ex.Message}"); - await LoadChallengeAndFactors(); - return Page(); - } - - // Redirect to verify page with return URL if available - return !string.IsNullOrEmpty(ReturnUrl) - ? RedirectToPage("VerifyFactor", new { id = Id, factorId = factor.Id, returnUrl = ReturnUrl }) - : RedirectToPage("VerifyFactor", new { id = Id, factorId = factor.Id }); - } - - private async Task LoadChallengeAndFactors() - { - AuthChallenge = await db.AuthChallenges - .Include(e => e.Account) - .FirstOrDefaultAsync(e => e.Id == Id); - - if (AuthChallenge != null) - { - AuthFactors = await db.AccountAuthFactors - .Where(e => e.AccountId == AuthChallenge.Account.Id) - .Where(e => e.EnabledAt != null && e.Trustworthy >= 1) - .ToListAsync(); - } - } - - private async Task ExchangeTokenAndRedirect() - { - // This method is kept for backward compatibility - // The actual token exchange is now handled in the VerifyFactor page - await Task.CompletedTask; // Add this to fix the async warning - return RedirectToPage("/Account/Profile"); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml b/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml deleted file mode 100644 index c02dff9..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml +++ /dev/null @@ -1,99 +0,0 @@ -@page "//auth/challenge/{id:guid}/verify/{factorId:guid}" -@using DysonNetwork.Sphere.Account -@model DysonNetwork.Sphere.Pages.Auth.VerifyFactorModel -@{ - ViewData["Title"] = "Verify Your Identity | Solar Network"; -} - -
-
-
-
-

Verify Your Identity

-

- @switch (Model.FactorType) - { - case AccountAuthFactorType.EmailCode: - We've sent a verification code to your email. - break; - case AccountAuthFactorType.InAppCode: - Enter the code from your authenticator app. - break; - case AccountAuthFactorType.TimedCode: - Enter your time-based verification code. - break; - case AccountAuthFactorType.PinCode: - Enter your PIN code. - break; - case AccountAuthFactorType.Password: - Enter your password. - break; - default: - Please verify your identity. - break; - } -

- - @if (Model.AuthChallenge != null && Model.AuthChallenge.StepRemain > 0) - { -
-

Progress: @(Model.AuthChallenge.StepTotal - Model.AuthChallenge.StepRemain) of @Model.AuthChallenge.StepTotal steps completed

- -
- } - - @if (Model.AuthChallenge == null) - { -
- - Challenge not found or expired. -
- } - else if (Model.AuthChallenge.StepRemain == 0) - { -
- - Verification successful. Redirecting... -
- } - else - { -
- @if (!ViewData.ModelState.IsValid && ViewData.ModelState.Any(m => m.Value.Errors.Any())) - { - - } - -
- - - -
- -
- -
- - -
- } -
-
-
-
- -@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml.cs b/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml.cs deleted file mode 100644 index 55e2a74..0000000 --- a/DysonNetwork.Sphere/Pages/Auth/VerifyFactor.cshtml.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.EntityFrameworkCore; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Account; -using NodaTime; - -namespace DysonNetwork.Sphere.Pages.Auth -{ - public class VerifyFactorModel( - AppDatabase db, - AccountService accounts, - AuthService auth, - ActionLogService als, - IConfiguration configuration, - IHttpClientFactory httpClientFactory - ) - : PageModel - { - [BindProperty(SupportsGet = true)] public Guid Id { get; set; } - - [BindProperty(SupportsGet = true)] public Guid FactorId { get; set; } - - [BindProperty(SupportsGet = true)] public string? ReturnUrl { get; set; } - - [BindProperty, Required] public string Code { get; set; } = string.Empty; - - public Challenge? AuthChallenge { get; set; } - public AccountAuthFactor? Factor { get; set; } - public AccountAuthFactorType FactorType => Factor?.Type ?? AccountAuthFactorType.EmailCode; - - public async Task OnGetAsync() - { - if (!string.IsNullOrEmpty(ReturnUrl)) - { - TempData["ReturnUrl"] = ReturnUrl; - } - await LoadChallengeAndFactor(); - if (AuthChallenge == null) return NotFound("Challenge not found or expired."); - if (Factor == null) return NotFound("Authentication method not found."); - if (AuthChallenge.StepRemain == 0) return await ExchangeTokenAndRedirect(AuthChallenge); - - return Page(); - } - - public async Task OnPostAsync() - { - if (!string.IsNullOrEmpty(ReturnUrl)) - { - TempData["ReturnUrl"] = ReturnUrl; - } - if (!ModelState.IsValid) - { - await LoadChallengeAndFactor(); - return Page(); - } - - await LoadChallengeAndFactor(); - if (AuthChallenge == null) return NotFound("Challenge not found or expired."); - if (Factor == null) return NotFound("Authentication method not found."); - - if (AuthChallenge.BlacklistFactors.Contains(Factor.Id)) - { - ModelState.AddModelError(string.Empty, "This authentication method has already been used for this challenge."); - return Page(); - } - - try - { - if (await accounts.VerifyFactorCode(Factor, Code)) - { - AuthChallenge.StepRemain -= Factor.Trustworthy; - AuthChallenge.StepRemain = Math.Max(0, AuthChallenge.StepRemain); - AuthChallenge.BlacklistFactors.Add(Factor.Id); - db.Update(AuthChallenge); - - als.CreateActionLogFromRequest(ActionLogType.ChallengeSuccess, - new Dictionary - { - { "challenge_id", AuthChallenge.Id }, - { "factor_id", Factor?.Id.ToString() ?? string.Empty } - }, Request, AuthChallenge.Account); - - await db.SaveChangesAsync(); - - if (AuthChallenge.StepRemain == 0) - { - als.CreateActionLogFromRequest(ActionLogType.NewLogin, - new Dictionary - { - { "challenge_id", AuthChallenge.Id }, - { "account_id", AuthChallenge.AccountId } - }, Request, AuthChallenge.Account); - - return await ExchangeTokenAndRedirect(AuthChallenge); - } - - else - { - // If more steps are needed, redirect back to select factor - return RedirectToPage("SelectFactor", new { id = Id, returnUrl = ReturnUrl }); - } - } - else - { - throw new InvalidOperationException("Invalid verification code."); - } - } - catch (Exception ex) - { - if (AuthChallenge != null) - { - AuthChallenge.FailedAttempts++; - db.Update(AuthChallenge); - await db.SaveChangesAsync(); - - als.CreateActionLogFromRequest(ActionLogType.ChallengeFailure, - new Dictionary - { - { "challenge_id", AuthChallenge.Id }, - { "factor_id", Factor?.Id.ToString() ?? string.Empty } - }, Request, AuthChallenge.Account); - } - - - ModelState.AddModelError(string.Empty, ex.Message); - return Page(); - } - } - - private async Task LoadChallengeAndFactor() - { - AuthChallenge = await db.AuthChallenges - .Include(e => e.Account) - .FirstOrDefaultAsync(e => e.Id == Id); - - if (AuthChallenge?.Account != null) - { - Factor = await db.AccountAuthFactors - .FirstOrDefaultAsync(e => e.Id == FactorId && - e.AccountId == AuthChallenge.Account.Id && - e.EnabledAt != null && - e.Trustworthy > 0); - } - } - - private async Task ExchangeTokenAndRedirect(Challenge challenge) - { - await db.Entry(challenge).ReloadAsync(); - if (challenge.StepRemain != 0) return BadRequest($"Challenge not yet completed. Remaining steps: {challenge.StepRemain}"); - - var session = await db.AuthSessions - .FirstOrDefaultAsync(e => e.ChallengeId == challenge.Id); - - if (session == null) - { - session = new Session - { - LastGrantedAt = Instant.FromDateTimeUtc(DateTime.UtcNow), - ExpiredAt = Instant.FromDateTimeUtc(DateTime.UtcNow.AddDays(30)), - Account = challenge.Account, - Challenge = challenge, - }; - db.AuthSessions.Add(session); - await db.SaveChangesAsync(); - } - - var token = auth.CreateToken(session); - Response.Cookies.Append(AuthConstants.CookieTokenName, token, new CookieOptions - { - HttpOnly = true, - Secure = Request.IsHttps, - SameSite = SameSiteMode.Strict, - Path = "/" - }); - - // Redirect to the return URL if provided and valid, otherwise to the home page - if (!string.IsNullOrEmpty(ReturnUrl) && Url.IsLocalUrl(ReturnUrl)) - { - return Redirect(ReturnUrl); - } - - // Check TempData for return URL (in case it was passed through multiple steps) - if (TempData.TryGetValue("ReturnUrl", out var tempReturnUrl) && tempReturnUrl is string returnUrl && - !string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) - { - return Redirect(returnUrl); - } - - return RedirectToPage("/Index"); - } - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml b/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml index 0fee10e..ed50679 100644 --- a/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml +++ b/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml @@ -7,14 +7,14 @@ } @section Head { - - + + @if (imageUrl != null) { - + } - - + + }
@@ -23,10 +23,7 @@

@Model.Post.Title

Created at: @Model.Post.CreatedAt - @if (Model.Post.Publisher?.Account != null) - { - by @@@Model.Post.Publisher.Name - } + by @@@Model.Post.Publisher.Name

@Html.Raw(Markdown.ToHtml(Model.Post.Content ?? string.Empty)) @@ -41,7 +38,8 @@
@if (attachment.MimeType != null && attachment.MimeType.StartsWith("image/")) { - @attachment.Name + @attachment.Name } else if (attachment.MimeType != null && attachment.MimeType.StartsWith("video/")) { diff --git a/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml.cs b/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml.cs index 15d2ba8..27a43d8 100644 --- a/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml.cs +++ b/DysonNetwork.Sphere/Pages/Posts/PostDetail.cshtml.cs @@ -1,4 +1,4 @@ -using DysonNetwork.Sphere.Account; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Publisher; using Microsoft.AspNetCore.Mvc; @@ -10,11 +10,10 @@ namespace DysonNetwork.Sphere.Pages.Posts; public class PostDetailModel( AppDatabase db, PublisherService pub, - RelationshipService rels + AccountService.AccountServiceClient accounts ) : PageModel { - [BindProperty(SupportsGet = true)] - public Guid PostId { get; set; } + [BindProperty(SupportsGet = true)] public Guid PostId { get; set; } public Post.Post? Post { get; set; } @@ -22,20 +21,24 @@ public class PostDetailModel( { if (PostId == Guid.Empty) return NotFound(); - + HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Sphere.Account.Account; - var userFriends = currentUser is null ? [] : await rels.ListAccountFriends(currentUser); - var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(currentUser.Id); + var currentUser = currentUserValue as Account; + var accountId = currentUser is null ? Guid.Empty : Guid.Parse(currentUser.Id); + var userFriends = currentUser is null + ? [] + : (await accounts.ListFriendsAsync( + new ListUserRelationshipSimpleRequest { AccountId = currentUser.Id } + )).AccountsId.Select(Guid.Parse).ToList(); + var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(accountId); Post = await db.Posts - .Where(e => e.Id == PostId) - .Include(e => e.Publisher) - .ThenInclude(p => p.Account) - .Include(e => e.Tags) - .Include(e => e.Categories) - .FilterWithVisibility(currentUser, userFriends, userPublishers) - .FirstOrDefaultAsync(); + .Where(e => e.Id == PostId) + .Include(e => e.Publisher) + .Include(e => e.Tags) + .Include(e => e.Categories) + .FilterWithVisibility(currentUser, userFriends, userPublishers) + .FirstOrDefaultAsync(); if (Post == null) return NotFound(); diff --git a/DysonNetwork.Sphere/Permission/PermissionMiddleware.cs b/DysonNetwork.Sphere/Permission/PermissionMiddleware.cs index a6a6934..b67ba20 100644 --- a/DysonNetwork.Sphere/Permission/PermissionMiddleware.cs +++ b/DysonNetwork.Sphere/Permission/PermissionMiddleware.cs @@ -21,7 +21,7 @@ public class PermissionMiddleware(RequestDelegate next) if (attr != null) { - if (httpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (httpContext.Items["CurrentUser"] is not Account currentUser) { httpContext.Response.StatusCode = StatusCodes.Status403Forbidden; await httpContext.Response.WriteAsync("Unauthorized"); diff --git a/DysonNetwork.Sphere/Post/Post.cs b/DysonNetwork.Sphere/Post/Post.cs index d4acec5..9747f4d 100644 --- a/DysonNetwork.Sphere/Post/Post.cs +++ b/DysonNetwork.Sphere/Post/Post.cs @@ -1,8 +1,9 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Activity; -using DysonNetwork.Sphere.Storage; using NodaTime; using NpgsqlTypes; @@ -52,8 +53,6 @@ public class Post : ModelBase, IIdentifiedResource, IActivity public Guid? ForwardedPostId { get; set; } public Post? ForwardedPost { get; set; } - // Outdated fields, keep for backward compability - public ICollection OutdatedAttachments { get; set; } = new List(); [Column(TypeName = "jsonb")] public List Attachments { get; set; } = []; [JsonIgnore] public NpgsqlTsVector SearchVector { get; set; } = null!; @@ -69,7 +68,7 @@ public class Post : ModelBase, IIdentifiedResource, IActivity [JsonIgnore] public bool Empty => Content == null && Attachments.Count == 0 && ForwardedPostId == null; [NotMapped] public bool IsTruncated { get; set; } = false; - public string ResourceIdentifier => $"post/{Id}"; + public string ResourceIdentifier => $"post:{Id}"; public Activity.Activity ToActivity() { @@ -130,5 +129,4 @@ public class PostReaction : ModelBase public Guid PostId { get; set; } [JsonIgnore] public Post Post { get; set; } = null!; public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; } diff --git a/DysonNetwork.Sphere/Post/PostController.cs b/DysonNetwork.Sphere/Post/PostController.cs index 34da748..7e9dda0 100644 --- a/DysonNetwork.Sphere/Post/PostController.cs +++ b/DysonNetwork.Sphere/Post/PostController.cs @@ -32,7 +32,7 @@ public class PostController( ) { HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account.Account; + var currentUser = currentUserValue as Account; var userFriends = currentUser is null ? [] : await rels.ListAccountFriends(currentUser); var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(currentUser.Id); @@ -70,7 +70,7 @@ public class PostController( return RedirectToPage("/Posts/PostDetail", new { PostId = id }); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account.Account; + var currentUser = currentUserValue as Account; var userFriends = currentUser is null ? [] : await rels.ListAccountFriends(currentUser); var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(currentUser.Id); @@ -102,7 +102,7 @@ public class PostController( return BadRequest("Search query cannot be empty"); HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account.Account; + var currentUser = currentUserValue as Account; var userFriends = currentUser is null ? [] : await rels.ListAccountFriends(currentUser); var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(currentUser.Id); @@ -139,7 +139,7 @@ public class PostController( [FromQuery] int take = 20) { HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - var currentUser = currentUserValue as Account.Account; + var currentUser = currentUserValue as Account; var userFriends = currentUser is null ? [] : await rels.ListAccountFriends(currentUser); var userPublishers = currentUser is null ? [] : await pub.GetUserPublishers(currentUser.Id); @@ -201,7 +201,7 @@ public class PostController( request.Content = TextSanitizer.Sanitize(request.Content); if (string.IsNullOrWhiteSpace(request.Content) && request.Attachments is { Count: 0 }) return BadRequest("Content is required."); - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); Publisher.Publisher? publisher; if (publisherName is null) @@ -287,7 +287,7 @@ public class PostController( public async Task> ReactPost(Guid id, [FromBody] PostReactionRequest request) { HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue); - if (currentUserValue is not Account.Account currentUser) return Unauthorized(); + if (currentUserValue is not Account currentUser) return Unauthorized(); var userFriends = await rels.ListAccountFriends(currentUser); var userPublishers = await pub.GetUserPublishers(currentUser.Id); @@ -336,7 +336,7 @@ public class PostController( request.Content = TextSanitizer.Sanitize(request.Content); if (string.IsNullOrWhiteSpace(request.Content) && request.Attachments is { Count: 0 }) return BadRequest("Content is required."); - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var post = await db.Posts .Where(e => e.Id == id) @@ -382,7 +382,7 @@ public class PostController( [HttpDelete("{id:guid}")] public async Task> DeletePost(Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var post = await db.Posts .Where(e => e.Id == id) diff --git a/DysonNetwork.Sphere/Post/PostService.cs b/DysonNetwork.Sphere/Post/PostService.cs index 2d0c210..6a208ac 100644 --- a/DysonNetwork.Sphere/Post/PostService.cs +++ b/DysonNetwork.Sphere/Post/PostService.cs @@ -1,9 +1,11 @@ using System.Text.RegularExpressions; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Connection.WebReader; +using DysonNetwork.Shared; +using DysonNetwork.Shared.Cache; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; +using DysonNetwork.Sphere.WebReader; using DysonNetwork.Sphere.Localization; using DysonNetwork.Sphere.Publisher; -using DysonNetwork.Sphere.Storage; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Localization; using NodaTime; @@ -12,13 +14,14 @@ namespace DysonNetwork.Sphere.Post; public partial class PostService( AppDatabase db, - FileReferenceService fileRefService, IStringLocalizer localizer, IServiceScopeFactory factory, FlushBufferService flushBuffer, ICacheService cache, - WebReaderService reader, - ILogger logger + ILogger logger, + FileService.FileServiceClient files, + FileReferenceService.FileReferenceServiceClient fileRefs, + WebReaderService reader ) { private const string PostFileUsageIdentifier = "post"; @@ -69,7 +72,7 @@ public partial class PostService( } public async Task PostAsync( - Account.Account user, + Account user, Post post, List? attachments = null, List? tags = null, @@ -91,8 +94,11 @@ public partial class PostService( if (attachments is not null) { - post.Attachments = (await db.Files.Where(e => attachments.Contains(e.Id)).ToListAsync()) - .Select(x => x.ToReferenceObject()).ToList(); + var queryRequest = new GetFileBatchRequest(); + queryRequest.Ids.AddRange(attachments); + var queryResponse = await files.GetFileBatchAsync(queryRequest); + + post.Attachments = queryResponse.Files.Select(CloudFileReferenceObject.FromProtoValue).ToList(); // Re-order the list to match the id list places post.Attachments = attachments .Select(id => post.Attachments.First(a => a.Id == id)) @@ -128,17 +134,16 @@ public partial class PostService( await db.SaveChangesAsync(); // Create file references for each attachment - if (post.Attachments.Any()) + if (post.Attachments.Count != 0) { var postResourceId = $"post:{post.Id}"; - foreach (var file in post.Attachments) + var request = new CreateReferenceBatchRequest { - await fileRefService.CreateReferenceAsync( - file.Id, - PostFileUsageIdentifier, - postResourceId - ); - } + Usage = PostFileUsageIdentifier, + ResourceId = post.ResourceIdentifier, + }; + request.FilesId.AddRange(post.Attachments.Select(a => a.Id)); + await fileRefs.CreateReferenceBatchAsync(request); } if (post.PublishedAt is not null && post.PublishedAt.Value.ToDateTimeUtc() <= DateTime.UtcNow) @@ -157,24 +162,33 @@ public partial class PostService( var sender = post.Publisher; using var scope = factory.CreateScope(); var pub = scope.ServiceProvider.GetRequiredService(); - var nty = scope.ServiceProvider.GetRequiredService(); - var logger = scope.ServiceProvider.GetRequiredService>(); + var nty = scope.ServiceProvider.GetRequiredService(); + var accounts = scope.ServiceProvider.GetRequiredService(); try { var members = await pub.GetPublisherMembers(post.RepliedPost.PublisherId); - foreach (var member in members) + var queryRequest = new GetAccountBatchRequest(); + queryRequest.Id.AddRange(members.Select(m => m.AccountId.ToString())); + var queryResponse = await accounts.GetAccountBatchAsync(queryRequest); + foreach (var member in queryResponse.Accounts) { - AccountService.SetCultureInfo(member.Account); - var (_, content) = ChopPostForNotification(post); - await nty.SendNotification( - member.Account, - "post.replies", - localizer["PostReplyTitle", sender.Nick], - null, - string.IsNullOrWhiteSpace(post.Title) - ? localizer["PostReplyBody", sender.Nick, content] - : localizer["PostReplyContentBody", sender.Nick, post.Title, content], - actionUri: $"/posts/{post.Id}" + if (member is null) continue; + CultureService.SetCultureInfo(member); + await nty.SendPushNotificationToUserAsync( + new SendPushNotificationToUserRequest + { + UserId = member.Id, + Notification = new PushNotification + { + Topic = "post.replies", + Title = localizer["PostReplyTitle", sender.Nick], + Body = string.IsNullOrWhiteSpace(post.Title) + ? localizer["PostReplyBody", sender.Nick, ChopPostForNotification(post).content] + : localizer["PostReplyContentBody", sender.Nick, post.Title, ChopPostForNotification(post).content], + IsSavable = true, + ActionUri = $"/posts/{post.Id}" + } + } ); } } @@ -218,18 +232,20 @@ public partial class PostService( var postResourceId = $"post:{post.Id}"; // Update resource references using the new file list - await fileRefService.UpdateResourceFilesAsync( - postResourceId, - attachments, - PostFileUsageIdentifier - ); + var request = new UpdateResourceFilesRequest + { + ResourceId = postResourceId, + Usage = PostFileUsageIdentifier, + }; + request.FileIds.AddRange(attachments); + await fileRefs.UpdateResourceFilesAsync(request); // Update post attachments by getting files from database - var files = await db.Files - .Where(f => attachments.Contains(f.Id)) - .ToListAsync(); + var queryRequest = new GetFileBatchRequest(); + queryRequest.Ids.AddRange(attachments); + var queryResponse = await files.GetFileBatchAsync(queryRequest); - post.Attachments = files.Select(x => x.ToReferenceObject()).ToList(); + post.Attachments = queryResponse.Files.Select(CloudFileReferenceObject.FromProtoValue).ToList(); } if (tags is not null) @@ -369,10 +385,10 @@ public partial class PostService( public async Task DeletePostAsync(Post post) { - var postResourceId = $"post:{post.Id}"; - // Delete all file references for this post - await fileRefService.DeleteResourceReferencesAsync(postResourceId); + await fileRefs.DeleteResourceReferencesAsync( + new DeleteResourceReferencesRequest { ResourceId = post.ResourceIdentifier } + ); db.Posts.Remove(post); await db.SaveChangesAsync(); @@ -391,7 +407,7 @@ public partial class PostService( public async Task ModifyPostVotes( Post post, PostReaction reaction, - Account.Account sender, + Account sender, bool isRemoving, bool isSelfReact ) @@ -438,24 +454,35 @@ public partial class PostService( { using var scope = factory.CreateScope(); var pub = scope.ServiceProvider.GetRequiredService(); - var nty = scope.ServiceProvider.GetRequiredService(); - var logger = scope.ServiceProvider.GetRequiredService>(); + var nty = scope.ServiceProvider.GetRequiredService(); + var accounts = scope.ServiceProvider.GetRequiredService(); try { var members = await pub.GetPublisherMembers(post.PublisherId); - foreach (var member in members) + var queryRequest = new GetAccountBatchRequest(); + queryRequest.Id.AddRange(members.Select(m => m.AccountId.ToString())); + var queryResponse = await accounts.GetAccountBatchAsync(queryRequest); + foreach (var member in queryResponse.Accounts) { - AccountService.SetCultureInfo(member.Account); - await nty.SendNotification( - member.Account, - "posts.reactions.new", - localizer["PostReactTitle", sender.Nick], - null, - string.IsNullOrWhiteSpace(post.Title) - ? localizer["PostReactBody", sender.Nick, reaction.Symbol] - : localizer["PostReactContentBody", sender.Nick, reaction.Symbol, - post.Title], - actionUri: $"/posts/{post.Id}" + if (member is null) continue; + CultureService.SetCultureInfo(member); + + await nty.SendPushNotificationToUserAsync( + new SendPushNotificationToUserRequest + { + UserId = member.Id, + Notification = new PushNotification + { + Topic = "posts.reactions.new", + Title = localizer["PostReactTitle", sender.Nick], + Body = string.IsNullOrWhiteSpace(post.Title) + ? localizer["PostReactBody", sender.Nick, reaction.Symbol] + : localizer["PostReactContentBody", sender.Nick, reaction.Symbol, + post.Title], + IsSavable = true, + ActionUri = $"/posts/{post.Id}" + } + } ); } } @@ -563,7 +590,7 @@ public partial class PostService( return posts; } - public async Task> LoadInteractive(List posts, Account.Account? currentUser = null) + public async Task> LoadInteractive(List posts, Account? currentUser = null) { if (posts.Count == 0) return posts; @@ -586,7 +613,7 @@ public partial class PostService( // Track view for each post in the list if (currentUser != null) - await IncreaseViewCount(post.Id, currentUser.Id.ToString()); + await IncreaseViewCount(post.Id, currentUser.Id); else await IncreaseViewCount(post.Id); } @@ -605,8 +632,11 @@ public partial class PostService( ); } - public async Task> LoadPostInfo(List posts, Account.Account? currentUser = null, - bool truncate = false) + public async Task> LoadPostInfo( + List posts, + Account? currentUser = null, + bool truncate = false + ) { if (posts.Count == 0) return posts; @@ -619,7 +649,7 @@ public partial class PostService( return posts; } - public async Task LoadPostInfo(Post post, Account.Account? currentUser = null, bool truncate = false) + public async Task LoadPostInfo(Post post, Account? currentUser = null, bool truncate = false) { // Convert single post to list, process it, then return the single post var posts = await LoadPostInfo([post], currentUser, truncate); @@ -631,7 +661,7 @@ public static class PostQueryExtensions { public static IQueryable FilterWithVisibility( this IQueryable source, - Account.Account? currentUser, + Account? currentUser, List userFriends, List publishers, bool isListing = false diff --git a/DysonNetwork.Sphere/Publisher/Publisher.cs b/DysonNetwork.Sphere/Publisher/Publisher.cs index bae02ad..30975e4 100644 --- a/DysonNetwork.Sphere/Publisher/Publisher.cs +++ b/DysonNetwork.Sphere/Publisher/Publisher.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; +using DysonNetwork.Shared.Data; using DysonNetwork.Sphere.Post; -using DysonNetwork.Sphere.Storage; using Microsoft.EntityFrameworkCore; using NodaTime; @@ -30,7 +30,7 @@ public class Publisher : ModelBase, IIdentifiedResource [Column(TypeName = "jsonb")] public CloudFileReferenceObject? Picture { get; set; } [Column(TypeName = "jsonb")] public CloudFileReferenceObject? Background { get; set; } - [Column(TypeName = "jsonb")] public Account.VerificationMark? Verification { get; set; } + [Column(TypeName = "jsonb")] public VerificationMark? Verification { get; set; } [JsonIgnore] public ICollection Posts { get; set; } = new List(); [JsonIgnore] public ICollection Collections { get; set; } = new List(); @@ -41,11 +41,10 @@ public class Publisher : ModelBase, IIdentifiedResource public ICollection Subscriptions { get; set; } = new List(); public Guid? AccountId { get; set; } - public Account.Account? Account { get; set; } public Guid? RealmId { get; set; } [JsonIgnore] public Realm.Realm? Realm { get; set; } - public string ResourceIdentifier => $"publisher/{Id}"; + public string ResourceIdentifier => $"publisher:{Id}"; } public enum PublisherMemberRole @@ -61,7 +60,6 @@ public class PublisherMember : ModelBase public Guid PublisherId { get; set; } [JsonIgnore] public Publisher Publisher { get; set; } = null!; public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; public PublisherMemberRole Role { get; set; } = PublisherMemberRole.Viewer; public Instant? JoinedAt { get; set; } @@ -81,7 +79,6 @@ public class PublisherSubscription : ModelBase public Guid PublisherId { get; set; } [JsonIgnore] public Publisher Publisher { get; set; } = null!; public Guid AccountId { get; set; } - [JsonIgnore] public Account.Account Account { get; set; } = null!; public PublisherSubscriptionStatus Status { get; set; } = PublisherSubscriptionStatus.Active; public int Tier { get; set; } = 0; diff --git a/DysonNetwork.Sphere/Publisher/PublisherController.cs b/DysonNetwork.Sphere/Publisher/PublisherController.cs index 36dece4..aaa2ba8 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherController.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherController.cs @@ -49,7 +49,7 @@ public class PublisherController( [Authorize] public async Task>> ListManagedPublishers() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var members = await db.PublisherMembers @@ -65,7 +65,7 @@ public class PublisherController( [Authorize] public async Task>> ListInvites() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var members = await db.PublisherMembers @@ -88,7 +88,7 @@ public class PublisherController( public async Task> InviteMember(string name, [FromBody] PublisherMemberRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var relatedUser = await db.Accounts.FindAsync(request.RelatedUserId); @@ -128,7 +128,7 @@ public class PublisherController( [Authorize] public async Task> AcceptMemberInvite(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.PublisherMembers @@ -154,7 +154,7 @@ public class PublisherController( [Authorize] public async Task DeclineMemberInvite(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.PublisherMembers @@ -179,7 +179,7 @@ public class PublisherController( [Authorize] public async Task RemoveMember(string name, Guid memberId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await db.Publishers .Where(p => p.Name == name) @@ -224,7 +224,7 @@ public class PublisherController( [RequiredPermission("global", "publishers.create")] public async Task> CreatePublisherIndividual([FromBody] PublisherRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var takenName = request.Name ?? currentUser.Name; var duplicateNameCount = await db.Publishers @@ -274,7 +274,7 @@ public class PublisherController( public async Task> CreatePublisherOrganization(string realmSlug, [FromBody] PublisherRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms.FirstOrDefaultAsync(r => r.Slug == realmSlug); if (realm == null) return NotFound("Realm not found"); @@ -328,7 +328,7 @@ public class PublisherController( [Authorize] public async Task> UpdatePublisher(string name, PublisherRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var publisher = await db.Publishers @@ -405,7 +405,7 @@ public class PublisherController( [Authorize] public async Task> DeletePublisher(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var publisher = await db.Publishers @@ -473,7 +473,7 @@ public class PublisherController( [Authorize] public async Task> GetCurrentIdentity(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var publisher = await db.Publishers diff --git a/DysonNetwork.Sphere/Publisher/PublisherService.cs b/DysonNetwork.Sphere/Publisher/PublisherService.cs index 188829a..db7300c 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherService.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherService.cs @@ -1,12 +1,17 @@ +using DysonNetwork.Shared.Cache; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Post; -using DysonNetwork.Sphere.Storage; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Memory; using NodaTime; namespace DysonNetwork.Sphere.Publisher; -public class PublisherService(AppDatabase db, FileReferenceService fileRefService, ICacheService cache) +public class PublisherService( + AppDatabase db, + FileReferenceService.FileReferenceServiceClient fileRefs, + ICacheService cache +) { public async Task GetPublisherByName(string name) { @@ -20,12 +25,12 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic public async Task> GetUserPublishers(Guid userId) { var cacheKey = string.Format(UserPublishersCacheKey, userId); - + // Try to get publishers from the cache first var publishers = await cache.GetAsync>(cacheKey); if (publishers is not null) return publishers; - + // If not in cache, fetch from a database var publishersId = await db.PublisherMembers .Where(p => p.AccountId == userId) @@ -34,10 +39,10 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic publishers = await db.Publishers .Where(p => publishersId.Contains(p.Id)) .ToListAsync(); - + // Store in a cache for 5 minutes await cache.SetAsync(cacheKey, publishers, TimeSpan.FromMinutes(5)); - + return publishers; } @@ -92,11 +97,10 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic return result; } - - + public const string SubscribedPublishersCacheKey = "accounts:{0}:subscribed-publishers"; - + public async Task> GetSubscribedPublishers(Guid userId) { var cacheKey = string.Format(SubscribedPublishersCacheKey, userId); @@ -127,32 +131,30 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic public async Task> GetPublisherMembers(Guid publisherId) { var cacheKey = string.Format(PublisherMembersCacheKey, publisherId); - + // Try to get members from the cache first var members = await cache.GetAsync>(cacheKey); if (members is not null) return members; - + // If not in cache, fetch from a database members = await db.PublisherMembers .Where(p => p.PublisherId == publisherId) - .Include(p => p.Account) - .ThenInclude(p => p.Profile) .ToListAsync(); - + // Store in cache for 5 minutes (consistent with other cache durations in the class) await cache.SetAsync(cacheKey, members, TimeSpan.FromMinutes(5)); - + return members; } - + public async Task CreateIndividualPublisher( - Account.Account account, + Account account, string? name, string? nick, string? bio, - CloudFile? picture, - CloudFile? background + CloudFileReferenceObject? picture, + CloudFileReferenceObject? background ) { var publisher = new Publisher @@ -161,14 +163,14 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic Name = name ?? account.Name, Nick = nick ?? account.Nick, Bio = bio ?? account.Profile.Bio, - Picture = picture?.ToReferenceObject() ?? account.Profile.Picture, - Background = background?.ToReferenceObject() ?? account.Profile.Background, - AccountId = account.Id, + Picture = picture ?? CloudFileReferenceObject.FromProtoValue(account.Profile.Picture), + Background = background ?? CloudFileReferenceObject.FromProtoValue(account.Profile.Background), + AccountId = Guid.Parse(account.Id), Members = new List { new() { - AccountId = account.Id, + AccountId = Guid.Parse(account.Id), Role = PublisherMemberRole.Owner, JoinedAt = Instant.FromDateTimeUtc(DateTime.UtcNow) } @@ -178,21 +180,26 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic db.Publishers.Add(publisher); await db.SaveChangesAsync(); - var publisherResourceId = $"publisher:{publisher.Id}"; - - if (publisher.Picture is not null) { - await fileRefService.CreateReferenceAsync( - publisher.Picture.Id, - "publisher.picture", - publisherResourceId + if (publisher.Picture is not null) + { + await fileRefs.CreateReferenceAsync( + new CreateReferenceRequest + { + FileId = publisher.Picture.Id, + Usage = "publisher.picture", + ResourceId = publisher.ResourceIdentifier, + } ); } - - if (publisher.Background is not null) { - await fileRefService.CreateReferenceAsync( - publisher.Background.Id, - "publisher.background", - publisherResourceId + if (publisher.Background is not null) + { + await fileRefs.CreateReferenceAsync( + new CreateReferenceRequest + { + FileId = publisher.Background.Id, + Usage = "publisher.background", + ResourceId = publisher.ResourceIdentifier, + } ); } @@ -201,12 +208,12 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic public async Task CreateOrganizationPublisher( Realm.Realm realm, - Account.Account account, + Account account, string? name, string? nick, string? bio, - CloudFile? picture, - CloudFile? background + CloudFileReferenceObject? picture, + CloudFileReferenceObject? background ) { var publisher = new Publisher @@ -215,14 +222,14 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic Name = name ?? realm.Slug, Nick = nick ?? realm.Name, Bio = bio ?? realm.Description, - Picture = picture?.ToReferenceObject() ?? realm.Picture, - Background = background?.ToReferenceObject() ?? realm.Background, + Picture = picture ?? CloudFileReferenceObject.FromProtoValue(account.Profile.Picture), + Background = background ?? CloudFileReferenceObject.FromProtoValue(account.Profile.Background), RealmId = realm.Id, Members = new List { new() { - AccountId = account.Id, + AccountId = Guid.Parse(account.Id), Role = PublisherMemberRole.Owner, JoinedAt = Instant.FromDateTimeUtc(DateTime.UtcNow) } @@ -232,21 +239,26 @@ public class PublisherService(AppDatabase db, FileReferenceService fileRefServic db.Publishers.Add(publisher); await db.SaveChangesAsync(); - var publisherResourceId = $"publisher:{publisher.Id}"; - - if (publisher.Picture is not null) { - await fileRefService.CreateReferenceAsync( - publisher.Picture.Id, - "publisher.picture", - publisherResourceId + if (publisher.Picture is not null) + { + await fileRefs.CreateReferenceAsync( + new CreateReferenceRequest + { + FileId = publisher.Picture.Id, + Usage = "publisher.picture", + ResourceId = publisher.ResourceIdentifier, + } ); } - - if (publisher.Background is not null) { - await fileRefService.CreateReferenceAsync( - publisher.Background.Id, - "publisher.background", - publisherResourceId + if (publisher.Background is not null) + { + await fileRefs.CreateReferenceAsync( + new CreateReferenceRequest + { + FileId = publisher.Background.Id, + Usage = "publisher.background", + ResourceId = publisher.ResourceIdentifier, + } ); } diff --git a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionController.cs b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionController.cs index 727386f..b5270c4 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionController.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionController.cs @@ -30,7 +30,7 @@ public class PublisherSubscriptionController( [Authorize] public async Task> CheckSubscriptionStatus(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); // Check if the publisher exists var publisher = await db.Publishers.FirstOrDefaultAsync(p => p.Name == name); @@ -53,7 +53,7 @@ public class PublisherSubscriptionController( string name, [FromBody] SubscribeRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); // Check if the publisher exists var publisher = await db.Publishers.FirstOrDefaultAsync(p => p.Name == name); @@ -81,7 +81,7 @@ public class PublisherSubscriptionController( [Authorize] public async Task Unsubscribe(string name) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); // Check if the publisher exists var publisher = await db.Publishers.FirstOrDefaultAsync(e => e.Name == name); @@ -104,7 +104,7 @@ public class PublisherSubscriptionController( [Authorize] public async Task>> GetCurrentSubscriptions() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var subscriptions = await subs.GetAccountSubscriptionsAsync(currentUser.Id); return subscriptions; diff --git a/DysonNetwork.Sphere/Realm/Realm.cs b/DysonNetwork.Sphere/Realm/Realm.cs index 9a26322..fdd5d8c 100644 --- a/DysonNetwork.Sphere/Realm/Realm.cs +++ b/DysonNetwork.Sphere/Realm/Realm.cs @@ -32,9 +32,8 @@ public class Realm : ModelBase, IIdentifiedResource [JsonIgnore] public ICollection RealmTags { get; set; } = new List(); public Guid AccountId { get; set; } - [JsonIgnore] public Account.Account Account { get; set; } = null!; - public string ResourceIdentifier => $"realm/{Id}"; + public string ResourceIdentifier => $"realm:{Id}"; } public abstract class RealmMemberRole @@ -49,7 +48,7 @@ public class RealmMember : ModelBase public Guid RealmId { get; set; } public Realm Realm { get; set; } = null!; public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; + public Account Account { get; set; } = null!; public int Role { get; set; } = RealmMemberRole.Normal; public Instant? JoinedAt { get; set; } diff --git a/DysonNetwork.Sphere/Realm/RealmChatController.cs b/DysonNetwork.Sphere/Realm/RealmChatController.cs index 90d8fcf..61567e6 100644 --- a/DysonNetwork.Sphere/Realm/RealmChatController.cs +++ b/DysonNetwork.Sphere/Realm/RealmChatController.cs @@ -13,7 +13,7 @@ public class RealmChatController(AppDatabase db, RealmService rs) : ControllerBa [Authorize] public async Task>> ListRealmChat(string slug) { - var currentUser = HttpContext.Items["CurrentUser"] as Account.Account; + var currentUser = HttpContext.Items["CurrentUser"] as Account; var realm = await db.Realms .Where(r => r.Slug == slug) diff --git a/DysonNetwork.Sphere/Realm/RealmController.cs b/DysonNetwork.Sphere/Realm/RealmController.cs index 6e741c2..adc0603 100644 --- a/DysonNetwork.Sphere/Realm/RealmController.cs +++ b/DysonNetwork.Sphere/Realm/RealmController.cs @@ -34,7 +34,7 @@ public class RealmController( [Authorize] public async Task>> ListJoinedRealms() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var members = await db.RealmMembers @@ -52,7 +52,7 @@ public class RealmController( [Authorize] public async Task>> ListInvites() { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var members = await db.RealmMembers @@ -75,7 +75,7 @@ public class RealmController( public async Task> InviteMember(string slug, [FromBody] RealmMemberRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var relatedUser = await db.Accounts.FindAsync(request.RelatedUserId); @@ -126,7 +126,7 @@ public class RealmController( [Authorize] public async Task> AcceptMemberInvite(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.RealmMembers @@ -153,7 +153,7 @@ public class RealmController( [Authorize] public async Task DeclineMemberInvite(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.RealmMembers @@ -192,7 +192,7 @@ public class RealmController( if (!realm.IsPublic) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (!await rs.IsMemberWithRole(realm.Id, currentUser.Id, RealmMemberRole.Normal)) return StatusCode(403, "You must be a member to view this realm's members."); } @@ -249,7 +249,7 @@ public class RealmController( [Authorize] public async Task> GetCurrentIdentity(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.RealmMembers @@ -267,7 +267,7 @@ public class RealmController( [Authorize] public async Task LeaveRealm(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var userId = currentUser.Id; var member = await db.RealmMembers @@ -307,7 +307,7 @@ public class RealmController( [Authorize] public async Task> CreateRealm(RealmRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (string.IsNullOrWhiteSpace(request.Name)) return BadRequest("You cannot create a realm without a name."); if (string.IsNullOrWhiteSpace(request.Slug)) return BadRequest("You cannot create a realm without a slug."); @@ -380,7 +380,7 @@ public class RealmController( [Authorize] public async Task> Update(string slug, [FromBody] RealmRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms .Where(r => r.Slug == slug) @@ -466,7 +466,7 @@ public class RealmController( [Authorize] public async Task> JoinRealm(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms .Where(r => r.Slug == slug) @@ -506,7 +506,7 @@ public class RealmController( [Authorize] public async Task RemoveMember(string slug, Guid memberId) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms .Where(r => r.Slug == slug) @@ -538,7 +538,7 @@ public class RealmController( public async Task> UpdateMemberRole(string slug, Guid memberId, [FromBody] int newRole) { if (newRole >= RealmMemberRole.Owner) return BadRequest("Unable to set realm member to owner or greater role."); - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms .Where(r => r.Slug == slug) @@ -572,7 +572,7 @@ public class RealmController( [Authorize] public async Task Delete(string slug) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var realm = await db.Realms .Where(r => r.Slug == slug) diff --git a/DysonNetwork.Sphere/Safety/AbuseReportController.cs b/DysonNetwork.Sphere/Safety/AbuseReportController.cs index e1c9ed6..fdaba61 100644 --- a/DysonNetwork.Sphere/Safety/AbuseReportController.cs +++ b/DysonNetwork.Sphere/Safety/AbuseReportController.cs @@ -30,7 +30,7 @@ public class AbuseReportController( [ProducesResponseType(StatusCodes.Status400BadRequest)] public async Task> CreateReport([FromBody] CreateReportRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); try { @@ -75,7 +75,7 @@ public class AbuseReportController( [FromQuery] bool includeResolved = false ) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var totalCount = await safety.CountUserReports(currentUser.Id, includeResolved); var reports = await safety.GetUserReports(currentUser.Id, offset, take, includeResolved); @@ -101,7 +101,7 @@ public class AbuseReportController( [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task> GetMyReportById(Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var report = await safety.GetReportById(id); if (report == null) return NotFound(); diff --git a/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs b/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs index 8746f28..43cd0b1 100644 --- a/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs +++ b/DysonNetwork.Sphere/Startup/ScheduledJobsConfiguration.cs @@ -1,5 +1,5 @@ using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Connection.WebReader; +using DysonNetwork.Sphere.WebReader; using DysonNetwork.Sphere.Storage.Handlers; using DysonNetwork.Sphere.Wallet; using Quartz; diff --git a/DysonNetwork.Sphere/Startup/ServiceCollectionExtensions.cs b/DysonNetwork.Sphere/Startup/ServiceCollectionExtensions.cs index 4db2772..31d083f 100644 --- a/DysonNetwork.Sphere/Startup/ServiceCollectionExtensions.cs +++ b/DysonNetwork.Sphere/Startup/ServiceCollectionExtensions.cs @@ -1,22 +1,12 @@ using System.Globalization; -using DysonNetwork.Sphere.Account; using DysonNetwork.Sphere.Activity; -using DysonNetwork.Sphere.Auth; -using DysonNetwork.Sphere.Auth.OpenId; using DysonNetwork.Sphere.Chat; using DysonNetwork.Sphere.Chat.Realtime; -using DysonNetwork.Sphere.Connection; -using DysonNetwork.Sphere.Connection.Handlers; -using DysonNetwork.Sphere.Email; using DysonNetwork.Sphere.Localization; -using DysonNetwork.Sphere.Permission; using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Publisher; using DysonNetwork.Sphere.Realm; using DysonNetwork.Sphere.Sticker; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Storage.Handlers; -using DysonNetwork.Sphere.Wallet; using Microsoft.AspNetCore.RateLimiting; using Microsoft.OpenApi.Models; using NodaTime; @@ -24,14 +14,16 @@ using NodaTime.Serialization.SystemTextJson; using StackExchange.Redis; using System.Text.Json; using System.Threading.RateLimiting; -using DysonNetwork.Sphere.Auth.OidcProvider.Options; -using DysonNetwork.Sphere.Auth.OidcProvider.Services; -using DysonNetwork.Sphere.Connection.WebReader; +using DysonNetwork.Shared.Auth; +using DysonNetwork.Shared.Cache; +using DysonNetwork.Shared.GeoIp; +using DysonNetwork.Shared.Proto; +using DysonNetwork.Sphere.WebReader; using DysonNetwork.Sphere.Developer; using DysonNetwork.Sphere.Discovery; using DysonNetwork.Sphere.Safety; -using DysonNetwork.Sphere.Wallet.PaymentHandlers; using tusdotnet.Stores; +using PermissionService = DysonNetwork.Sphere.Permission.PermissionService; namespace DysonNetwork.Sphere.Startup; @@ -53,20 +45,6 @@ public static class ServiceCollectionExtensions services.AddHttpClient(); - // Register OIDC services - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; @@ -182,16 +160,6 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAppFlushHandlers(this IServiceCollection services) { services.AddSingleton(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - - // The handlers for websocket - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); return services; } @@ -199,25 +167,9 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAppBusinessServices(this IServiceCollection services, IConfiguration configuration) { - services.AddScoped(); - services.AddScoped(); services.Configure(configuration.GetSection("GeoIP")); services.AddScoped(); - services.AddScoped(); - services.AddScoped(); services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -226,20 +178,13 @@ public static class ServiceCollectionExtensions services.AddScoped(); services.AddScoped(); services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); - services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); - services.Configure(configuration.GetSection("OidcProvider")); - services.AddScoped(); - return services; } } \ No newline at end of file diff --git a/DysonNetwork.Sphere/Sticker/Sticker.cs b/DysonNetwork.Sphere/Sticker/Sticker.cs index e109cb5..a6dfc63 100644 --- a/DysonNetwork.Sphere/Sticker/Sticker.cs +++ b/DysonNetwork.Sphere/Sticker/Sticker.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using DysonNetwork.Sphere.Storage; +using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore; namespace DysonNetwork.Sphere.Sticker; @@ -19,7 +19,7 @@ public class Sticker : ModelBase, IIdentifiedResource public Guid PackId { get; set; } public StickerPack Pack { get; set; } = null!; - public string ResourceIdentifier => $"sticker/{Id}"; + public string ResourceIdentifier => $"sticker:{Id}"; } [Index(nameof(Prefix), IsUnique = true)] diff --git a/DysonNetwork.Sphere/Sticker/StickerController.cs b/DysonNetwork.Sphere/Sticker/StickerController.cs index 724afb4..7bbb840 100644 --- a/DysonNetwork.Sphere/Sticker/StickerController.cs +++ b/DysonNetwork.Sphere/Sticker/StickerController.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Permission; -using DysonNetwork.Sphere.Post; using DysonNetwork.Sphere.Publisher; -using DysonNetwork.Sphere.Storage; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -10,10 +10,13 @@ namespace DysonNetwork.Sphere.Sticker; [ApiController] [Route("/api/stickers")] -public class StickerController(AppDatabase db, StickerService st) : ControllerBase +public class StickerController(AppDatabase db, StickerService st, FileService.FileServiceClient files) : ControllerBase { - private async Task _CheckStickerPackPermissions(Guid packId, Account.Account currentUser, - PublisherMemberRole requiredRole) + private async Task _CheckStickerPackPermissions( + Guid packId, + Account currentUser, + PublisherMemberRole requiredRole + ) { var pack = await db.StickerPacks .Include(p => p.Publisher) @@ -22,8 +25,9 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (pack is null) return NotFound("Sticker pack not found"); + var accountId = Guid.Parse(currentUser.Id); var member = await db.PublisherMembers - .FirstOrDefaultAsync(m => m.AccountId == currentUser.Id && m.PublisherId == pack.PublisherId); + .FirstOrDefaultAsync(m => m.AccountId == accountId && m.PublisherId == pack.PublisherId); if (member is null) return StatusCode(403, "You are not a member of this publisher"); if (member.Role < requiredRole) @@ -78,7 +82,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [RequiredPermission("global", "stickers.packs.create")] public async Task> CreateStickerPack([FromBody] StickerPackRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (string.IsNullOrEmpty(request.Name)) return BadRequest("Name is required"); @@ -89,8 +93,9 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (string.IsNullOrEmpty(publisherName)) return BadRequest("Publisher name is required in X-Pub header"); + var accountId = Guid.Parse(currentUser.Id); var publisher = - await db.Publishers.FirstOrDefaultAsync(p => p.Name == publisherName && p.AccountId == currentUser.Id); + await db.Publishers.FirstOrDefaultAsync(p => p.Name == publisherName && p.AccountId == accountId); if (publisher == null) return BadRequest("Publisher not found"); @@ -110,7 +115,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [HttpPatch("{id:guid}")] public async Task> UpdateStickerPack(Guid id, [FromBody] StickerPackRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var pack = await db.StickerPacks @@ -119,8 +124,9 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (pack is null) return NotFound(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.PublisherMembers - .FirstOrDefaultAsync(m => m.AccountId == currentUser.Id && m.PublisherId == pack.PublisherId); + .FirstOrDefaultAsync(m => m.AccountId == accountId && m.PublisherId == pack.PublisherId); if (member is null) return StatusCode(403, "You are not a member of this publisher"); if (member.Role < PublisherMemberRole.Editor) @@ -141,7 +147,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [HttpDelete("{id:guid}")] public async Task DeleteStickerPack(Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var pack = await db.StickerPacks @@ -150,8 +156,9 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (pack is null) return NotFound(); + var accountId = Guid.Parse(currentUser.Id); var member = await db.PublisherMembers - .FirstOrDefaultAsync(m => m.AccountId == currentUser.Id && m.PublisherId == pack.PublisherId); + .FirstOrDefaultAsync(m => m.AccountId == accountId && m.PublisherId == pack.PublisherId); if (member is null) return StatusCode(403, "You are not a member of this publisher"); if (member.Role < PublisherMemberRole.Editor) @@ -212,7 +219,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [HttpPatch("{packId:guid}/content/{id:guid}")] public async Task UpdateSticker(Guid packId, Guid id, [FromBody] StickerRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var permissionCheck = await _CheckStickerPackPermissions(packId, currentUser, PublisherMemberRole.Editor); @@ -231,13 +238,14 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (request.Slug is not null) sticker.Slug = request.Slug; - CloudFile? image = null; + CloudFileReferenceObject? image = null; if (request.ImageId is not null) { - image = await db.Files.FirstOrDefaultAsync(e => e.Id == request.ImageId); - if (image is null) + var file = await files.GetFileAsync(new GetFileRequest { Id = request.ImageId }); + if (file is null) return BadRequest("Image not found"); sticker.ImageId = request.ImageId; + sticker.Image = CloudFileReferenceObject.FromProtoValue(file); } sticker = await st.UpdateStickerAsync(sticker, image); @@ -247,7 +255,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [HttpDelete("{packId:guid}/content/{id:guid}")] public async Task DeleteSticker(Guid packId, Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var permissionCheck = await _CheckStickerPackPermissions(packId, currentUser, PublisherMemberRole.Editor); @@ -273,7 +281,7 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa [RequiredPermission("global", "stickers.create")] public async Task CreateSticker(Guid packId, [FromBody] StickerRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (string.IsNullOrWhiteSpace(request.Slug)) @@ -295,15 +303,15 @@ public class StickerController(AppDatabase db, StickerService st) : ControllerBa if (stickersCount >= MaxStickersPerPack) return BadRequest($"Sticker pack has reached maximum capacity of {MaxStickersPerPack} stickers."); - var image = await db.Files.FirstOrDefaultAsync(e => e.Id == request.ImageId); - if (image is null) - return BadRequest("Image was not found."); + var file = await files.GetFileAsync(new GetFileRequest { Id = request.ImageId }); + if (file is null) + return BadRequest("Image not found."); var sticker = new Sticker { Slug = request.Slug, - ImageId = image.Id, - Image = image.ToReferenceObject(), + ImageId = file.Id, + Image = CloudFileReferenceObject.FromProtoValue(file), Pack = pack }; diff --git a/DysonNetwork.Sphere/Sticker/StickerService.cs b/DysonNetwork.Sphere/Sticker/StickerService.cs index 217b95c..cd4d01e 100644 --- a/DysonNetwork.Sphere/Sticker/StickerService.cs +++ b/DysonNetwork.Sphere/Sticker/StickerService.cs @@ -1,9 +1,16 @@ -using DysonNetwork.Sphere.Storage; +using DysonNetwork.Shared.Cache; +using DysonNetwork.Shared.Data; +using DysonNetwork.Shared.Proto; using Microsoft.EntityFrameworkCore; namespace DysonNetwork.Sphere.Sticker; -public class StickerService(AppDatabase db, FileService fs, FileReferenceService fileRefService, ICacheService cache) +public class StickerService( + AppDatabase db, + FileService.FileServiceClient files, + FileReferenceService.FileReferenceServiceClient fileRefs, + ICacheService cache +) { public const string StickerFileUsageIdentifier = "sticker"; @@ -26,7 +33,7 @@ public class StickerService(AppDatabase db, FileService fs, FileReferenceService return sticker; } - public async Task UpdateStickerAsync(Sticker sticker, CloudFile? newImage) + public async Task UpdateStickerAsync(Sticker sticker, CloudFileReferenceObject? newImage) { if (newImage is not null) { @@ -104,7 +111,7 @@ public class StickerService(AppDatabase db, FileService fs, FileReferenceService { identifier = identifier.ToLower(); // Try to get from the cache first - var cacheKey = $"stickerlookup:{identifier}"; + var cacheKey = $"sticker:lookup:{identifier}"; var cachedSticker = await cache.GetAsync(cacheKey); if (cachedSticker is not null) return cachedSticker; @@ -128,7 +135,7 @@ public class StickerService(AppDatabase db, FileService fs, FileReferenceService private async Task PurgeStickerCache(Sticker sticker) { // Remove both possible cache entries - await cache.RemoveAsync($"stickerlookup:{sticker.Id}"); - await cache.RemoveAsync($"stickerlookup:{sticker.Pack.Prefix}{sticker.Slug}"); + await cache.RemoveAsync($"sticker:lookup:{sticker.Id}"); + await cache.RemoveAsync($"sticker:lookup:{sticker.Pack.Prefix}{sticker.Slug}"); } } \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/CacheService.cs b/DysonNetwork.Sphere/Storage/CacheService.cs deleted file mode 100644 index 7562a0f..0000000 --- a/DysonNetwork.Sphere/Storage/CacheService.cs +++ /dev/null @@ -1,396 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using NodaTime; -using NodaTime.Serialization.JsonNet; -using StackExchange.Redis; - -namespace DysonNetwork.Sphere.Storage; - -/// -/// Represents a distributed lock that can be used to synchronize access across multiple processes -/// -public interface IDistributedLock : IAsyncDisposable -{ - /// - /// The resource identifier this lock is protecting - /// - string Resource { get; } - - /// - /// Unique identifier for this lock instance - /// - string LockId { get; } - - /// - /// Extends the lock's expiration time - /// - Task ExtendAsync(TimeSpan timeSpan); - - /// - /// Releases the lock immediately - /// - Task ReleaseAsync(); -} - -public interface ICacheService -{ - /// - /// Sets a value in the cache with an optional expiration time - /// - Task SetAsync(string key, T value, TimeSpan? expiry = null); - - /// - /// Gets a value from the cache - /// - Task GetAsync(string key); - - /// - /// Get a value from the cache with the found status - /// - Task<(bool found, T? value)> GetAsyncWithStatus(string key); - - /// - /// Removes a specific key from the cache - /// - Task RemoveAsync(string key); - - /// - /// Adds a key to a group for group-based operations - /// - Task AddToGroupAsync(string key, string group); - - /// - /// Removes all keys associated with a specific group - /// - Task RemoveGroupAsync(string group); - - /// - /// Gets all keys belonging to a specific group - /// - Task> GetGroupKeysAsync(string group); - - /// - /// Helper method to set a value in cache and associate it with multiple groups in one operation - /// - /// The type of value being cached - /// Cache key - /// The value to cache - /// Optional collection of group names to associate the key with - /// Optional expiration time for the cached item - /// True if the set operation was successful - Task SetWithGroupsAsync(string key, T value, IEnumerable? groups = null, TimeSpan? expiry = null); - - /// - /// Acquires a distributed lock on the specified resource - /// - /// The resource identifier to lock - /// How long the lock should be held before automatically expiring - /// How long to wait for the lock before giving up - /// How often to retry acquiring the lock during the wait time - /// A distributed lock instance if acquired, null otherwise - Task AcquireLockAsync(string resource, TimeSpan expiry, TimeSpan? waitTime = null, - TimeSpan? retryInterval = null); - - /// - /// Executes an action with a distributed lock, ensuring the lock is properly released afterwards - /// - /// The resource identifier to lock - /// The action to execute while holding the lock - /// How long the lock should be held before automatically expiring - /// How long to wait for the lock before giving up - /// How often to retry acquiring the lock during the wait time - /// True if the lock was acquired and the action was executed, false otherwise - Task ExecuteWithLockAsync(string resource, Func action, TimeSpan expiry, TimeSpan? waitTime = null, - TimeSpan? retryInterval = null); - - /// - /// Executes a function with a distributed lock, ensuring the lock is properly released afterwards - /// - /// The return type of the function - /// The resource identifier to lock - /// The function to execute while holding the lock - /// How long the lock should be held before automatically expiring - /// How long to wait for the lock before giving up - /// How often to retry acquiring the lock during the wait time - /// The result of the function if the lock was acquired, default(T) otherwise - Task<(bool Acquired, T? Result)> ExecuteWithLockAsync(string resource, Func> func, TimeSpan expiry, - TimeSpan? waitTime = null, TimeSpan? retryInterval = null); -} - -public class RedisDistributedLock : IDistributedLock -{ - private readonly IDatabase _database; - private bool _disposed; - - public string Resource { get; } - public string LockId { get; } - - internal RedisDistributedLock(IDatabase database, string resource, string lockId) - { - _database = database; - Resource = resource; - LockId = lockId; - } - - public async Task ExtendAsync(TimeSpan timeSpan) - { - if (_disposed) - throw new ObjectDisposedException(nameof(RedisDistributedLock)); - - var script = @" - if redis.call('get', KEYS[1]) == ARGV[1] then - return redis.call('pexpire', KEYS[1], ARGV[2]) - else - return 0 - end - "; - - var result = await _database.ScriptEvaluateAsync( - script, - [$"{CacheServiceRedis.LockKeyPrefix}{Resource}"], - [LockId, (long)timeSpan.TotalMilliseconds] - ); - - return (long)result! == 1; - } - - public async Task ReleaseAsync() - { - if (_disposed) - return; - - var script = @" - if redis.call('get', KEYS[1]) == ARGV[1] then - return redis.call('del', KEYS[1]) - else - return 0 - end - "; - - await _database.ScriptEvaluateAsync( - script, - [$"{CacheServiceRedis.LockKeyPrefix}{Resource}"], - [LockId] - ); - - _disposed = true; - } - - public async ValueTask DisposeAsync() - { - await ReleaseAsync(); - GC.SuppressFinalize(this); - } -} - -public class CacheServiceRedis : ICacheService -{ - private readonly IDatabase _database; - private readonly JsonSerializerSettings _serializerSettings; - - // Global prefix for all cache keys - public const string GlobalKeyPrefix = "dyson:"; - - // Using prefixes for different types of keys - public const string GroupKeyPrefix = GlobalKeyPrefix + "cg:"; - public const string LockKeyPrefix = GlobalKeyPrefix + "lock:"; - - public CacheServiceRedis(IConnectionMultiplexer redis) - { - var rds = redis ?? throw new ArgumentNullException(nameof(redis)); - _database = rds.GetDatabase(); - - // Configure Newtonsoft.Json with proper NodaTime serialization - _serializerSettings = new JsonSerializerSettings - { - ContractResolver = new CamelCasePropertyNamesContractResolver(), - PreserveReferencesHandling = PreserveReferencesHandling.Objects, - NullValueHandling = NullValueHandling.Include, - DateParseHandling = DateParseHandling.None - }; - - // Configure NodaTime serializers - _serializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); - } - - public async Task SetAsync(string key, T value, TimeSpan? expiry = null) - { - key = $"{GlobalKeyPrefix}{key}"; - if (string.IsNullOrEmpty(key)) - throw new ArgumentException("Key cannot be null or empty", nameof(key)); - - var serializedValue = JsonConvert.SerializeObject(value, _serializerSettings); - return await _database.StringSetAsync(key, serializedValue, expiry); - } - - public async Task GetAsync(string key) - { - key = $"{GlobalKeyPrefix}{key}"; - if (string.IsNullOrEmpty(key)) - throw new ArgumentException("Key cannot be null or empty", nameof(key)); - - var value = await _database.StringGetAsync(key); - - if (value.IsNullOrEmpty) - return default; - - // For NodaTime serialization, use the configured serializer settings - return JsonConvert.DeserializeObject(value!, _serializerSettings); - } - - public async Task<(bool found, T? value)> GetAsyncWithStatus(string key) - { - key = $"{GlobalKeyPrefix}{key}"; - if (string.IsNullOrEmpty(key)) - throw new ArgumentException("Key cannot be null or empty", nameof(key)); - - var value = await _database.StringGetAsync(key); - - if (value.IsNullOrEmpty) - return (false, default); - - // For NodaTime serialization, use the configured serializer settings - return (true, JsonConvert.DeserializeObject(value!, _serializerSettings)); - } - - public async Task RemoveAsync(string key) - { - key = $"{GlobalKeyPrefix}{key}"; - if (string.IsNullOrEmpty(key)) - throw new ArgumentException("Key cannot be null or empty", nameof(key)); - - // Before removing the key, find all groups it belongs to and remove it from them - var script = @" - local groups = redis.call('KEYS', ARGV[1]) - for _, group in ipairs(groups) do - redis.call('SREM', group, ARGV[2]) - end - return redis.call('DEL', ARGV[2]) - "; - - var result = await _database.ScriptEvaluateAsync( - script, - values: [$"{GroupKeyPrefix}*", key] - ); - - return (long)result! > 0; - } - - public async Task AddToGroupAsync(string key, string group) - { - if (string.IsNullOrEmpty(key)) - throw new ArgumentException(@"Key cannot be null or empty.", nameof(key)); - - if (string.IsNullOrEmpty(group)) - throw new ArgumentException(@"Group cannot be null or empty.", nameof(group)); - - var groupKey = $"{GroupKeyPrefix}{group}"; - key = $"{GlobalKeyPrefix}{key}"; - await _database.SetAddAsync(groupKey, key); - } - - public async Task RemoveGroupAsync(string group) - { - if (string.IsNullOrEmpty(group)) - throw new ArgumentException(@"Group cannot be null or empty.", nameof(group)); - - var groupKey = $"{GroupKeyPrefix}{group}"; - - // Get all keys in the group - var keys = await _database.SetMembersAsync(groupKey); - - if (keys.Length > 0) - { - // Delete all the keys - var keysTasks = keys.Select(key => _database.KeyDeleteAsync(key.ToString())); - await Task.WhenAll(keysTasks); - } - - // Delete the group itself - await _database.KeyDeleteAsync(groupKey); - } - - public async Task> GetGroupKeysAsync(string group) - { - if (string.IsNullOrEmpty(group)) - throw new ArgumentException(@"Group cannot be null or empty.", nameof(group)); - - var groupKey = $"{GroupKeyPrefix}{group}"; - var members = await _database.SetMembersAsync(groupKey); - - return members.Select(m => m.ToString()); - } - - public async Task SetWithGroupsAsync(string key, T value, IEnumerable? groups = null, - TimeSpan? expiry = null) - { - // First, set the value in the cache - var setResult = await SetAsync(key, value, expiry); - - // If successful and there are groups to associate, add the key to each group - if (!setResult || groups == null) return setResult; - var groupsArray = groups.Where(g => !string.IsNullOrEmpty(g)).ToArray(); - if (groupsArray.Length <= 0) return setResult; - var tasks = groupsArray.Select(group => AddToGroupAsync(key, group)); - await Task.WhenAll(tasks); - - return setResult; - } - - public async Task AcquireLockAsync(string resource, TimeSpan expiry, TimeSpan? waitTime = null, - TimeSpan? retryInterval = null) - { - if (string.IsNullOrEmpty(resource)) - throw new ArgumentException("Resource cannot be null or empty", nameof(resource)); - - var lockKey = $"{LockKeyPrefix}{resource}"; - var lockId = Guid.NewGuid().ToString("N"); - var waitTimeSpan = waitTime ?? TimeSpan.Zero; - var retryIntervalSpan = retryInterval ?? TimeSpan.FromMilliseconds(100); - - var startTime = DateTime.UtcNow; - var acquired = false; - - // Try to acquire the lock, retry until waitTime is exceeded - while (!acquired && (DateTime.UtcNow - startTime) < waitTimeSpan) - { - acquired = await _database.StringSetAsync(lockKey, lockId, expiry, When.NotExists); - - if (!acquired) - { - await Task.Delay(retryIntervalSpan); - } - } - - if (!acquired) - { - return null; // Could not acquire the lock within the wait time - } - - return new RedisDistributedLock(_database, resource, lockId); - } - - public async Task ExecuteWithLockAsync(string resource, Func action, TimeSpan expiry, - TimeSpan? waitTime = null, TimeSpan? retryInterval = null) - { - await using var lockObj = await AcquireLockAsync(resource, expiry, waitTime, retryInterval); - - if (lockObj == null) - return false; // Could not acquire the lock - - await action(); - return true; - } - - public async Task<(bool Acquired, T? Result)> ExecuteWithLockAsync(string resource, Func> func, - TimeSpan expiry, TimeSpan? waitTime = null, TimeSpan? retryInterval = null) - { - await using var lockObj = await AcquireLockAsync(resource, expiry, waitTime, retryInterval); - - if (lockObj == null) - return (false, default); // Could not acquire the lock - - var result = await func(); - return (true, result); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/CloudFile.cs b/DysonNetwork.Sphere/Storage/CloudFile.cs deleted file mode 100644 index 1cc1838..0000000 --- a/DysonNetwork.Sphere/Storage/CloudFile.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using NodaTime; - -namespace DysonNetwork.Sphere.Storage; - -public class RemoteStorageConfig -{ - public string Id { get; set; } = string.Empty; - public string Label { get; set; } = string.Empty; - public string Region { get; set; } = string.Empty; - public string Bucket { get; set; } = string.Empty; - public string Endpoint { get; set; } = string.Empty; - public string SecretId { get; set; } = string.Empty; - public string SecretKey { get; set; } = string.Empty; - public bool EnableSigned { get; set; } - public bool EnableSsl { get; set; } - public string? ImageProxy { get; set; } - public string? AccessProxy { get; set; } -} - -/// -/// The class that used in jsonb columns which referenced the cloud file. -/// The aim of this class is to store some properties that won't change to a file to reduce the database load. -/// -public class CloudFileReferenceObject : ModelBase, ICloudFile -{ - public string Id { get; set; } = null!; - public string Name { get; set; } = string.Empty; - public Dictionary? FileMeta { get; set; } = null!; - public Dictionary? UserMeta { get; set; } = null!; - public string? MimeType { get; set; } - public string? Hash { get; set; } - public long Size { get; set; } - public bool HasCompression { get; set; } = false; -} - -public class CloudFile : ModelBase, ICloudFile, IIdentifiedResource -{ - /// The id generated by TuS, basically just UUID remove the dash lines - [MaxLength(32)] - public string Id { get; set; } = Guid.NewGuid().ToString(); - - [MaxLength(1024)] public string Name { get; set; } = string.Empty; - [MaxLength(4096)] public string? Description { get; set; } - [Column(TypeName = "jsonb")] public Dictionary? FileMeta { get; set; } = null!; - [Column(TypeName = "jsonb")] public Dictionary? UserMeta { get; set; } = null!; - [Column(TypeName = "jsonb")] public List? SensitiveMarks { get; set; } = []; - [MaxLength(256)] public string? MimeType { get; set; } - [MaxLength(256)] public string? Hash { get; set; } - public long Size { get; set; } - public Instant? UploadedAt { get; set; } - [MaxLength(128)] public string? UploadedTo { get; set; } - public bool HasCompression { get; set; } = false; - - /// - /// The field is set to true if the recycling job plans to delete the file. - /// Due to the unstable of the recycling job, this doesn't really delete the file until a human verifies it. - /// - public bool IsMarkedRecycle { get; set; } = false; - - /// The object name which stored remotely, - /// multiple cloud file may have same storage id to indicate they are the same file - /// - /// If the storage id was null and the uploaded at is not null, means it is an embedding file, - /// The embedding file means the file is store on another site, - /// or it is a webpage (based on mimetype) - [MaxLength(32)] - public string? StorageId { get; set; } - - /// This field should be null when the storage id is filled - /// Indicates the off-site accessible url of the file - [MaxLength(4096)] - public string? StorageUrl { get; set; } - - [JsonIgnore] public Account.Account Account { get; set; } = null!; - public Guid AccountId { get; set; } - - public CloudFileReferenceObject ToReferenceObject() - { - return new CloudFileReferenceObject - { - CreatedAt = CreatedAt, - UpdatedAt = UpdatedAt, - DeletedAt = DeletedAt, - Id = Id, - Name = Name, - FileMeta = FileMeta, - UserMeta = UserMeta, - MimeType = MimeType, - Hash = Hash, - Size = Size, - HasCompression = HasCompression - }; - } - - public string ResourceIdentifier => $"file/{Id}"; -} - -public enum ContentSensitiveMark -{ - Language, - SexualContent, - Violence, - Profanity, - HateSpeech, - Racism, - AdultContent, - DrugAbuse, - AlcoholAbuse, - Gambling, - SelfHarm, - ChildAbuse, - Other -} - -public class CloudFileReference : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(32)] public string FileId { get; set; } = null!; - public CloudFile File { get; set; } = null!; - [MaxLength(1024)] public string Usage { get; set; } = null!; - [MaxLength(1024)] public string ResourceId { get; set; } = null!; - - /// - /// Optional expiration date for the file reference - /// - public Instant? ExpiredAt { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/CloudFileUnusedRecyclingJob.cs b/DysonNetwork.Sphere/Storage/CloudFileUnusedRecyclingJob.cs deleted file mode 100644 index 6b97a06..0000000 --- a/DysonNetwork.Sphere/Storage/CloudFileUnusedRecyclingJob.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Storage; - -public class CloudFileUnusedRecyclingJob( - AppDatabase db, - FileReferenceService fileRefService, - ILogger logger -) - : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - logger.LogInformation("Marking unused cloud files..."); - - var now = SystemClock.Instance.GetCurrentInstant(); - const int batchSize = 1000; // Process larger batches for efficiency - var processedCount = 0; - var markedCount = 0; - var totalFiles = await db.Files.Where(f => !f.IsMarkedRecycle).CountAsync(); - - logger.LogInformation("Found {TotalFiles} files to check for unused status", totalFiles); - - // Define a timestamp to limit the age of files we're processing in this run - // This spreads the processing across multiple job runs for very large databases - var ageThreshold = now - Duration.FromDays(30); // Process files up to 90 days old in this run - - // Instead of loading all files at once, use pagination - var hasMoreFiles = true; - string? lastProcessedId = null; - - while (hasMoreFiles) - { - // Query for the next batch of files using keyset pagination - var filesQuery = db.Files - .Where(f => !f.IsMarkedRecycle) - .Where(f => f.CreatedAt <= ageThreshold); // Only process older files first - - if (lastProcessedId != null) - { - filesQuery = filesQuery.Where(f => string.Compare(f.Id, lastProcessedId) > 0); - } - - var fileBatch = await filesQuery - .OrderBy(f => f.Id) // Ensure consistent ordering for pagination - .Take(batchSize) - .Select(f => f.Id) - .ToListAsync(); - - if (fileBatch.Count == 0) - { - hasMoreFiles = false; - continue; - } - - processedCount += fileBatch.Count; - lastProcessedId = fileBatch.Last(); - - // Get all relevant file references for this batch - var fileReferences = await fileRefService.GetReferencesAsync(fileBatch); - - // Filter to find files that have no references or all expired references - var filesToMark = fileBatch.Where(fileId => - !fileReferences.TryGetValue(fileId, out var references) || - references.Count == 0 || - references.All(r => r.ExpiredAt.HasValue && r.ExpiredAt.Value <= now) - ).ToList(); - - if (filesToMark.Count > 0) - { - // Use a bulk update for better performance - mark all qualifying files at once - var updateCount = await db.Files - .Where(f => filesToMark.Contains(f.Id)) - .ExecuteUpdateAsync(setter => setter - .SetProperty(f => f.IsMarkedRecycle, true)); - - markedCount += updateCount; - } - - // Log progress periodically - if (processedCount % 10000 == 0 || !hasMoreFiles) - { - logger.LogInformation( - "Progress: processed {ProcessedCount}/{TotalFiles} files, marked {MarkedCount} for recycling", - processedCount, totalFiles, markedCount); - } - } - - logger.LogInformation("Completed marking {MarkedCount} files for recycling", markedCount); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/FileController.cs b/DysonNetwork.Sphere/Storage/FileController.cs deleted file mode 100644 index d13f531..0000000 --- a/DysonNetwork.Sphere/Storage/FileController.cs +++ /dev/null @@ -1,154 +0,0 @@ -using DysonNetwork.Sphere.Permission; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Minio.DataModel.Args; - -namespace DysonNetwork.Sphere.Storage; - -[ApiController] -[Route("/api/files")] -public class FileController( - AppDatabase db, - FileService fs, - IConfiguration configuration, - IWebHostEnvironment env, - FileReferenceMigrationService rms -) : ControllerBase -{ - [HttpGet("{id}")] - public async Task OpenFile( - string id, - [FromQuery] bool download = false, - [FromQuery] bool original = false, - [FromQuery] string? overrideMimeType = null - ) - { - // Support the file extension for client side data recognize - string? fileExtension = null; - if (id.Contains('.')) - { - var splitId = id.Split('.'); - id = splitId.First(); - fileExtension = splitId.Last(); - } - - var file = await fs.GetFileAsync(id); - if (file is null) return NotFound(); - - if (!string.IsNullOrWhiteSpace(file.StorageUrl)) return Redirect(file.StorageUrl); - - if (file.UploadedTo is null) - { - var tusStorePath = configuration.GetValue("Tus:StorePath")!; - var filePath = Path.Combine(env.ContentRootPath, tusStorePath, file.Id); - if (!System.IO.File.Exists(filePath)) return new NotFoundResult(); - return PhysicalFile(filePath, file.MimeType ?? "application/octet-stream", file.Name); - } - - var dest = fs.GetRemoteStorageConfig(file.UploadedTo); - var fileName = string.IsNullOrWhiteSpace(file.StorageId) ? file.Id : file.StorageId; - - if (!original && file.HasCompression) - fileName += ".compressed"; - - if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false)) - { - var proxyUrl = dest.ImageProxy; - var baseUri = new Uri(proxyUrl.EndsWith('/') ? proxyUrl : $"{proxyUrl}/"); - var fullUri = new Uri(baseUri, fileName); - return Redirect(fullUri.ToString()); - } - - if (dest.AccessProxy is not null) - { - var proxyUrl = dest.AccessProxy; - var baseUri = new Uri(proxyUrl.EndsWith('/') ? proxyUrl : $"{proxyUrl}/"); - var fullUri = new Uri(baseUri, fileName); - return Redirect(fullUri.ToString()); - } - - if (dest.EnableSigned) - { - var client = fs.CreateMinioClient(dest); - if (client is null) - return BadRequest( - "Failed to configure client for remote destination, file got an invalid storage remote."); - - var headers = new Dictionary(); - if (fileExtension is not null) - { - if (MimeTypes.TryGetMimeType(fileExtension, out var mimeType)) - headers.Add("Response-Content-Type", mimeType); - } - else if (overrideMimeType is not null) - { - headers.Add("Response-Content-Type", overrideMimeType); - } - else if (file.MimeType is not null && !file.MimeType!.EndsWith("unknown")) - { - headers.Add("Response-Content-Type", file.MimeType); - } - - if (download) - { - headers.Add("Response-Content-Disposition", $"attachment; filename=\"{file.Name}\""); - } - - var bucket = dest.Bucket; - var openUrl = await client.PresignedGetObjectAsync( - new PresignedGetObjectArgs() - .WithBucket(bucket) - .WithObject(fileName) - .WithExpiry(3600) - .WithHeaders(headers) - ); - - return Redirect(openUrl); - } - - // Fallback redirect to the S3 endpoint (public read) - var protocol = dest.EnableSsl ? "https" : "http"; - // Use the path bucket lookup mode - return Redirect($"{protocol}://{dest.Endpoint}/{dest.Bucket}/{fileName}"); - } - - [HttpGet("{id}/info")] - public async Task> GetFileInfo(string id) - { - var file = await db.Files.FindAsync(id); - if (file is null) return NotFound(); - - return file; - } - - [Authorize] - [HttpDelete("{id}")] - public async Task DeleteFile(string id) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - var userId = currentUser.Id; - - var file = await db.Files - .Where(e => e.Id == id) - .Where(e => e.Account.Id == userId) - .FirstOrDefaultAsync(); - if (file is null) return NotFound(); - - await fs.DeleteFileAsync(file); - - db.Files.Remove(file); - await db.SaveChangesAsync(); - - return NoContent(); - } - - [HttpPost("/maintenance/migrateReferences")] - [Authorize] - [RequiredPermission("maintenance", "files.references")] - public async Task MigrateFileReferences() - { - await rms.ScanAndMigrateReferences(); - return Ok(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/FileExpirationJob.cs b/DysonNetwork.Sphere/Storage/FileExpirationJob.cs deleted file mode 100644 index 50ccc17..0000000 --- a/DysonNetwork.Sphere/Storage/FileExpirationJob.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Storage; - -/// -/// Job responsible for cleaning up expired file references -/// -public class FileExpirationJob(AppDatabase db, FileService fileService, ILogger logger) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - var now = SystemClock.Instance.GetCurrentInstant(); - logger.LogInformation("Running file reference expiration job at {now}", now); - - // Find all expired references - var expiredReferences = await db.FileReferences - .Where(r => r.ExpiredAt < now && r.ExpiredAt != null) - .ToListAsync(); - - if (!expiredReferences.Any()) - { - logger.LogInformation("No expired file references found"); - return; - } - - logger.LogInformation("Found {count} expired file references", expiredReferences.Count); - - // Get unique file IDs - var fileIds = expiredReferences.Select(r => r.FileId).Distinct().ToList(); - var filesAndReferenceCount = new Dictionary(); - - // Delete expired references - db.FileReferences.RemoveRange(expiredReferences); - await db.SaveChangesAsync(); - - // Check remaining references for each file - foreach (var fileId in fileIds) - { - var remainingReferences = await db.FileReferences - .Where(r => r.FileId == fileId) - .CountAsync(); - - filesAndReferenceCount[fileId] = remainingReferences; - - // If no references remain, delete the file - if (remainingReferences == 0) - { - var file = await db.Files.FirstOrDefaultAsync(f => f.Id == fileId); - if (file != null) - { - logger.LogInformation("Deleting file {fileId} as all references have expired", fileId); - await fileService.DeleteFileAsync(file); - } - } - else - { - // Just purge the cache - await fileService._PurgeCacheAsync(fileId); - } - } - - logger.LogInformation("Completed file reference expiration job"); - } -} diff --git a/DysonNetwork.Sphere/Storage/FileReferenceService.cs b/DysonNetwork.Sphere/Storage/FileReferenceService.cs deleted file mode 100644 index 6c92682..0000000 --- a/DysonNetwork.Sphere/Storage/FileReferenceService.cs +++ /dev/null @@ -1,433 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Storage; - -public class FileReferenceService(AppDatabase db, FileService fileService, ICacheService cache) -{ - private const string CacheKeyPrefix = "fileref:"; - private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(15); - - /// - /// Creates a new reference to a file for a specific resource - /// - /// The ID of the file to reference - /// The usage context (e.g., "avatar", "post-attachment") - /// The ID of the resource using the file - /// Optional expiration time for the file - /// Optional duration after which the file expires (alternative to expiredAt) - /// The created file reference - public async Task CreateReferenceAsync( - string fileId, - string usage, - string resourceId, - Instant? expiredAt = null, - Duration? duration = null) - { - // Calculate expiration time if needed - var finalExpiration = expiredAt; - if (duration.HasValue) - finalExpiration = SystemClock.Instance.GetCurrentInstant() + duration.Value; - - var reference = new CloudFileReference - { - FileId = fileId, - Usage = usage, - ResourceId = resourceId, - ExpiredAt = finalExpiration - }; - - db.FileReferences.Add(reference); - - await db.SaveChangesAsync(); - await fileService._PurgeCacheAsync(fileId); - - return reference; - } - - /// - /// Gets all references to a file - /// - /// The ID of the file - /// A list of all references to the file - public async Task> GetReferencesAsync(string fileId) - { - var cacheKey = $"{CacheKeyPrefix}list:{fileId}"; - - var cachedReferences = await cache.GetAsync>(cacheKey); - if (cachedReferences is not null) - return cachedReferences; - - var references = await db.FileReferences - .Where(r => r.FileId == fileId) - .ToListAsync(); - - await cache.SetAsync(cacheKey, references, CacheDuration); - - return references; - } - - public async Task>> GetReferencesAsync(IEnumerable fileId) - { - var references = await db.FileReferences - .Where(r => fileId.Contains(r.FileId)) - .GroupBy(r => r.FileId) - .ToDictionaryAsync(r => r.Key, r => r.ToList()); - return references; - } - - /// - /// Gets the number of references to a file - /// - /// The ID of the file - /// The number of references to the file - public async Task GetReferenceCountAsync(string fileId) - { - var cacheKey = $"{CacheKeyPrefix}count:{fileId}"; - - var cachedCount = await cache.GetAsync(cacheKey); - if (cachedCount.HasValue) - return cachedCount.Value; - - var count = await db.FileReferences - .Where(r => r.FileId == fileId) - .CountAsync(); - - await cache.SetAsync(cacheKey, count, CacheDuration); - - return count; - } - - /// - /// Gets all references for a specific resource - /// - /// The ID of the resource - /// A list of file references associated with the resource - public async Task> GetResourceReferencesAsync(string resourceId) - { - var cacheKey = $"{CacheKeyPrefix}resource:{resourceId}"; - - var cachedReferences = await cache.GetAsync>(cacheKey); - if (cachedReferences is not null) - return cachedReferences; - - var references = await db.FileReferences - .Where(r => r.ResourceId == resourceId) - .ToListAsync(); - - await cache.SetAsync(cacheKey, references, CacheDuration); - - return references; - } - - /// - /// Gets all file references for a specific usage context - /// - /// The usage context - /// A list of file references with the specified usage - public async Task> GetUsageReferencesAsync(string usage) - { - return await db.FileReferences - .Where(r => r.Usage == usage) - .ToListAsync(); - } - - /// - /// Deletes references for a specific resource - /// - /// The ID of the resource - /// The number of deleted references - public async Task DeleteResourceReferencesAsync(string resourceId) - { - var references = await db.FileReferences - .Where(r => r.ResourceId == resourceId) - .ToListAsync(); - - var fileIds = references.Select(r => r.FileId).Distinct().ToList(); - - db.FileReferences.RemoveRange(references); - var deletedCount = await db.SaveChangesAsync(); - - // Purge caches - var tasks = fileIds.Select(fileService._PurgeCacheAsync).ToList(); - tasks.Add(PurgeCacheForResourceAsync(resourceId)); - await Task.WhenAll(tasks); - - return deletedCount; - } - - /// - /// Deletes references for a specific resource and usage - /// - /// The ID of the resource - /// The usage context - /// The number of deleted references - public async Task DeleteResourceReferencesAsync(string resourceId, string usage) - { - var references = await db.FileReferences - .Where(r => r.ResourceId == resourceId && r.Usage == usage) - .ToListAsync(); - - if (!references.Any()) - { - return 0; - } - - var fileIds = references.Select(r => r.FileId).Distinct().ToList(); - - db.FileReferences.RemoveRange(references); - var deletedCount = await db.SaveChangesAsync(); - - // Purge caches - var tasks = fileIds.Select(fileService._PurgeCacheAsync).ToList(); - tasks.Add(PurgeCacheForResourceAsync(resourceId)); - await Task.WhenAll(tasks); - - return deletedCount; - } - - /// - /// Deletes a specific file reference - /// - /// The ID of the reference to delete - /// True if the reference was deleted, false otherwise - public async Task DeleteReferenceAsync(Guid referenceId) - { - var reference = await db.FileReferences - .FirstOrDefaultAsync(r => r.Id == referenceId); - - if (reference == null) - return false; - - db.FileReferences.Remove(reference); - await db.SaveChangesAsync(); - - // Purge caches - await fileService._PurgeCacheAsync(reference.FileId); - await PurgeCacheForResourceAsync(reference.ResourceId); - await PurgeCacheForFileAsync(reference.FileId); - - return true; - } - - /// - /// Updates the files referenced by a resource - /// - /// The ID of the resource - /// The new list of file IDs - /// The usage context - /// Optional expiration time for newly added files - /// Optional duration after which newly added files expire - /// A list of the updated file references - public async Task> UpdateResourceFilesAsync( - string resourceId, - IEnumerable? newFileIds, - string usage, - Instant? expiredAt = null, - Duration? duration = null) - { - if (newFileIds == null) - return new List(); - - var existingReferences = await db.FileReferences - .Where(r => r.ResourceId == resourceId && r.Usage == usage) - .ToListAsync(); - - var existingFileIds = existingReferences.Select(r => r.FileId).ToHashSet(); - var newFileIdsList = newFileIds.ToList(); - var newFileIdsSet = newFileIdsList.ToHashSet(); - - // Files to remove - var toRemove = existingReferences - .Where(r => !newFileIdsSet.Contains(r.FileId)) - .ToList(); - - // Files to add - var toAdd = newFileIdsList - .Where(id => !existingFileIds.Contains(id)) - .Select(id => new CloudFileReference - { - FileId = id, - Usage = usage, - ResourceId = resourceId - }) - .ToList(); - - // Apply changes - if (toRemove.Any()) - db.FileReferences.RemoveRange(toRemove); - - if (toAdd.Any()) - db.FileReferences.AddRange(toAdd); - - await db.SaveChangesAsync(); - - // Update expiration for newly added references if specified - if ((expiredAt.HasValue || duration.HasValue) && toAdd.Any()) - { - var finalExpiration = expiredAt; - if (duration.HasValue) - { - finalExpiration = SystemClock.Instance.GetCurrentInstant() + duration.Value; - } - - // Update newly added references with the expiration time - var referenceIds = await db.FileReferences - .Where(r => toAdd.Select(a => a.FileId).Contains(r.FileId) && - r.ResourceId == resourceId && - r.Usage == usage) - .Select(r => r.Id) - .ToListAsync(); - - await db.FileReferences - .Where(r => referenceIds.Contains(r.Id)) - .ExecuteUpdateAsync(setter => setter.SetProperty( - r => r.ExpiredAt, - _ => finalExpiration - )); - } - - // Purge caches - var allFileIds = existingFileIds.Union(newFileIdsSet).ToList(); - var tasks = allFileIds.Select(fileService._PurgeCacheAsync).ToList(); - tasks.Add(PurgeCacheForResourceAsync(resourceId)); - await Task.WhenAll(tasks); - - // Return updated references - return await db.FileReferences - .Where(r => r.ResourceId == resourceId && r.Usage == usage) - .ToListAsync(); - } - - /// - /// Gets all files referenced by a resource - /// - /// The ID of the resource - /// Optional filter by usage context - /// A list of files referenced by the resource - public async Task> GetResourceFilesAsync(string resourceId, string? usage = null) - { - var query = db.FileReferences.Where(r => r.ResourceId == resourceId); - - if (usage != null) - query = query.Where(r => r.Usage == usage); - - var references = await query.ToListAsync(); - var fileIds = references.Select(r => r.FileId).ToList(); - - return await db.Files - .Where(f => fileIds.Contains(f.Id)) - .ToListAsync(); - } - - /// - /// Purges all caches related to a resource - /// - private async Task PurgeCacheForResourceAsync(string resourceId) - { - var cacheKey = $"{CacheKeyPrefix}resource:{resourceId}"; - await cache.RemoveAsync(cacheKey); - } - - /// - /// Purges all caches related to a file - /// - private async Task PurgeCacheForFileAsync(string fileId) - { - var cacheKeys = new[] - { - $"{CacheKeyPrefix}list:{fileId}", - $"{CacheKeyPrefix}count:{fileId}" - }; - - var tasks = cacheKeys.Select(cache.RemoveAsync); - await Task.WhenAll(tasks); - } - - /// - /// Updates the expiration time for a file reference - /// - /// The ID of the reference - /// The new expiration time, or null to remove expiration - /// True if the reference was found and updated, false otherwise - public async Task SetReferenceExpirationAsync(Guid referenceId, Instant? expiredAt) - { - var reference = await db.FileReferences - .FirstOrDefaultAsync(r => r.Id == referenceId); - - if (reference == null) - return false; - - reference.ExpiredAt = expiredAt; - await db.SaveChangesAsync(); - - await PurgeCacheForFileAsync(reference.FileId); - await PurgeCacheForResourceAsync(reference.ResourceId); - - return true; - } - - /// - /// Updates the expiration time for all references to a file - /// - /// The ID of the file - /// The new expiration time, or null to remove expiration - /// The number of references updated - public async Task SetFileReferencesExpirationAsync(string fileId, Instant? expiredAt) - { - var rowsAffected = await db.FileReferences - .Where(r => r.FileId == fileId) - .ExecuteUpdateAsync(setter => setter.SetProperty( - r => r.ExpiredAt, - _ => expiredAt - )); - - if (rowsAffected > 0) - { - await fileService._PurgeCacheAsync(fileId); - await PurgeCacheForFileAsync(fileId); - } - - return rowsAffected; - } - - /// - /// Get all file references for a specific resource and usage type - /// - /// The resource ID - /// The usage type - /// List of file references - public async Task> GetResourceReferencesAsync(string resourceId, string usageType) - { - return await db.FileReferences - .Where(r => r.ResourceId == resourceId && r.Usage == usageType) - .ToListAsync(); - } - - /// - /// Check if a file has any references - /// - /// The file ID to check - /// True if the file has references, false otherwise - public async Task HasFileReferencesAsync(string fileId) - { - return await db.FileReferences.AnyAsync(r => r.FileId == fileId); - } - - /// - /// Updates the expiration time for a file reference using a duration from now - /// - /// The ID of the reference - /// The duration after which the reference expires, or null to remove expiration - /// True if the reference was found and updated, false otherwise - public async Task SetReferenceExpirationDurationAsync(Guid referenceId, Duration? duration) - { - Instant? expiredAt = null; - if (duration.HasValue) - { - expiredAt = SystemClock.Instance.GetCurrentInstant() + duration.Value; - } - - return await SetReferenceExpirationAsync(referenceId, expiredAt); - } -} diff --git a/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs b/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs deleted file mode 100644 index cec315a..0000000 --- a/DysonNetwork.Sphere/Storage/FileService.ReferenceMigration.cs +++ /dev/null @@ -1,339 +0,0 @@ -using EFCore.BulkExtensions; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Storage; - -public class FileReferenceMigrationService(AppDatabase db) -{ - public async Task ScanAndMigrateReferences() - { - // Scan Posts for file references - await ScanPosts(); - - // Scan Messages for file references - await ScanMessages(); - - // Scan Profiles for file references - await ScanProfiles(); - - // Scan Chat entities for file references - await ScanChatRooms(); - - // Scan Realms for file references - await ScanRealms(); - - // Scan Publishers for file references - await ScanPublishers(); - - // Scan Stickers for file references - await ScanStickers(); - } - - private async Task ScanPosts() - { - var posts = await db.Posts - .Include(p => p.OutdatedAttachments) - .Where(p => p.OutdatedAttachments.Any()) - .ToListAsync(); - - foreach (var post in posts) - { - var updatedAttachments = new List(); - - foreach (var attachment in post.OutdatedAttachments) - { - var file = await db.Files.FirstOrDefaultAsync(f => f.Id == attachment.Id); - if (file != null) - { - // Create a reference for the file - var reference = new CloudFileReference - { - FileId = file.Id, - File = file, - Usage = "post", - ResourceId = post.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - updatedAttachments.Add(file.ToReferenceObject()); - } - else - { - // Keep the existing reference object if file not found - updatedAttachments.Add(attachment.ToReferenceObject()); - } - } - - post.Attachments = updatedAttachments; - db.Posts.Update(post); - } - - await db.SaveChangesAsync(); - } - - private async Task ScanMessages() - { - var messages = await db.ChatMessages - .Include(m => m.OutdatedAttachments) - .Where(m => m.OutdatedAttachments.Any()) - .ToListAsync(); - - var fileReferences = messages.SelectMany(message => message.OutdatedAttachments.Select(attachment => - new CloudFileReference - { - FileId = attachment.Id, - File = attachment, - Usage = "chat", - ResourceId = message.ResourceIdentifier, - CreatedAt = SystemClock.Instance.GetCurrentInstant(), - UpdatedAt = SystemClock.Instance.GetCurrentInstant() - }) - ).ToList(); - - foreach (var message in messages) - { - message.Attachments = message.OutdatedAttachments.Select(a => a.ToReferenceObject()).ToList(); - db.ChatMessages.Update(message); - } - - await db.BulkInsertAsync(fileReferences); - await db.SaveChangesAsync(); - } - - private async Task ScanProfiles() - { - var profiles = await db.AccountProfiles - .Where(p => p.PictureId != null || p.BackgroundId != null) - .ToListAsync(); - - foreach (var profile in profiles) - { - if (profile is { PictureId: not null, Picture: null }) - { - var avatarFile = await db.Files.FirstOrDefaultAsync(f => f.Id == profile.PictureId); - if (avatarFile != null) - { - // Create a reference for the avatar file - var reference = new CloudFileReference - { - FileId = avatarFile.Id, - File = avatarFile, - Usage = "profile.picture", - ResourceId = profile.Id.ToString() - }; - - await db.FileReferences.AddAsync(reference); - profile.Picture = avatarFile.ToReferenceObject(); - db.AccountProfiles.Update(profile); - } - } - - // Also check for the banner if it exists - if (profile is not { BackgroundId: not null, Background: null }) continue; - var bannerFile = await db.Files.FirstOrDefaultAsync(f => f.Id == profile.BackgroundId); - if (bannerFile == null) continue; - { - // Create a reference for the banner file - var reference = new CloudFileReference - { - FileId = bannerFile.Id, - File = bannerFile, - Usage = "profile.background", - ResourceId = profile.Id.ToString() - }; - - await db.FileReferences.AddAsync(reference); - profile.Background = bannerFile.ToReferenceObject(); - db.AccountProfiles.Update(profile); - } - } - - await db.SaveChangesAsync(); - } - - private async Task ScanChatRooms() - { - var chatRooms = await db.ChatRooms - .Where(c => c.PictureId != null || c.BackgroundId != null) - .ToListAsync(); - - foreach (var chatRoom in chatRooms) - { - if (chatRoom is { PictureId: not null, Picture: null }) - { - var avatarFile = await db.Files.FirstOrDefaultAsync(f => f.Id == chatRoom.PictureId); - if (avatarFile != null) - { - // Create a reference for the avatar file - var reference = new CloudFileReference - { - FileId = avatarFile.Id, - File = avatarFile, - Usage = "chatroom.picture", - ResourceId = chatRoom.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - chatRoom.Picture = avatarFile.ToReferenceObject(); - db.ChatRooms.Update(chatRoom); - } - } - - if (chatRoom is not { BackgroundId: not null, Background: null }) continue; - var bannerFile = await db.Files.FirstOrDefaultAsync(f => f.Id == chatRoom.BackgroundId); - if (bannerFile == null) continue; - { - // Create a reference for the banner file - var reference = new CloudFileReference - { - FileId = bannerFile.Id, - File = bannerFile, - Usage = "chatroom.background", - ResourceId = chatRoom.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - chatRoom.Background = bannerFile.ToReferenceObject(); - db.ChatRooms.Update(chatRoom); - } - } - - await db.SaveChangesAsync(); - } - - private async Task ScanRealms() - { - var realms = await db.Realms - .Where(r => r.PictureId != null && r.BackgroundId != null) - .ToListAsync(); - - foreach (var realm in realms) - { - // Process avatar if it exists - if (realm is { PictureId: not null, Picture: null }) - { - var avatarFile = await db.Files.FirstOrDefaultAsync(f => f.Id == realm.PictureId); - if (avatarFile != null) - { - // Create a reference for the avatar file - var reference = new CloudFileReference - { - FileId = avatarFile.Id, - File = avatarFile, - Usage = "realm.picture", - ResourceId = realm.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - realm.Picture = avatarFile.ToReferenceObject(); - } - } - - // Process banner if it exists - if (realm is { BackgroundId: not null, Background: null }) - { - var bannerFile = await db.Files.FirstOrDefaultAsync(f => f.Id == realm.BackgroundId); - if (bannerFile != null) - { - // Create a reference for the banner file - var reference = new CloudFileReference - { - FileId = bannerFile.Id, - File = bannerFile, - Usage = "realm.background", - ResourceId = realm.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - realm.Background = bannerFile.ToReferenceObject(); - } - } - - db.Realms.Update(realm); - } - - await db.SaveChangesAsync(); - } - - private async Task ScanPublishers() - { - var publishers = await db.Publishers - .Where(p => p.PictureId != null || p.BackgroundId != null) - .ToListAsync(); - - foreach (var publisher in publishers) - { - if (publisher is { PictureId: not null, Picture: null }) - { - var pictureFile = await db.Files.FirstOrDefaultAsync(f => f.Id == publisher.PictureId); - if (pictureFile != null) - { - // Create a reference for the picture file - var reference = new CloudFileReference - { - FileId = pictureFile.Id, - File = pictureFile, - Usage = "publisher.picture", - ResourceId = publisher.Id.ToString() - }; - - await db.FileReferences.AddAsync(reference); - publisher.Picture = pictureFile.ToReferenceObject(); - } - } - - if (publisher is { BackgroundId: not null, Background: null }) - { - var backgroundFile = await db.Files.FirstOrDefaultAsync(f => f.Id == publisher.BackgroundId); - if (backgroundFile != null) - { - // Create a reference for the background file - var reference = new CloudFileReference - { - FileId = backgroundFile.Id, - File = backgroundFile, - Usage = "publisher.background", - ResourceId = publisher.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - publisher.Background = backgroundFile.ToReferenceObject(); - } - } - - db.Publishers.Update(publisher); - } - - await db.SaveChangesAsync(); - } - - private async Task ScanStickers() - { - var stickers = await db.Stickers - .Where(s => s.ImageId != null && s.Image == null) - .ToListAsync(); - - foreach (var sticker in stickers) - { - var imageFile = await db.Files.FirstOrDefaultAsync(f => f.Id == sticker.ImageId); - if (imageFile != null) - { - // Create a reference for the sticker image file - var reference = new CloudFileReference - { - FileId = imageFile.Id, - File = imageFile, - Usage = "sticker.image", - ResourceId = sticker.ResourceIdentifier - }; - - await db.FileReferences.AddAsync(reference); - sticker.Image = imageFile.ToReferenceObject(); - db.Stickers.Update(sticker); - } - } - - await db.SaveChangesAsync(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/FileService.cs b/DysonNetwork.Sphere/Storage/FileService.cs deleted file mode 100644 index d7d70fa..0000000 --- a/DysonNetwork.Sphere/Storage/FileService.cs +++ /dev/null @@ -1,555 +0,0 @@ -using System.Globalization; -using FFMpegCore; -using System.Security.Cryptography; -using AngleSharp.Text; -using Microsoft.EntityFrameworkCore; -using Minio; -using Minio.DataModel.Args; -using NetVips; -using NodaTime; -using tusdotnet.Stores; - -namespace DysonNetwork.Sphere.Storage; - -public class FileService( - AppDatabase db, - IConfiguration configuration, - TusDiskStore store, - ILogger logger, - IServiceScopeFactory scopeFactory, - ICacheService cache -) -{ - private const string CacheKeyPrefix = "file:"; - private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(15); - - /// - /// The api for getting file meta with cache, - /// the best use case is for accessing the file data. - /// - /// This function won't load uploader's information, only keep minimal file meta - /// - /// The id of the cloud file requested - /// The minimal file meta - public async Task GetFileAsync(string fileId) - { - var cacheKey = $"{CacheKeyPrefix}{fileId}"; - - var cachedFile = await cache.GetAsync(cacheKey); - if (cachedFile is not null) - return cachedFile; - - var file = await db.Files - .Include(f => f.Account) - .Where(f => f.Id == fileId) - .FirstOrDefaultAsync(); - - if (file != null) - await cache.SetAsync(cacheKey, file, CacheDuration); - - return file; - } - - private static readonly string TempFilePrefix = "dyn-cloudfile"; - - private static readonly string[] AnimatedImageTypes = - ["image/gif", "image/apng", "image/webp", "image/avif"]; - - // The analysis file method no longer will remove the GPS EXIF data - // It should be handled on the client side, and for some specific cases it should be keep - public async Task ProcessNewFileAsync( - Account.Account account, - string fileId, - Stream stream, - string fileName, - string? contentType - ) - { - var result = new List<(string filePath, string suffix)>(); - - var ogFilePath = Path.GetFullPath(Path.Join(configuration.GetValue("Tus:StorePath"), fileId)); - var fileSize = stream.Length; - var hash = await HashFileAsync(stream, fileSize: fileSize); - contentType ??= !fileName.Contains('.') ? "application/octet-stream" : MimeTypes.GetMimeType(fileName); - - var file = new CloudFile - { - Id = fileId, - Name = fileName, - MimeType = contentType, - Size = fileSize, - Hash = hash, - AccountId = account.Id - }; - - var existingFile = await db.Files.FirstOrDefaultAsync(f => f.Hash == hash); - file.StorageId = existingFile is not null ? existingFile.StorageId : file.Id; - - if (existingFile is not null) - { - file.FileMeta = existingFile.FileMeta; - file.HasCompression = existingFile.HasCompression; - file.SensitiveMarks = existingFile.SensitiveMarks; - - db.Files.Add(file); - await db.SaveChangesAsync(); - return file; - } - - switch (contentType.Split('/')[0]) - { - case "image": - var blurhash = - BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(xComponent: 3, yComponent: 3, filename: ogFilePath); - - // Rewind stream - stream.Position = 0; - - // Use NetVips for the rest - using (var vipsImage = NetVips.Image.NewFromStream(stream)) - { - var width = vipsImage.Width; - var height = vipsImage.Height; - var format = vipsImage.Get("vips-loader") ?? "unknown"; - - // Try to get orientation from exif data - var orientation = 1; - var meta = new Dictionary - { - ["blur"] = blurhash, - ["format"] = format, - ["width"] = width, - ["height"] = height, - ["orientation"] = orientation, - }; - Dictionary exif = []; - - foreach (var field in vipsImage.GetFields()) - { - var value = vipsImage.Get(field); - - // Skip GPS-related EXIF fields to remove location data - if (IsIgnoredField(field)) - continue; - - if (field.StartsWith("exif-")) exif[field.Replace("exif-", "")] = value; - else meta[field] = value; - - if (field == "orientation") orientation = (int)value; - } - - if (orientation is 6 or 8) - (width, height) = (height, width); - - var aspectRatio = height != 0 ? (double)width / height : 0; - - meta["exif"] = exif; - meta["ratio"] = aspectRatio; - file.FileMeta = meta; - } - - break; - case "video": - case "audio": - try - { - var mediaInfo = await FFProbe.AnalyseAsync(ogFilePath); - file.FileMeta = new Dictionary - { - ["duration"] = mediaInfo.Duration.TotalSeconds, - ["format_name"] = mediaInfo.Format.FormatName, - ["format_long_name"] = mediaInfo.Format.FormatLongName, - ["start_time"] = mediaInfo.Format.StartTime.ToString(), - ["bit_rate"] = mediaInfo.Format.BitRate.ToString(CultureInfo.InvariantCulture), - ["tags"] = mediaInfo.Format.Tags ?? [], - ["chapters"] = mediaInfo.Chapters, - }; - if (mediaInfo.PrimaryVideoStream is not null) - file.FileMeta["ratio"] = mediaInfo.PrimaryVideoStream.Width / mediaInfo.PrimaryVideoStream.Height; - } - catch (Exception ex) - { - logger.LogError("File analyzed failed, unable collect video / audio information: {Message}", - ex.Message); - } - - break; - } - - db.Files.Add(file); - await db.SaveChangesAsync(); - - _ = Task.Run(async () => - { - using var scope = scopeFactory.CreateScope(); - var nfs = scope.ServiceProvider.GetRequiredService(); - - try - { - logger.LogInformation("Processed file {fileId}, now trying optimizing if possible...", fileId); - - if (contentType.Split('/')[0] == "image") - { - // Skip compression for animated image types - var animatedMimeTypes = AnimatedImageTypes; - if (Enumerable.Contains(animatedMimeTypes, contentType)) - { - logger.LogInformation( - "File {fileId} is an animated image (MIME: {mime}), skipping WebP conversion.", fileId, - contentType - ); - var tempFilePath = Path.Join(Path.GetTempPath(), $"{TempFilePrefix}#{file.Id}"); - result.Add((tempFilePath, string.Empty)); - return; - } - - file.MimeType = "image/webp"; - - using var vipsImage = Image.NewFromFile(ogFilePath); - var imagePath = Path.Join(Path.GetTempPath(), $"{TempFilePrefix}#{file.Id}"); - vipsImage.Autorot().WriteToFile(imagePath + ".webp", - new VOption { { "lossless", true }, { "strip", true } }); - result.Add((imagePath + ".webp", string.Empty)); - - if (vipsImage.Width * vipsImage.Height >= 1024 * 1024) - { - var scale = 1024.0 / Math.Max(vipsImage.Width, vipsImage.Height); - var imageCompressedPath = - Path.Join(Path.GetTempPath(), $"{TempFilePrefix}#{file.Id}-compressed"); - - // Create and save image within the same synchronous block to avoid disposal issues - using var compressedImage = vipsImage.Resize(scale); - compressedImage.Autorot().WriteToFile(imageCompressedPath + ".webp", - new VOption { { "Q", 80 }, { "strip", true } }); - - result.Add((imageCompressedPath + ".webp", ".compressed")); - file.HasCompression = true; - } - } - else - { - // No extra process for video, add it to the upload queue. - result.Add((ogFilePath, string.Empty)); - } - - logger.LogInformation("Optimized file {fileId}, now uploading...", fileId); - - if (result.Count > 0) - { - List> tasks = []; - tasks.AddRange(result.Select(item => - nfs.UploadFileToRemoteAsync(file, item.filePath, null, item.suffix, true)) - ); - - await Task.WhenAll(tasks); - file = await tasks.First(); - } - else - { - file = await nfs.UploadFileToRemoteAsync(file, stream, null); - } - - logger.LogInformation("Uploaded file {fileId} done!", fileId); - - var scopedDb = scope.ServiceProvider.GetRequiredService(); - await scopedDb.Files.Where(f => f.Id == file.Id).ExecuteUpdateAsync(setter => setter - .SetProperty(f => f.UploadedAt, file.UploadedAt) - .SetProperty(f => f.UploadedTo, file.UploadedTo) - .SetProperty(f => f.MimeType, file.MimeType) - .SetProperty(f => f.HasCompression, file.HasCompression) - ); - } - catch (Exception err) - { - logger.LogError(err, "Failed to process {fileId}", fileId); - } - - await stream.DisposeAsync(); - await store.DeleteFileAsync(file.Id, CancellationToken.None); - await nfs._PurgeCacheAsync(file.Id); - }); - - return file; - } - - private static async Task HashFileAsync(Stream stream, int chunkSize = 1024 * 1024, long? fileSize = null) - { - fileSize ??= stream.Length; - if (fileSize > chunkSize * 1024 * 5) - return await HashFastApproximateAsync(stream, chunkSize); - - using var md5 = MD5.Create(); - var hashBytes = await md5.ComputeHashAsync(stream); - return Convert.ToHexString(hashBytes).ToLowerInvariant(); - } - - private static async Task HashFastApproximateAsync(Stream stream, int chunkSize = 1024 * 1024) - { - // Scale the chunk size to kB level - chunkSize *= 1024; - - using var md5 = MD5.Create(); - - var buffer = new byte[chunkSize * 2]; - var fileLength = stream.Length; - - var bytesRead = await stream.ReadAsync(buffer.AsMemory(0, chunkSize)); - - if (fileLength > chunkSize) - { - stream.Seek(-chunkSize, SeekOrigin.End); - bytesRead += await stream.ReadAsync(buffer.AsMemory(chunkSize, chunkSize)); - } - - var hash = md5.ComputeHash(buffer, 0, bytesRead); - return Convert.ToHexString(hash).ToLowerInvariant(); - } - - public async Task UploadFileToRemoteAsync(CloudFile file, string filePath, string? targetRemote, - string? suffix = null, bool selfDestruct = false) - { - var fileStream = File.OpenRead(filePath); - var result = await UploadFileToRemoteAsync(file, fileStream, targetRemote, suffix); - if (selfDestruct) File.Delete(filePath); - return result; - } - - public async Task UploadFileToRemoteAsync(CloudFile file, Stream stream, string? targetRemote, - string? suffix = null) - { - if (file.UploadedAt.HasValue) return file; - - file.UploadedTo = targetRemote ?? configuration.GetValue("Storage:PreferredRemote")!; - - var dest = GetRemoteStorageConfig(file.UploadedTo); - var client = CreateMinioClient(dest); - if (client is null) - throw new InvalidOperationException( - $"Failed to configure client for remote destination '{file.UploadedTo}'" - ); - - var bucket = dest.Bucket; - var contentType = file.MimeType ?? "application/octet-stream"; - - await client.PutObjectAsync(new PutObjectArgs() - .WithBucket(bucket) - .WithObject(string.IsNullOrWhiteSpace(suffix) ? file.Id : file.Id + suffix) - .WithStreamData(stream) // Fix this disposed - .WithObjectSize(stream.Length) - .WithContentType(contentType) - ); - - file.UploadedAt = Instant.FromDateTimeUtc(DateTime.UtcNow); - return file; - } - - public async Task DeleteFileAsync(CloudFile file) - { - await DeleteFileDataAsync(file); - - db.Remove(file); - await db.SaveChangesAsync(); - await _PurgeCacheAsync(file.Id); - } - - public async Task DeleteFileDataAsync(CloudFile file) - { - if (file.StorageId is null) return; - if (file.UploadedTo is null) return; - - // Check if any other file with the same storage ID is referenced - var otherFilesWithSameStorageId = await db.Files - .Where(f => f.StorageId == file.StorageId && f.Id != file.Id) - .Select(f => f.Id) - .ToListAsync(); - - // Check if any of these files are referenced - var anyReferenced = false; - if (otherFilesWithSameStorageId.Any()) - { - anyReferenced = await db.FileReferences - .Where(r => otherFilesWithSameStorageId.Contains(r.FileId)) - .AnyAsync(); - } - - // If any other file with the same storage ID is referenced, don't delete the actual file data - if (anyReferenced) return; - - var dest = GetRemoteStorageConfig(file.UploadedTo); - var client = CreateMinioClient(dest); - if (client is null) - throw new InvalidOperationException( - $"Failed to configure client for remote destination '{file.UploadedTo}'" - ); - - var bucket = dest.Bucket; - var objectId = file.StorageId ?? file.Id; // Use StorageId if available, otherwise fall back to Id - - await client.RemoveObjectAsync( - new RemoveObjectArgs().WithBucket(bucket).WithObject(objectId) - ); - - if (file.HasCompression) - { - // Also remove the compressed version if it exists - try - { - await client.RemoveObjectAsync( - new RemoveObjectArgs().WithBucket(bucket).WithObject(objectId + ".compressed") - ); - } - catch - { - // Ignore errors when deleting compressed version - logger.LogWarning("Failed to delete compressed version of file {fileId}", file.Id); - } - } - } - - public RemoteStorageConfig GetRemoteStorageConfig(string destination) - { - var destinations = configuration.GetSection("Storage:Remote").Get>()!; - var dest = destinations.FirstOrDefault(d => d.Id == destination); - if (dest is null) throw new InvalidOperationException($"Remote destination '{destination}' not found"); - return dest; - } - - public IMinioClient? CreateMinioClient(RemoteStorageConfig dest) - { - var client = new MinioClient() - .WithEndpoint(dest.Endpoint) - .WithRegion(dest.Region) - .WithCredentials(dest.SecretId, dest.SecretKey); - if (dest.EnableSsl) client = client.WithSSL(); - - return client.Build(); - } - - // Helper method to purge the cache for a specific file - // Made internal to allow FileReferenceService to use it - internal async Task _PurgeCacheAsync(string fileId) - { - var cacheKey = $"{CacheKeyPrefix}{fileId}"; - await cache.RemoveAsync(cacheKey); - } - - // Helper method to purge cache for multiple files - internal async Task _PurgeCacheRangeAsync(IEnumerable fileIds) - { - var tasks = fileIds.Select(_PurgeCacheAsync); - await Task.WhenAll(tasks); - } - - public async Task> LoadFromReference(List references) - { - var cachedFiles = new Dictionary(); - var uncachedIds = new List(); - - // Check cache first - foreach (var reference in references) - { - var cacheKey = $"{CacheKeyPrefix}{reference.Id}"; - var cachedFile = await cache.GetAsync(cacheKey); - - if (cachedFile != null) - { - cachedFiles[reference.Id] = cachedFile; - } - else - { - uncachedIds.Add(reference.Id); - } - } - - // Load uncached files from database - if (uncachedIds.Count > 0) - { - var dbFiles = await db.Files - .Include(f => f.Account) - .Where(f => uncachedIds.Contains(f.Id)) - .ToListAsync(); - - // Add to cache - foreach (var file in dbFiles) - { - var cacheKey = $"{CacheKeyPrefix}{file.Id}"; - await cache.SetAsync(cacheKey, file, CacheDuration); - cachedFiles[file.Id] = file; - } - } - - // Preserve original order - return references - .Select(r => cachedFiles.GetValueOrDefault(r.Id)) - .Where(f => f != null) - .ToList(); - } - - /// - /// Gets the number of references to a file based on CloudFileReference records - /// - /// The ID of the file - /// The number of references to the file - public async Task GetReferenceCountAsync(string fileId) - { - return await db.FileReferences - .Where(r => r.FileId == fileId) - .CountAsync(); - } - - /// - /// Checks if a file is referenced by any resource - /// - /// The ID of the file to check - /// True if the file is referenced, false otherwise - public async Task IsReferencedAsync(string fileId) - { - return await db.FileReferences - .Where(r => r.FileId == fileId) - .AnyAsync(); - } - - /// - /// Checks if an EXIF field contains GPS location data - /// - /// The EXIF field name - /// True if the field contains GPS data, false otherwise - private static bool IsGpsExifField(string fieldName) - { - // Common GPS EXIF field names - var gpsFields = new[] - { - "gps-latitude", - "gps-longitude", - "gps-altitude", - "gps-latitude-ref", - "gps-longitude-ref", - "gps-altitude-ref", - "gps-timestamp", - "gps-datestamp", - "gps-speed", - "gps-speed-ref", - "gps-track", - "gps-track-ref", - "gps-img-direction", - "gps-img-direction-ref", - "gps-dest-latitude", - "gps-dest-longitude", - "gps-dest-latitude-ref", - "gps-dest-longitude-ref", - "gps-processing-method", - "gps-area-information" - }; - - return gpsFields.Any(gpsField => - fieldName.Equals(gpsField, StringComparison.OrdinalIgnoreCase) || - fieldName.StartsWith("gps", StringComparison.OrdinalIgnoreCase)); - } - - private static bool IsIgnoredField(string fieldName) - { - if (IsGpsExifField(fieldName)) return true; - if (fieldName.EndsWith("-data")) return true; - return false; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/FlushBufferService.cs b/DysonNetwork.Sphere/Storage/FlushBufferService.cs deleted file mode 100644 index 43dd6d8..0000000 --- a/DysonNetwork.Sphere/Storage/FlushBufferService.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.Collections.Concurrent; - -namespace DysonNetwork.Sphere.Storage; - -public interface IFlushHandler -{ - Task FlushAsync(IReadOnlyList items); -} - -public class FlushBufferService -{ - private readonly Dictionary _buffers = new(); - private readonly Lock _lockObject = new(); - - private ConcurrentQueue _GetOrCreateBuffer() - { - var type = typeof(T); - lock (_lockObject) - { - if (!_buffers.TryGetValue(type, out var buffer)) - { - buffer = new ConcurrentQueue(); - _buffers[type] = buffer; - } - return (ConcurrentQueue)buffer; - } - } - - public void Enqueue(T item) - { - var buffer = _GetOrCreateBuffer(); - buffer.Enqueue(item); - } - - public async Task FlushAsync(IFlushHandler handler) - { - var buffer = _GetOrCreateBuffer(); - var workingQueue = new List(); - - while (buffer.TryDequeue(out var item)) - { - workingQueue.Add(item); - } - - if (workingQueue.Count == 0) - return; - - try - { - await handler.FlushAsync(workingQueue); - } - catch (Exception) - { - // If flush fails, re-queue the items - foreach (var item in workingQueue) - buffer.Enqueue(item); - throw; - } - } - - public int GetPendingCount() - { - var buffer = _GetOrCreateBuffer(); - return buffer.Count; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/Handlers/ActionLogFlushHandler.cs b/DysonNetwork.Sphere/Storage/Handlers/ActionLogFlushHandler.cs deleted file mode 100644 index f71e8a4..0000000 --- a/DysonNetwork.Sphere/Storage/Handlers/ActionLogFlushHandler.cs +++ /dev/null @@ -1,24 +0,0 @@ -using DysonNetwork.Sphere.Account; -using EFCore.BulkExtensions; -using Quartz; - -namespace DysonNetwork.Sphere.Storage.Handlers; - -public class ActionLogFlushHandler(IServiceProvider serviceProvider) : IFlushHandler -{ - public async Task FlushAsync(IReadOnlyList items) - { - using var scope = serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); - - await db.BulkInsertAsync(items, config => config.ConflictOption = ConflictOption.Ignore); - } -} - -public class ActionLogFlushJob(FlushBufferService fbs, ActionLogFlushHandler hdl) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - await fbs.FlushAsync(hdl); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/Handlers/LastActiveFlushHandler.cs b/DysonNetwork.Sphere/Storage/Handlers/LastActiveFlushHandler.cs deleted file mode 100644 index 9546c03..0000000 --- a/DysonNetwork.Sphere/Storage/Handlers/LastActiveFlushHandler.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Storage.Handlers; - -public class LastActiveInfo -{ - public Auth.Session Session { get; set; } = null!; - public Account.Account Account { get; set; } = null!; - public Instant SeenAt { get; set; } -} - -public class LastActiveFlushHandler(IServiceProvider serviceProvider) : IFlushHandler -{ - public async Task FlushAsync(IReadOnlyList items) - { - using var scope = serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); - - // Remove duplicates by grouping on (sessionId, accountId), taking the most recent SeenAt - var distinctItems = items - .GroupBy(x => (SessionId: x.Session.Id, AccountId: x.Account.Id)) - .Select(g => g.OrderByDescending(x => x.SeenAt).First()) - .ToList(); - - // Build dictionaries so we can match session/account IDs to their new "last seen" timestamps - var sessionIdMap = distinctItems - .GroupBy(x => x.Session.Id) - .ToDictionary(g => g.Key, g => g.Last().SeenAt); - - var accountIdMap = distinctItems - .GroupBy(x => x.Account.Id) - .ToDictionary(g => g.Key, g => g.Last().SeenAt); - - // Update sessions using native EF Core ExecuteUpdateAsync - foreach (var kvp in sessionIdMap) - { - await db.AuthSessions - .Where(s => s.Id == kvp.Key) - .ExecuteUpdateAsync(s => s.SetProperty(x => x.LastGrantedAt, kvp.Value)); - } - - // Update account profiles using native EF Core ExecuteUpdateAsync - foreach (var kvp in accountIdMap) - { - await db.AccountProfiles - .Where(a => a.AccountId == kvp.Key) - .ExecuteUpdateAsync(a => a.SetProperty(x => x.LastSeenAt, kvp.Value)); - } - } -} - -public class LastActiveFlushJob(FlushBufferService fbs, ActionLogFlushHandler hdl) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - await fbs.FlushAsync(hdl); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/Handlers/MessageReadReceiptFlushHandler.cs b/DysonNetwork.Sphere/Storage/Handlers/MessageReadReceiptFlushHandler.cs deleted file mode 100644 index fb07245..0000000 --- a/DysonNetwork.Sphere/Storage/Handlers/MessageReadReceiptFlushHandler.cs +++ /dev/null @@ -1,33 +0,0 @@ -using DysonNetwork.Sphere.Chat; -using EFCore.BulkExtensions; -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Storage.Handlers; - -public class MessageReadReceiptFlushHandler(IServiceProvider serviceProvider) : IFlushHandler -{ - public async Task FlushAsync(IReadOnlyList items) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var distinctId = items - .DistinctBy(x => x.SenderId) - .Select(x => x.SenderId) - .ToList(); - - using var scope = serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); - await db.ChatMembers.Where(r => distinctId.Contains(r.Id)) - .ExecuteUpdateAsync(s => s.SetProperty(m => m.LastReadAt, now) - ); - } -} - -public class ReadReceiptFlushJob(FlushBufferService fbs, MessageReadReceiptFlushHandler hdl) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - await fbs.FlushAsync(hdl); - } -} diff --git a/DysonNetwork.Sphere/Storage/Handlers/PostViewFlushHandler.cs b/DysonNetwork.Sphere/Storage/Handlers/PostViewFlushHandler.cs deleted file mode 100644 index 1984ec0..0000000 --- a/DysonNetwork.Sphere/Storage/Handlers/PostViewFlushHandler.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Storage.Handlers; - -public class PostViewFlushHandler(IServiceProvider serviceProvider) : IFlushHandler -{ - public async Task FlushAsync(IReadOnlyList items) - { - using var scope = serviceProvider.CreateScope(); - var db = scope.ServiceProvider.GetRequiredService(); - var cache = scope.ServiceProvider.GetRequiredService(); - - // Group views by post - var postViews = items - .GroupBy(x => x.PostId) - .ToDictionary(g => g.Key, g => g.ToList()); - - // Calculate total views and unique views per post - foreach (var postId in postViews.Keys) - { - // Calculate unique views by distinct viewer IDs (not null) - var uniqueViews = postViews[postId] - .Where(v => !string.IsNullOrEmpty(v.ViewerId)) - .Select(v => v.ViewerId) - .Distinct() - .Count(); - - // Total views is just the count of all items for this post - var totalViews = postViews[postId].Count; - - // Update the post in the database - await db.Posts - .Where(p => p.Id == postId) - .ExecuteUpdateAsync(p => p - .SetProperty(x => x.ViewsTotal, x => x.ViewsTotal + totalViews) - .SetProperty(x => x.ViewsUnique, x => x.ViewsUnique + uniqueViews)); - - // Invalidate any cache entries for this post - await cache.RemoveAsync($"post:{postId}"); - } - } -} - -public class PostViewFlushJob(FlushBufferService fbs, PostViewFlushHandler hdl) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - await fbs.FlushAsync(hdl); - } -} diff --git a/DysonNetwork.Sphere/Storage/ICloudFile.cs b/DysonNetwork.Sphere/Storage/ICloudFile.cs deleted file mode 100644 index 4a10851..0000000 --- a/DysonNetwork.Sphere/Storage/ICloudFile.cs +++ /dev/null @@ -1,55 +0,0 @@ -using NodaTime; - -namespace DysonNetwork.Sphere.Storage; - -/// -/// Common interface for cloud file entities that can be used in file operations. -/// This interface exposes the essential properties needed for file operations -/// and is implemented by both CloudFile and CloudFileReferenceObject. -/// -public interface ICloudFile -{ - public Instant CreatedAt { get; } - public Instant UpdatedAt { get; } - public Instant? DeletedAt { get; } - - /// - /// Gets the unique identifier of the cloud file. - /// - string Id { get; } - - /// - /// Gets the name of the cloud file. - /// - string Name { get; } - - /// - /// Gets the file metadata dictionary. - /// - Dictionary? FileMeta { get; } - - /// - /// Gets the user metadata dictionary. - /// - Dictionary? UserMeta { get; } - - /// - /// Gets the MIME type of the file. - /// - string? MimeType { get; } - - /// - /// Gets the hash of the file content. - /// - string? Hash { get; } - - /// - /// Gets the size of the file in bytes. - /// - long Size { get; } - - /// - /// Gets whether the file has a compressed version available. - /// - bool HasCompression { get; } -} diff --git a/DysonNetwork.Sphere/Storage/TextSanitizer.cs b/DysonNetwork.Sphere/Storage/TextSanitizer.cs deleted file mode 100644 index 82a45c6..0000000 --- a/DysonNetwork.Sphere/Storage/TextSanitizer.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Globalization; -using System.Text; - -namespace DysonNetwork.Sphere.Storage; - -public abstract class TextSanitizer -{ - public static string? Sanitize(string? text) - { - if (string.IsNullOrEmpty(text)) return text; - - // List of control characters to preserve - var preserveControlChars = new[] { '\n', '\r', '\t', ' ' }; - - var filtered = new StringBuilder(); - foreach (var ch in text) - { - var category = CharUnicodeInfo.GetUnicodeCategory(ch); - - // Keep whitespace and other specified control characters - if (category is not UnicodeCategory.Control || preserveControlChars.Contains(ch)) - { - // Still filter out Format and NonSpacingMark categories - if (category is not (UnicodeCategory.Format or UnicodeCategory.NonSpacingMark)) - { - filtered.Append(ch); - } - } - } - - return filtered.ToString(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Storage/TusService.cs b/DysonNetwork.Sphere/Storage/TusService.cs deleted file mode 100644 index 6c25c0b..0000000 --- a/DysonNetwork.Sphere/Storage/TusService.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Net; -using System.Text; -using System.Text.Json; -using DysonNetwork.Sphere.Permission; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using tusdotnet.Interfaces; -using tusdotnet.Models; -using tusdotnet.Models.Configuration; - -namespace DysonNetwork.Sphere.Storage; - -public abstract class TusService -{ - public static DefaultTusConfiguration BuildConfiguration(ITusStore store) => new() - { - Store = store, - Events = new Events - { - OnAuthorizeAsync = async eventContext => - { - if (eventContext.Intent == IntentType.DeleteFile) - { - eventContext.FailRequest( - HttpStatusCode.BadRequest, - "Deleting files from this endpoint was disabled, please refer to the Dyson Network File API." - ); - return; - } - - var httpContext = eventContext.HttpContext; - if (httpContext.Items["CurrentUser"] is not Account.Account user) - { - eventContext.FailRequest(HttpStatusCode.Unauthorized); - return; - } - - if (!user.IsSuperuser) - { - using var scope = httpContext.RequestServices.CreateScope(); - var pm = scope.ServiceProvider.GetRequiredService(); - var allowed = await pm.HasPermissionAsync($"user:{user.Id}", "global", "files.create"); - if (!allowed) - eventContext.FailRequest(HttpStatusCode.Forbidden); - } - }, - OnFileCompleteAsync = async eventContext => - { - using var scope = eventContext.HttpContext.RequestServices.CreateScope(); - var services = scope.ServiceProvider; - - var httpContext = eventContext.HttpContext; - if (httpContext.Items["CurrentUser"] is not Account.Account user) return; - - var file = await eventContext.GetFileAsync(); - var metadata = await file.GetMetadataAsync(eventContext.CancellationToken); - var fileName = metadata.TryGetValue("filename", out var fn) - ? fn.GetString(Encoding.UTF8) - : "uploaded_file"; - var contentType = metadata.TryGetValue("content-type", out var ct) ? ct.GetString(Encoding.UTF8) : null; - - var fileStream = await file.GetContentAsync(eventContext.CancellationToken); - - var fileService = services.GetRequiredService(); - var info = await fileService.ProcessNewFileAsync(user, file.Id, fileStream, fileName, contentType); - - using var finalScope = eventContext.HttpContext.RequestServices.CreateScope(); - var jsonOptions = finalScope.ServiceProvider.GetRequiredService>().Value - .JsonSerializerOptions; - var infoJson = JsonSerializer.Serialize(info, jsonOptions); - eventContext.HttpContext.Response.Headers.Append("X-FileInfo", infoJson); - - // Dispose the stream after all processing is complete - await fileStream.DisposeAsync(); - } - } - }; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/OrderController.cs b/DysonNetwork.Sphere/Wallet/OrderController.cs deleted file mode 100644 index 7200fac..0000000 --- a/DysonNetwork.Sphere/Wallet/OrderController.cs +++ /dev/null @@ -1,57 +0,0 @@ -using DysonNetwork.Sphere.Auth; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Wallet; - -[ApiController] -[Route("/api/orders")] -public class OrderController(PaymentService payment, AuthService auth, AppDatabase db) : ControllerBase -{ - [HttpGet("{id:guid}")] - public async Task> GetOrderById(Guid id) - { - var order = await db.PaymentOrders.FindAsync(id); - - if (order == null) - { - return NotFound(); - } - - return Ok(order); - } - - [HttpPost("{id:guid}/pay")] - [Authorize] - public async Task> PayOrder(Guid id, [FromBody] PayOrderRequest request) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser || - HttpContext.Items["CurrentSession"] is not Session currentSession) return Unauthorized(); - - // Validate PIN code - if (!await auth.ValidatePinCode(currentUser.Id, request.PinCode)) - return StatusCode(403, "Invalid PIN Code"); - - try - { - // Get the wallet for the current user - var wallet = await db.Wallets.FirstOrDefaultAsync(w => w.AccountId == currentUser.Id); - if (wallet == null) - return BadRequest("Wallet was not found."); - - // Pay the order - var paidOrder = await payment.PayOrderAsync(id, wallet.Id); - return Ok(paidOrder); - } - catch (InvalidOperationException ex) - { - return BadRequest(new { error = ex.Message }); - } - } -} - -public class PayOrderRequest -{ - public string PinCode { get; set; } = string.Empty; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/Payment.cs b/DysonNetwork.Sphere/Wallet/Payment.cs deleted file mode 100644 index d3a2a94..0000000 --- a/DysonNetwork.Sphere/Wallet/Payment.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using DysonNetwork.Sphere.Developer; -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet; - -public class WalletCurrency -{ - public const string SourcePoint = "points"; - public const string GoldenPoint = "golds"; -} - -public enum OrderStatus -{ - Unpaid, - Paid, - Cancelled, - Finished, - Expired -} - -public class Order : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public OrderStatus Status { get; set; } = OrderStatus.Unpaid; - [MaxLength(128)] public string Currency { get; set; } = null!; - [MaxLength(4096)] public string? Remarks { get; set; } - [MaxLength(4096)] public string? AppIdentifier { get; set; } - [Column(TypeName = "jsonb")] public Dictionary? Meta { get; set; } - public decimal Amount { get; set; } - public Instant ExpiredAt { get; set; } - - public Guid? PayeeWalletId { get; set; } - public Wallet? PayeeWallet { get; set; } = null!; - public Guid? TransactionId { get; set; } - public Transaction? Transaction { get; set; } - public Guid? IssuerAppId { get; set; } - public CustomApp? IssuerApp { get; set; } -} - -public enum TransactionType -{ - System, - Transfer, - Order -} - -public class Transaction : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(128)] public string Currency { get; set; } = null!; - public decimal Amount { get; set; } - [MaxLength(4096)] public string? Remarks { get; set; } - public TransactionType Type { get; set; } - - // When the payer is null, it's pay from the system - public Guid? PayerWalletId { get; set; } - public Wallet? PayerWallet { get; set; } - // When the payee is null, it's pay for the system - public Guid? PayeeWalletId { get; set; } - public Wallet? PayeeWallet { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/PaymentHandlers/AfdianPaymentHandler.cs b/DysonNetwork.Sphere/Wallet/PaymentHandlers/AfdianPaymentHandler.cs deleted file mode 100644 index b97ab99..0000000 --- a/DysonNetwork.Sphere/Wallet/PaymentHandlers/AfdianPaymentHandler.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System.Security.Cryptography; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet.PaymentHandlers; - -public class AfdianPaymentHandler( - IHttpClientFactory httpClientFactory, - ILogger logger, - IConfiguration configuration -) -{ - private readonly IHttpClientFactory _httpClientFactory = - httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); - - private readonly ILogger _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - - private readonly IConfiguration _configuration = - configuration ?? throw new ArgumentNullException(nameof(configuration)); - - private static readonly JsonSerializerOptions JsonOptions = new() - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - PropertyNameCaseInsensitive = true - }; - - private string CalculateSign(string token, string userId, string paramsJson, long ts) - { - var kvString = $"{token}params{paramsJson}ts{ts}user_id{userId}"; - using (var md5 = MD5.Create()) - { - var hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(kvString)); - return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); - } - } - - public async Task ListOrderAsync(int page = 1) - { - try - { - var token = _configuration["Payment:Auth:Afdian"] ?? "_:_"; - var tokenParts = token.Split(':'); - var userId = tokenParts[0]; - token = tokenParts[1]; - var paramsJson = JsonSerializer.Serialize(new { page }, JsonOptions); - var ts = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)) - .TotalSeconds; // Current timestamp in seconds - - var sign = CalculateSign(token, userId, paramsJson, ts); - - var client = _httpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Post, "https://afdian.com/api/open/query-order") - { - Content = new StringContent(JsonSerializer.Serialize(new - { - user_id = userId, - @params = paramsJson, - ts, - sign - }, JsonOptions), Encoding.UTF8, "application/json") - }; - - var response = await client.SendAsync(request); - if (!response.IsSuccessStatusCode) - { - _logger.LogError( - $"Response Error: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); - return null; - } - - var result = await JsonSerializer.DeserializeAsync( - await response.Content.ReadAsStreamAsync(), JsonOptions); - return result; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error fetching orders"); - throw; - } - } - - /// - /// Get a specific order by its ID (out_trade_no) - /// - /// The order ID to query - /// The order item if found, otherwise null - public async Task GetOrderAsync(string orderId) - { - if (string.IsNullOrEmpty(orderId)) - { - _logger.LogWarning("Order ID cannot be null or empty"); - return null; - } - - try - { - var token = _configuration["Payment:Auth:Afdian"] ?? "_:_"; - var tokenParts = token.Split(':'); - var userId = tokenParts[0]; - token = tokenParts[1]; - var paramsJson = JsonSerializer.Serialize(new { out_trade_no = orderId }, JsonOptions); - var ts = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)) - .TotalSeconds; // Current timestamp in seconds - - var sign = CalculateSign(token, userId, paramsJson, ts); - - var client = _httpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Post, "https://afdian.com/api/open/query-order") - { - Content = new StringContent(JsonSerializer.Serialize(new - { - user_id = userId, - @params = paramsJson, - ts, - sign - }, JsonOptions), Encoding.UTF8, "application/json") - }; - - var response = await client.SendAsync(request); - if (!response.IsSuccessStatusCode) - { - _logger.LogError( - $"Response Error: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); - return null; - } - - var result = await JsonSerializer.DeserializeAsync( - await response.Content.ReadAsStreamAsync(), JsonOptions); - - // Check if we have a valid response and orders in the list - if (result?.Data.Orders == null || result.Data.Orders.Count == 0) - { - _logger.LogWarning($"No order found with ID: {orderId}"); - return null; - } - - // Since we're querying by a specific order ID, we should only get one result - return result.Data.Orders.FirstOrDefault(); - } - catch (Exception ex) - { - _logger.LogError(ex, $"Error fetching order with ID: {orderId}"); - throw; - } - } - - /// - /// Get multiple orders by their IDs (out_trade_no) - /// - /// A collection of order IDs to query - /// A list of found order items - public async Task> GetOrderBatchAsync(IEnumerable orderIds) - { - var orders = orderIds.ToList(); - if (orders.Count == 0) - { - _logger.LogWarning("Order IDs cannot be null or empty"); - return []; - } - - try - { - // Join the order IDs with commas as specified in the API documentation - var orderIdsParam = string.Join(",", orders); - - var token = _configuration["Payment:Auth:Afdian"] ?? "_:_"; - var tokenParts = token.Split(':'); - var userId = tokenParts[0]; - token = tokenParts[1]; - var paramsJson = JsonSerializer.Serialize(new { out_trade_no = orderIdsParam }, JsonOptions); - var ts = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)) - .TotalSeconds; // Current timestamp in seconds - - var sign = CalculateSign(token, userId, paramsJson, ts); - - var client = _httpClientFactory.CreateClient(); - var request = new HttpRequestMessage(HttpMethod.Post, "https://afdian.com/api/open/query-order") - { - Content = new StringContent(JsonSerializer.Serialize(new - { - user_id = userId, - @params = paramsJson, - ts, - sign - }, JsonOptions), Encoding.UTF8, "application/json") - }; - - var response = await client.SendAsync(request); - if (!response.IsSuccessStatusCode) - { - _logger.LogError( - $"Response Error: {response.StatusCode}, {await response.Content.ReadAsStringAsync()}"); - return new List(); - } - - var result = await JsonSerializer.DeserializeAsync( - await response.Content.ReadAsStreamAsync(), JsonOptions); - - // Check if we have a valid response and orders in the list - if (result?.Data?.Orders != null && result.Data.Orders.Count != 0) return result.Data.Orders; - _logger.LogWarning($"No orders found with IDs: {orderIdsParam}"); - return []; - } - catch (Exception ex) - { - _logger.LogError(ex, $"Error fetching orders"); - throw; - } - } - - /// - /// Handle an incoming webhook from Afdian's payment platform - /// - /// The HTTP request containing webhook data - /// An action to process the received order - /// A WebhookResponse object to be returned to Afdian - public async Task HandleWebhook( - HttpRequest request, - Func? processOrderAction - ) - { - _logger.LogInformation("Received webhook request from afdian..."); - - try - { - // Read the request body - string requestBody; - using (var reader = new StreamReader(request.Body, Encoding.UTF8)) - { - requestBody = await reader.ReadToEndAsync(); - } - - if (string.IsNullOrEmpty(requestBody)) - { - _logger.LogError("Webhook request body is empty"); - return new WebhookResponse { ErrorCode = 400, ErrorMessage = "Empty request body" }; - } - - _logger.LogInformation($"Received webhook: {requestBody}"); - - // Parse the webhook data - var webhook = JsonSerializer.Deserialize(requestBody, JsonOptions); - - if (webhook == null) - { - _logger.LogError("Failed to parse webhook data"); - return new WebhookResponse { ErrorCode = 400, ErrorMessage = "Invalid webhook data" }; - } - - // Validate the webhook type - if (webhook.Data.Type != "order") - { - _logger.LogWarning($"Unsupported webhook type: {webhook.Data.Type}"); - return WebhookResponse.Success; - } - - // Process the order - try - { - // Check for duplicate order processing by storing processed order IDs - // (You would implement a more permanent storage mechanism for production) - if (processOrderAction != null) - await processOrderAction(webhook.Data); - else - _logger.LogInformation( - $"Order received but no processing action provided: {webhook.Data.Order.TradeNumber}"); - } - catch (Exception ex) - { - _logger.LogError(ex, $"Error processing order {webhook.Data.Order.TradeNumber}"); - // Still returning success to Afdian to prevent repeated callbacks - // Your system should handle the error internally - } - - // Return success response to Afdian - return WebhookResponse.Success; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error handling webhook"); - return WebhookResponse.Success; - } - } - - public string? GetSubscriptionPlanId(string subscriptionKey) - { - var planId = _configuration[$"Payment:Subscriptions:Afdian:{subscriptionKey}"]; - - if (string.IsNullOrEmpty(planId)) - { - _logger.LogWarning($"Unknown subscription key: {subscriptionKey}"); - return null; - } - - return planId; - } -} - -public class OrderResponse -{ - [JsonPropertyName("ec")] public int ErrorCode { get; set; } - - [JsonPropertyName("em")] public string ErrorMessage { get; set; } = null!; - - [JsonPropertyName("data")] public OrderData Data { get; set; } = null!; -} - -public class OrderData -{ - [JsonPropertyName("list")] public List Orders { get; set; } = null!; - - [JsonPropertyName("total_count")] public int TotalCount { get; set; } - - [JsonPropertyName("total_page")] public int TotalPages { get; set; } - - [JsonPropertyName("request")] public RequestDetails Request { get; set; } = null!; -} - -public class OrderItem : ISubscriptionOrder -{ - [JsonPropertyName("out_trade_no")] public string TradeNumber { get; set; } = null!; - - [JsonPropertyName("user_id")] public string UserId { get; set; } = null!; - - [JsonPropertyName("plan_id")] public string PlanId { get; set; } = null!; - - [JsonPropertyName("month")] public int Months { get; set; } - - [JsonPropertyName("total_amount")] public string TotalAmount { get; set; } = null!; - - [JsonPropertyName("show_amount")] public string ShowAmount { get; set; } = null!; - - [JsonPropertyName("status")] public int Status { get; set; } - - [JsonPropertyName("remark")] public string Remark { get; set; } = null!; - - [JsonPropertyName("redeem_id")] public string RedeemId { get; set; } = null!; - - [JsonPropertyName("product_type")] public int ProductType { get; set; } - - [JsonPropertyName("discount")] public string Discount { get; set; } = null!; - - [JsonPropertyName("sku_detail")] public List SkuDetail { get; set; } = null!; - - [JsonPropertyName("create_time")] public long CreateTime { get; set; } - - [JsonPropertyName("user_name")] public string UserName { get; set; } = null!; - - [JsonPropertyName("plan_title")] public string PlanTitle { get; set; } = null!; - - [JsonPropertyName("user_private_id")] public string UserPrivateId { get; set; } = null!; - - [JsonPropertyName("address_person")] public string AddressPerson { get; set; } = null!; - - [JsonPropertyName("address_phone")] public string AddressPhone { get; set; } = null!; - - [JsonPropertyName("address_address")] public string AddressAddress { get; set; } = null!; - - public Instant BegunAt => Instant.FromUnixTimeSeconds(CreateTime); - - public Duration Duration => Duration.FromDays(Months * 30); - - public string Provider => "afdian"; - - public string Id => TradeNumber; - - public string SubscriptionId => PlanId; - - public string AccountId => UserId; -} - -public class RequestDetails -{ - [JsonPropertyName("user_id")] public string UserId { get; set; } = null!; - - [JsonPropertyName("params")] public string Params { get; set; } = null!; - - [JsonPropertyName("ts")] public long Timestamp { get; set; } - - [JsonPropertyName("sign")] public string Sign { get; set; } = null!; -} - -/// -/// Request structure for Afdian webhook -/// -public class WebhookRequest -{ - [JsonPropertyName("ec")] public int ErrorCode { get; set; } - - [JsonPropertyName("em")] public string ErrorMessage { get; set; } = null!; - - [JsonPropertyName("data")] public WebhookOrderData Data { get; set; } = null!; -} - -/// -/// Order data contained in the webhook -/// -public class WebhookOrderData -{ - [JsonPropertyName("type")] public string Type { get; set; } = null!; - - [JsonPropertyName("order")] public WebhookOrderDetails Order { get; set; } = null!; -} - -/// -/// Order details in the webhook -/// -public class WebhookOrderDetails : OrderItem -{ - [JsonPropertyName("custom_order_id")] public string CustomOrderId { get; set; } = null!; -} - -/// -/// Response structure to acknowledge webhook receipt -/// -public class WebhookResponse -{ - [JsonPropertyName("ec")] public int ErrorCode { get; set; } = 200; - - [JsonPropertyName("em")] public string ErrorMessage { get; set; } = ""; - - public static WebhookResponse Success => new() - { - ErrorCode = 200, - ErrorMessage = string.Empty - }; -} - -/// -/// SKU detail item -/// -public class SkuDetailItem -{ - [JsonPropertyName("sku_id")] public string SkuId { get; set; } = null!; - - [JsonPropertyName("count")] public int Count { get; set; } - - [JsonPropertyName("name")] public string Name { get; set; } = null!; - - [JsonPropertyName("album_id")] public string AlbumId { get; set; } = null!; - - [JsonPropertyName("pic")] public string Picture { get; set; } = null!; -} diff --git a/DysonNetwork.Sphere/Wallet/PaymentHandlers/ISubscriptionOrder.cs b/DysonNetwork.Sphere/Wallet/PaymentHandlers/ISubscriptionOrder.cs deleted file mode 100644 index a64aa11..0000000 --- a/DysonNetwork.Sphere/Wallet/PaymentHandlers/ISubscriptionOrder.cs +++ /dev/null @@ -1,18 +0,0 @@ -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet.PaymentHandlers; - -public interface ISubscriptionOrder -{ - public string Id { get; } - - public string SubscriptionId { get; } - - public Instant BegunAt { get; } - - public Duration Duration { get; } - - public string Provider { get; } - - public string AccountId { get; } -} diff --git a/DysonNetwork.Sphere/Wallet/PaymentService.cs b/DysonNetwork.Sphere/Wallet/PaymentService.cs deleted file mode 100644 index 4f7ee69..0000000 --- a/DysonNetwork.Sphere/Wallet/PaymentService.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System.Globalization; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Localization; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.Extensions.Localization; -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet; - -public class PaymentService( - AppDatabase db, - WalletService wat, - NotificationService nty, - IStringLocalizer localizer -) -{ - public async Task CreateOrderAsync( - Guid? payeeWalletId, - string currency, - decimal amount, - Duration? expiration = null, - string? appIdentifier = null, - Dictionary? meta = null, - bool reuseable = true - ) - { - // Check if there's an existing unpaid order that can be reused - if (reuseable && appIdentifier != null) - { - var existingOrder = await db.PaymentOrders - .Where(o => o.Status == OrderStatus.Unpaid && - o.PayeeWalletId == payeeWalletId && - o.Currency == currency && - o.Amount == amount && - o.AppIdentifier == appIdentifier && - o.ExpiredAt > SystemClock.Instance.GetCurrentInstant()) - .FirstOrDefaultAsync(); - - // If an existing order is found, check if meta matches - if (existingOrder != null && meta != null && existingOrder.Meta != null) - { - // Compare meta dictionaries - if they are equivalent, reuse the order - var metaMatches = existingOrder.Meta.Count == meta.Count && - !existingOrder.Meta.Except(meta).Any(); - - if (metaMatches) - { - return existingOrder; - } - } - } - - // Create a new order if no reusable order was found - var order = new Order - { - PayeeWalletId = payeeWalletId, - Currency = currency, - Amount = amount, - ExpiredAt = SystemClock.Instance.GetCurrentInstant().Plus(expiration ?? Duration.FromHours(24)), - AppIdentifier = appIdentifier, - Meta = meta - }; - - db.PaymentOrders.Add(order); - await db.SaveChangesAsync(); - return order; - } - - public async Task CreateTransactionWithAccountAsync( - Guid? payerAccountId, - Guid? payeeAccountId, - string currency, - decimal amount, - string? remarks = null, - TransactionType type = TransactionType.System - ) - { - Wallet? payer = null, payee = null; - if (payerAccountId.HasValue) - payer = await db.Wallets.FirstOrDefaultAsync(e => e.AccountId == payerAccountId.Value); - if (payeeAccountId.HasValue) - payee = await db.Wallets.FirstOrDefaultAsync(e => e.AccountId == payeeAccountId.Value); - - if (payer == null && payerAccountId.HasValue) - throw new ArgumentException("Payer account was specified, but wallet was not found"); - if (payee == null && payeeAccountId.HasValue) - throw new ArgumentException("Payee account was specified, but wallet was not found"); - - return await CreateTransactionAsync( - payer?.Id, - payee?.Id, - currency, - amount, - remarks, - type - ); - } - - public async Task CreateTransactionAsync( - Guid? payerWalletId, - Guid? payeeWalletId, - string currency, - decimal amount, - string? remarks = null, - TransactionType type = TransactionType.System - ) - { - if (payerWalletId == null && payeeWalletId == null) - throw new ArgumentException("At least one wallet must be specified."); - if (amount <= 0) throw new ArgumentException("Cannot create transaction with negative or zero amount."); - - var transaction = new Transaction - { - PayerWalletId = payerWalletId, - PayeeWalletId = payeeWalletId, - Currency = currency, - Amount = amount, - Remarks = remarks, - Type = type - }; - - if (payerWalletId.HasValue) - { - var (payerPocket, isNewlyCreated) = - await wat.GetOrCreateWalletPocketAsync(payerWalletId.Value, currency); - - if (isNewlyCreated || payerPocket.Amount < amount) - throw new InvalidOperationException("Insufficient funds"); - - await db.WalletPockets - .Where(p => p.Id == payerPocket.Id && p.Amount >= amount) - .ExecuteUpdateAsync(s => - s.SetProperty(p => p.Amount, p => p.Amount - amount)); - } - - if (payeeWalletId.HasValue) - { - var (payeePocket, isNewlyCreated) = - await wat.GetOrCreateWalletPocketAsync(payeeWalletId.Value, currency, amount); - - if (!isNewlyCreated) - await db.WalletPockets - .Where(p => p.Id == payeePocket.Id) - .ExecuteUpdateAsync(s => - s.SetProperty(p => p.Amount, p => p.Amount + amount)); - } - - db.PaymentTransactions.Add(transaction); - await db.SaveChangesAsync(); - return transaction; - } - - public async Task PayOrderAsync(Guid orderId, Guid payerWalletId) - { - var order = await db.PaymentOrders - .Include(o => o.Transaction) - .FirstOrDefaultAsync(o => o.Id == orderId); - - if (order == null) - { - throw new InvalidOperationException("Order not found"); - } - - if (order.Status != OrderStatus.Unpaid) - { - throw new InvalidOperationException($"Order is in invalid status: {order.Status}"); - } - - if (order.ExpiredAt < SystemClock.Instance.GetCurrentInstant()) - { - order.Status = OrderStatus.Expired; - await db.SaveChangesAsync(); - throw new InvalidOperationException("Order has expired"); - } - - var transaction = await CreateTransactionAsync( - payerWalletId, - order.PayeeWalletId, - order.Currency, - order.Amount, - order.Remarks ?? $"Payment for Order #{order.Id}", - type: TransactionType.Order); - - order.TransactionId = transaction.Id; - order.Transaction = transaction; - order.Status = OrderStatus.Paid; - - await db.SaveChangesAsync(); - - await NotifyOrderPaid(order); - - return order; - } - - private async Task NotifyOrderPaid(Order order) - { - if (order.PayeeWallet is null) return; - var account = await db.Accounts.FirstOrDefaultAsync(a => a.Id == order.PayeeWallet.AccountId); - if (account is null) return; - - AccountService.SetCultureInfo(account); - - // Due to ID is uuid, it longer than 8 words for sure - var readableOrderId = order.Id.ToString().Replace("-", "")[..8]; - var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}"; - - await nty.SendNotification( - account, - "wallets.orders.paid", - localizer["OrderPaidTitle", $"#{readableOrderId}"], - null, - localizer["OrderPaidBody", order.Amount.ToString(CultureInfo.InvariantCulture), order.Currency, - readableOrderRemark], - new Dictionary() - { - ["order_id"] = order.Id.ToString() - } - ); - } - - public async Task CancelOrderAsync(Guid orderId) - { - var order = await db.PaymentOrders.FindAsync(orderId); - if (order == null) - { - throw new InvalidOperationException("Order not found"); - } - - if (order.Status != OrderStatus.Unpaid) - { - throw new InvalidOperationException($"Cannot cancel order in status: {order.Status}"); - } - - order.Status = OrderStatus.Cancelled; - await db.SaveChangesAsync(); - return order; - } - - public async Task<(Order Order, Transaction RefundTransaction)> RefundOrderAsync(Guid orderId) - { - var order = await db.PaymentOrders - .Include(o => o.Transaction) - .FirstOrDefaultAsync(o => o.Id == orderId); - - if (order == null) - { - throw new InvalidOperationException("Order not found"); - } - - if (order.Status != OrderStatus.Paid) - { - throw new InvalidOperationException($"Cannot refund order in status: {order.Status}"); - } - - if (order.Transaction == null) - { - throw new InvalidOperationException("Order has no associated transaction"); - } - - var refundTransaction = await CreateTransactionAsync( - order.PayeeWalletId, - order.Transaction.PayerWalletId, - order.Currency, - order.Amount, - $"Refund for order {order.Id}"); - - order.Status = OrderStatus.Finished; - await db.SaveChangesAsync(); - - return (order, refundTransaction); - } - - public async Task TransferAsync(Guid payerAccountId, Guid payeeAccountId, string currency, - decimal amount) - { - var payerWallet = await wat.GetWalletAsync(payerAccountId); - if (payerWallet == null) - { - throw new InvalidOperationException($"Payer wallet not found for account {payerAccountId}"); - } - - var payeeWallet = await wat.GetWalletAsync(payeeAccountId); - if (payeeWallet == null) - { - throw new InvalidOperationException($"Payee wallet not found for account {payeeAccountId}"); - } - - return await CreateTransactionAsync( - payerWallet.Id, - payeeWallet.Id, - currency, - amount, - $"Transfer from account {payerAccountId} to {payeeAccountId}", - TransactionType.Transfer); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/Subscription.cs b/DysonNetwork.Sphere/Wallet/Subscription.cs deleted file mode 100644 index d089f5c..0000000 --- a/DysonNetwork.Sphere/Wallet/Subscription.cs +++ /dev/null @@ -1,256 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet; - -public record class SubscriptionTypeData( - string Identifier, - string? GroupIdentifier, - string Currency, - decimal BasePrice, - int? RequiredLevel = null -) -{ - public static readonly Dictionary SubscriptionDict = - new() - { - [SubscriptionType.Twinkle] = new SubscriptionTypeData( - SubscriptionType.Twinkle, - SubscriptionType.StellarProgram, - WalletCurrency.SourcePoint, - 0, - 1 - ), - [SubscriptionType.Stellar] = new SubscriptionTypeData( - SubscriptionType.Stellar, - SubscriptionType.StellarProgram, - WalletCurrency.SourcePoint, - 1200, - 3 - ), - [SubscriptionType.Nova] = new SubscriptionTypeData( - SubscriptionType.Nova, - SubscriptionType.StellarProgram, - WalletCurrency.SourcePoint, - 2400, - 6 - ), - [SubscriptionType.Supernova] = new SubscriptionTypeData( - SubscriptionType.Supernova, - SubscriptionType.StellarProgram, - WalletCurrency.SourcePoint, - 3600, - 9 - ) - }; - - public static readonly Dictionary SubscriptionHumanReadable = - new() - { - [SubscriptionType.Twinkle] = "Stellar Program Twinkle", - [SubscriptionType.Stellar] = "Stellar Program", - [SubscriptionType.Nova] = "Stellar Program Nova", - [SubscriptionType.Supernova] = "Stellar Program Supernova" - }; -} - -public abstract class SubscriptionType -{ - /// - /// DO NOT USE THIS TYPE DIRECTLY, - /// this is the prefix of all the stellar program subscriptions. - /// - public const string StellarProgram = "solian.stellar"; - - /// - /// No actual usage, just tells there is a free level named twinkle. - /// Applies to every registered user by default, so there is no need to create a record in db for that. - /// - public const string Twinkle = "solian.stellar.twinkle"; - - public const string Stellar = "solian.stellar.primary"; - public const string Nova = "solian.stellar.nova"; - public const string Supernova = "solian.stellar.supernova"; -} - -public abstract class SubscriptionPaymentMethod -{ - /// - /// The solar points / solar dollars. - /// - public const string InAppWallet = "solian.wallet"; - - /// - /// afdian.com - /// aka. China patreon - /// - public const string Afdian = "afdian"; -} - -public enum SubscriptionStatus -{ - Unpaid, - Active, - Expired, - Cancelled -} - -/// -/// The subscription is for the Stellar Program in most cases. -/// The paid subscription in another word. -/// -[Index(nameof(Identifier))] -public class Subscription : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public Instant BegunAt { get; set; } - public Instant? EndedAt { get; set; } - - /// - /// The type of the subscriptions - /// - [MaxLength(4096)] - public string Identifier { get; set; } = null!; - - /// - /// The field is used to override the activation status of the membership. - /// Might be used for refund handling and other special cases. - /// - /// Go see the IsAvailable field if you want to get real the status of the membership. - /// - public bool IsActive { get; set; } = true; - - /// - /// Indicates is the current user got the membership for free, - /// to prevent giving the same discount for the same user again. - /// - public bool IsFreeTrial { get; set; } - - public SubscriptionStatus Status { get; set; } = SubscriptionStatus.Unpaid; - - [MaxLength(4096)] public string PaymentMethod { get; set; } = null!; - [Column(TypeName = "jsonb")] public PaymentDetails PaymentDetails { get; set; } = null!; - public decimal BasePrice { get; set; } - public Guid? CouponId { get; set; } - public Coupon? Coupon { get; set; } - public Instant? RenewalAt { get; set; } - - public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; - - [NotMapped] - public bool IsAvailable - { - get - { - if (!IsActive) return false; - - var now = SystemClock.Instance.GetCurrentInstant(); - - if (BegunAt > now) return false; - if (EndedAt.HasValue && now > EndedAt.Value) return false; - if (RenewalAt.HasValue && now > RenewalAt.Value) return false; - if (Status != SubscriptionStatus.Active) return false; - - return true; - } - } - - [NotMapped] - public decimal FinalPrice - { - get - { - if (IsFreeTrial) return 0; - if (Coupon == null) return BasePrice; - - var now = SystemClock.Instance.GetCurrentInstant(); - if (Coupon.AffectedAt.HasValue && now < Coupon.AffectedAt.Value || - Coupon.ExpiredAt.HasValue && now > Coupon.ExpiredAt.Value) return BasePrice; - - if (Coupon.DiscountAmount.HasValue) return BasePrice - Coupon.DiscountAmount.Value; - if (Coupon.DiscountRate.HasValue) return BasePrice * (decimal)(1 - Coupon.DiscountRate.Value); - return BasePrice; - } - } - - public SubscriptionReferenceObject ToReference() - { - return new SubscriptionReferenceObject - { - Id = Id, - Status = Status, - Identifier = Identifier, - IsActive = IsActive, - AccountId = AccountId, - CreatedAt = CreatedAt, - UpdatedAt = UpdatedAt, - DeletedAt = DeletedAt, - }; - } -} - -public class PaymentDetails -{ - public string Currency { get; set; } = null!; - public string? OrderId { get; set; } -} - -public class SubscriptionReferenceObject : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - public SubscriptionStatus Status { get; set; } - public string Identifier { get; set; } = null!; - public bool IsActive { get; set; } = true; - public Guid AccountId { get; set; } -} - -/// -/// A discount that can applies in purchases among the Solar Network. -/// For now, it can be used in the subscription purchase. -/// -public class Coupon : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - - /// - /// The items that can apply this coupon. - /// Leave it to null to apply to all items. - /// - [MaxLength(4096)] - public string? Identifier { get; set; } - - /// - /// The code that human-readable and memorizable. - /// Leave it blank to use it only with the ID. - /// - [MaxLength(1024)] - public string? Code { get; set; } - - public Instant? AffectedAt { get; set; } - public Instant? ExpiredAt { get; set; } - - /// - /// The amount of the discount. - /// If this field and the rate field are both not null, - /// the amount discount will be applied and the discount rate will be ignored. - /// Formula: final price = base price - discount amount - /// - public decimal? DiscountAmount { get; set; } - - /// - /// The percentage of the discount. - /// If this field and the amount field are both not null, - /// this field will be ignored. - /// Formula: final price = base price * (1 - discount rate) - /// - public double? DiscountRate { get; set; } - - /// - /// The max usage of the current coupon. - /// Leave it to null to use it unlimited. - /// - public int? MaxUsage { get; set; } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/SubscriptionController.cs b/DysonNetwork.Sphere/Wallet/SubscriptionController.cs deleted file mode 100644 index 9b8ca65..0000000 --- a/DysonNetwork.Sphere/Wallet/SubscriptionController.cs +++ /dev/null @@ -1,204 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NodaTime; -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Wallet.PaymentHandlers; - -namespace DysonNetwork.Sphere.Wallet; - -[ApiController] -[Route("/api/subscriptions")] -public class SubscriptionController(SubscriptionService subscriptions, AfdianPaymentHandler afdian, AppDatabase db) : ControllerBase -{ - [HttpGet] - [Authorize] - public async Task>> ListSubscriptions( - [FromQuery] int offset = 0, - [FromQuery] int take = 20 - ) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - var query = db.WalletSubscriptions.AsQueryable() - .Where(s => s.AccountId == currentUser.Id) - .Include(s => s.Coupon) - .OrderByDescending(s => s.BegunAt); - - var totalCount = await query.CountAsync(); - - var subscriptionsList = await query - .Skip(offset) - .Take(take) - .ToListAsync(); - - Response.Headers["X-Total"] = totalCount.ToString(); - - return subscriptionsList; - } - - [HttpGet("fuzzy/{prefix}")] - [Authorize] - public async Task> GetSubscriptionFuzzy(string prefix) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - var subs = await db.WalletSubscriptions - .Where(s => s.AccountId == currentUser.Id && s.IsActive) - .Where(s => EF.Functions.ILike(s.Identifier, prefix + "%")) - .OrderByDescending(s => s.BegunAt) - .ToListAsync(); - if (subs.Count == 0) return NotFound(); - var subscription = subs.FirstOrDefault(s => s.IsAvailable); - if (subscription is null) return NotFound(); - - return Ok(subscription); - } - - [HttpGet("{identifier}")] - [Authorize] - public async Task> GetSubscription(string identifier) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - var subscription = await subscriptions.GetSubscriptionAsync(currentUser.Id, identifier); - if (subscription is null) return NotFound($"Subscription with identifier {identifier} was not found."); - - return subscription; - } - - public class CreateSubscriptionRequest - { - [Required] public string Identifier { get; set; } = null!; - [Required] public string PaymentMethod { get; set; } = null!; - [Required] public PaymentDetails PaymentDetails { get; set; } = null!; - public string? Coupon { get; set; } - public int? CycleDurationDays { get; set; } - public bool IsFreeTrial { get; set; } = false; - public bool IsAutoRenewal { get; set; } = true; - } - - [HttpPost] - [Authorize] - public async Task> CreateSubscription( - [FromBody] CreateSubscriptionRequest request, - [FromHeader(Name = "X-Noop")] bool noop = false - ) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - Duration? cycleDuration = null; - if (request.CycleDurationDays.HasValue) - cycleDuration = Duration.FromDays(request.CycleDurationDays.Value); - - try - { - var subscription = await subscriptions.CreateSubscriptionAsync( - currentUser, - request.Identifier, - request.PaymentMethod, - request.PaymentDetails, - cycleDuration, - request.Coupon, - request.IsFreeTrial, - request.IsAutoRenewal, - noop - ); - - return subscription; - } - catch (ArgumentOutOfRangeException ex) - { - return BadRequest(ex.Message); - } - catch (InvalidOperationException ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPost("{identifier}/cancel")] - [Authorize] - public async Task> CancelSubscription(string identifier) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - try - { - var subscription = await subscriptions.CancelSubscriptionAsync(currentUser.Id, identifier); - return subscription; - } - catch (InvalidOperationException ex) - { - return BadRequest(ex.Message); - } - } - - [HttpPost("{identifier}/order")] - [Authorize] - public async Task> CreateSubscriptionOrder(string identifier) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - try - { - var order = await subscriptions.CreateSubscriptionOrder(currentUser.Id, identifier); - return order; - } - catch (InvalidOperationException ex) - { - return BadRequest(ex.Message); - } - } - - public class SubscriptionOrderRequest - { - [Required] public Guid OrderId { get; set; } - } - - [HttpPost("order/handle")] - [Authorize] - public async Task> HandleSubscriptionOrder([FromBody] SubscriptionOrderRequest request) - { - var order = await db.PaymentOrders.FindAsync(request.OrderId); - if (order is null) return NotFound($"Order with ID {request.OrderId} was not found."); - - try - { - var subscription = await subscriptions.HandleSubscriptionOrder(order); - return subscription; - } - catch (InvalidOperationException ex) - { - return BadRequest(ex.Message); - } - } - - public class RestorePurchaseRequest - { - [Required] public string OrderId { get; set; } = null!; - } - - [HttpPost("order/restore/afdian")] - [Authorize] - public async Task RestorePurchaseFromAfdian([FromBody] RestorePurchaseRequest request) - { - var order = await afdian.GetOrderAsync(request.OrderId); - if (order is null) return NotFound($"Order with ID {request.OrderId} was not found."); - - var subscription = await subscriptions.CreateSubscriptionFromOrder(order); - return Ok(subscription); - } - - [HttpPost("order/handle/afdian")] - public async Task> AfdianWebhook() - { - var response = await afdian.HandleWebhook(Request, async webhookData => - { - var order = webhookData.Order; - await subscriptions.CreateSubscriptionFromOrder(order); - }); - - return Ok(response); - } -} diff --git a/DysonNetwork.Sphere/Wallet/SubscriptionRenewalJob.cs b/DysonNetwork.Sphere/Wallet/SubscriptionRenewalJob.cs deleted file mode 100644 index 116fe51..0000000 --- a/DysonNetwork.Sphere/Wallet/SubscriptionRenewalJob.cs +++ /dev/null @@ -1,197 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using NodaTime; -using Quartz; - -namespace DysonNetwork.Sphere.Wallet; - -public class SubscriptionRenewalJob( - AppDatabase db, - SubscriptionService subscriptionService, - PaymentService paymentService, - WalletService walletService, - ILogger logger -) : IJob -{ - public async Task Execute(IJobExecutionContext context) - { - logger.LogInformation("Starting subscription auto-renewal job..."); - - // First update expired subscriptions - var expiredCount = await subscriptionService.UpdateExpiredSubscriptionsAsync(); - logger.LogInformation("Updated {ExpiredCount} expired subscriptions", expiredCount); - - var now = SystemClock.Instance.GetCurrentInstant(); - const int batchSize = 100; // Process in smaller batches - var processedCount = 0; - var renewedCount = 0; - var failedCount = 0; - - // Find subscriptions that need renewal (due for renewal and are still active) - var subscriptionsToRenew = await db.WalletSubscriptions - .Where(s => s.RenewalAt.HasValue && s.RenewalAt.Value <= now) // Due for renewal - .Where(s => s.Status == SubscriptionStatus.Active) // Only paid subscriptions - .Where(s => s.IsActive) // Only active subscriptions - .Where(s => !s.IsFreeTrial) // Exclude free trials - .OrderBy(s => s.RenewalAt) // Process oldest first - .Take(batchSize) - .Include(s => s.Coupon) // Include coupon information - .ToListAsync(); - - var totalSubscriptions = subscriptionsToRenew.Count; - logger.LogInformation("Found {TotalSubscriptions} subscriptions due for renewal", totalSubscriptions); - - foreach (var subscription in subscriptionsToRenew) - { - try - { - processedCount++; - logger.LogDebug( - "Processing renewal for subscription {SubscriptionId} (Identifier: {Identifier}) for account {AccountId}", - subscription.Id, subscription.Identifier, subscription.AccountId); - - if (subscription.RenewalAt is null) - { - logger.LogWarning( - "Subscription {SubscriptionId} (Identifier: {Identifier}) has no renewal date or has been cancelled.", - subscription.Id, subscription.Identifier); - subscription.Status = SubscriptionStatus.Cancelled; - db.WalletSubscriptions.Update(subscription); - await db.SaveChangesAsync(); - continue; - } - - // Calculate next cycle duration based on current cycle - var currentCycle = subscription.EndedAt!.Value - subscription.BegunAt; - - // Create an order for the renewal payment - var order = await paymentService.CreateOrderAsync( - null, - WalletCurrency.GoldenPoint, - subscription.FinalPrice, - appIdentifier: SubscriptionService.SubscriptionOrderIdentifier, - meta: new Dictionary() - { - ["subscription_id"] = subscription.Id.ToString(), - ["subscription_identifier"] = subscription.Identifier, - ["is_renewal"] = true - } - ); - - // Try to process the payment automatically - if (subscription.PaymentMethod == SubscriptionPaymentMethod.InAppWallet) - { - try - { - var wallet = await walletService.GetWalletAsync(subscription.AccountId); - if (wallet is null) continue; - - // Process automatic payment from wallet - await paymentService.PayOrderAsync(order.Id, wallet.Id); - - // Update subscription details - subscription.BegunAt = subscription.EndedAt!.Value; - subscription.EndedAt = subscription.BegunAt.Plus(currentCycle); - subscription.RenewalAt = subscription.EndedAt; - - db.WalletSubscriptions.Update(subscription); - await db.SaveChangesAsync(); - - renewedCount++; - logger.LogInformation("Successfully renewed subscription {SubscriptionId}", subscription.Id); - } - catch (Exception ex) - { - // If auto-payment fails, mark for manual payment - logger.LogWarning(ex, "Failed to auto-renew subscription {SubscriptionId} with wallet payment", - subscription.Id); - failedCount++; - } - } - else - { - // For other payment methods, mark as pending payment - logger.LogInformation("Subscription {SubscriptionId} requires manual payment via {PaymentMethod}", - subscription.Id, subscription.PaymentMethod); - failedCount++; - } - } - catch (Exception ex) - { - logger.LogError(ex, "Error processing subscription {SubscriptionId}", subscription.Id); - failedCount++; - } - - // Log progress periodically - if (processedCount % 20 == 0 || processedCount == totalSubscriptions) - { - logger.LogInformation( - "Progress: processed {ProcessedCount}/{TotalSubscriptions} subscriptions, {RenewedCount} renewed, {FailedCount} failed", - processedCount, totalSubscriptions, renewedCount, failedCount); - } - } - - logger.LogInformation( - "Completed subscription renewal job. Processed: {ProcessedCount}, Renewed: {RenewedCount}, Failed: {FailedCount}", - processedCount, renewedCount, failedCount); - - logger.LogInformation("Validating user stellar memberships..."); - - // Get all account IDs with StellarMembership - var accountsWithMemberships = await db.AccountProfiles - .Where(a => a.StellarMembership != null) - .Select(a => new { a.Id, a.StellarMembership }) - .ToListAsync(); - - logger.LogInformation("Found {Count} accounts with stellar memberships to validate", - accountsWithMemberships.Count); - - if (accountsWithMemberships.Count == 0) - { - logger.LogInformation("No stellar memberships found to validate"); - return; - } - - // Get all subscription IDs from StellarMemberships - var memberships = accountsWithMemberships - .Where(a => a.StellarMembership != null) - .Select(a => a.StellarMembership) - .Distinct() - .ToList(); - var membershipIds = memberships.Select(m => m!.Id).ToList(); - - // Get all valid subscriptions in a single query - var validSubscriptions = await db.WalletSubscriptions - .Where(s => membershipIds.Contains(s.Id)) - .Where(s => s.IsActive) - .ToListAsync(); - var validSubscriptionsId = validSubscriptions - .Where(s => s.IsAvailable) - .Select(s => s.Id) - .ToList(); - - // Identify accounts that need updating (membership expired or not in validSubscriptions) - var accountIdsToUpdate = accountsWithMemberships - .Where(a => a.StellarMembership != null && !validSubscriptionsId.Contains(a.StellarMembership.Id)) - .Select(a => a.Id) - .ToList(); - - // Log the IDs that will be updated for debugging - logger.LogDebug("Accounts with expired or invalid memberships: {AccountIds}", - string.Join(", ", accountIdsToUpdate)); - - if (accountIdsToUpdate.Count == 0) - { - logger.LogInformation("No expired/invalid stellar memberships found"); - return; - } - - // Update all accounts in a single batch operation - var updatedCount = await db.AccountProfiles - .Where(a => accountIdsToUpdate.Contains(a.Id)) - .ExecuteUpdateAsync(s => s - .SetProperty(a => a.StellarMembership, p => null) - ); - - logger.LogInformation("Updated {Count} accounts with expired/invalid stellar memberships", updatedCount); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/SubscriptionService.cs b/DysonNetwork.Sphere/Wallet/SubscriptionService.cs deleted file mode 100644 index a46dcf6..0000000 --- a/DysonNetwork.Sphere/Wallet/SubscriptionService.cs +++ /dev/null @@ -1,401 +0,0 @@ -using System.Text.Json; -using DysonNetwork.Sphere.Account; -using DysonNetwork.Sphere.Localization; -using DysonNetwork.Sphere.Storage; -using DysonNetwork.Sphere.Wallet.PaymentHandlers; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Localization; -using NodaTime; - -namespace DysonNetwork.Sphere.Wallet; - -public class SubscriptionService( - AppDatabase db, - PaymentService payment, - AccountService accounts, - NotificationService nty, - IStringLocalizer localizer, - IConfiguration configuration, - ICacheService cache, - ILogger logger -) -{ - public async Task CreateSubscriptionAsync( - Account.Account account, - string identifier, - string paymentMethod, - PaymentDetails paymentDetails, - Duration? cycleDuration = null, - string? coupon = null, - bool isFreeTrial = false, - bool isAutoRenewal = true, - bool noop = false - ) - { - var subscriptionInfo = SubscriptionTypeData - .SubscriptionDict.TryGetValue(identifier, out var template) - ? template - : null; - if (subscriptionInfo is null) - throw new ArgumentOutOfRangeException(nameof(identifier), $@"Subscription {identifier} was not found."); - var subscriptionsInGroup = subscriptionInfo.GroupIdentifier is not null - ? SubscriptionTypeData.SubscriptionDict - .Where(s => s.Value.GroupIdentifier == subscriptionInfo.GroupIdentifier) - .Select(s => s.Value.Identifier) - .ToArray() - : [identifier]; - - cycleDuration ??= Duration.FromDays(30); - - var existingSubscription = await GetSubscriptionAsync(account.Id, subscriptionsInGroup); - if (existingSubscription is not null && !noop) - throw new InvalidOperationException($"Active subscription with identifier {identifier} already exists."); - if (existingSubscription is not null) - return existingSubscription; - - if (subscriptionInfo.RequiredLevel > 0) - { - var profile = await db.AccountProfiles - .Where(p => p.AccountId == account.Id) - .FirstOrDefaultAsync(); - if (profile is null) throw new InvalidOperationException("Account profile was not found."); - if (profile.Level < subscriptionInfo.RequiredLevel) - throw new InvalidOperationException( - $"Account level must be at least {subscriptionInfo.RequiredLevel} to subscribe to {identifier}." - ); - } - - if (isFreeTrial) - { - var prevFreeTrial = await db.WalletSubscriptions - .Where(s => s.AccountId == account.Id && s.Identifier == identifier && s.IsFreeTrial) - .FirstOrDefaultAsync(); - if (prevFreeTrial is not null) - throw new InvalidOperationException("Free trial already exists."); - } - - Coupon? couponData = null; - if (coupon is not null) - { - var inputCouponId = Guid.TryParse(coupon, out var parsedCouponId) ? parsedCouponId : Guid.Empty; - couponData = await db.WalletCoupons - .Where(c => (c.Id == inputCouponId) || (c.Identifier != null && c.Identifier == coupon)) - .FirstOrDefaultAsync(); - if (couponData is null) throw new InvalidOperationException($"Coupon {coupon} was not found."); - } - - var now = SystemClock.Instance.GetCurrentInstant(); - var subscription = new Subscription - { - BegunAt = now, - EndedAt = now.Plus(cycleDuration.Value), - Identifier = identifier, - IsActive = true, - IsFreeTrial = isFreeTrial, - Status = SubscriptionStatus.Unpaid, - PaymentMethod = paymentMethod, - PaymentDetails = paymentDetails, - BasePrice = subscriptionInfo.BasePrice, - CouponId = couponData?.Id, - Coupon = couponData, - RenewalAt = (isFreeTrial || !isAutoRenewal) ? null : now.Plus(cycleDuration.Value), - AccountId = account.Id, - }; - - db.WalletSubscriptions.Add(subscription); - await db.SaveChangesAsync(); - - return subscription; - } - - public async Task CreateSubscriptionFromOrder(ISubscriptionOrder order) - { - var cfgSection = configuration.GetSection("Payment:Subscriptions"); - var provider = order.Provider; - - var currency = "irl"; - var subscriptionIdentifier = order.SubscriptionId; - switch (provider) - { - case "afdian": - // Get the Afdian section first, then bind it to a dictionary - var afdianPlans = cfgSection.GetSection("Afdian").Get>(); - logger.LogInformation("Afdian plans configuration: {Plans}", JsonSerializer.Serialize(afdianPlans)); - if (afdianPlans != null && afdianPlans.TryGetValue(subscriptionIdentifier, out var planName)) - subscriptionIdentifier = planName; - currency = "cny"; - break; - } - - var subscriptionTemplate = SubscriptionTypeData - .SubscriptionDict.TryGetValue(subscriptionIdentifier, out var template) - ? template - : null; - if (subscriptionTemplate is null) - throw new ArgumentOutOfRangeException(nameof(subscriptionIdentifier), - $@"Subscription {subscriptionIdentifier} was not found."); - - Account.Account? account = null; - if (!string.IsNullOrEmpty(provider)) - account = await accounts.LookupAccountByConnection(order.AccountId, provider); - else if (Guid.TryParse(order.AccountId, out var accountId)) - account = await db.Accounts.FirstOrDefaultAsync(a => a.Id == accountId); - - if (account is null) - throw new InvalidOperationException($"Account was not found with identifier {order.AccountId}"); - - var cycleDuration = order.Duration; - - var existingSubscription = await GetSubscriptionAsync(account.Id, subscriptionIdentifier); - if (existingSubscription is not null && existingSubscription.PaymentMethod != provider) - throw new InvalidOperationException( - $"Active subscription with identifier {subscriptionIdentifier} already exists."); - if (existingSubscription?.PaymentDetails.OrderId == order.Id) - return existingSubscription; - if (existingSubscription is not null) - { - // Same provider, but different order, renew the subscription - existingSubscription.PaymentDetails.OrderId = order.Id; - existingSubscription.EndedAt = order.BegunAt.Plus(cycleDuration); - existingSubscription.RenewalAt = order.BegunAt.Plus(cycleDuration); - existingSubscription.Status = SubscriptionStatus.Active; - - db.Update(existingSubscription); - await db.SaveChangesAsync(); - - return existingSubscription; - } - - var subscription = new Subscription - { - BegunAt = order.BegunAt, - EndedAt = order.BegunAt.Plus(cycleDuration), - IsActive = true, - Status = SubscriptionStatus.Active, - Identifier = subscriptionIdentifier, - PaymentMethod = provider, - PaymentDetails = new PaymentDetails - { - Currency = currency, - OrderId = order.Id, - }, - BasePrice = subscriptionTemplate.BasePrice, - RenewalAt = order.BegunAt.Plus(cycleDuration), - AccountId = account.Id, - }; - - db.WalletSubscriptions.Add(subscription); - await db.SaveChangesAsync(); - - await NotifySubscriptionBegun(subscription); - - return subscription; - } - - /// - /// Cancel the renewal of the current activated subscription. - /// - /// The user who requested the action. - /// The subscription identifier - /// - /// The active subscription was not found - public async Task CancelSubscriptionAsync(Guid accountId, string identifier) - { - var subscription = await GetSubscriptionAsync(accountId, identifier); - if (subscription is null) - throw new InvalidOperationException($"Subscription with identifier {identifier} was not found."); - if (subscription.Status != SubscriptionStatus.Active) - throw new InvalidOperationException("Subscription is already cancelled."); - if (subscription.RenewalAt is null) - throw new InvalidOperationException("Subscription is no need to be cancelled."); - if (subscription.PaymentMethod != SubscriptionPaymentMethod.InAppWallet) - throw new InvalidOperationException( - "Only in-app wallet subscription can be cancelled. For other payment methods, please head to the payment provider." - ); - - subscription.RenewalAt = null; - - await db.SaveChangesAsync(); - - // Invalidate the cache for this subscription - var cacheKey = $"{SubscriptionCacheKeyPrefix}{accountId}:{identifier}"; - await cache.RemoveAsync(cacheKey); - - return subscription; - } - - public const string SubscriptionOrderIdentifier = "solian.subscription.order"; - - /// - /// Creates a subscription order for an unpaid or expired subscription. - /// If the subscription is active, it will extend its expiration date. - /// - /// The unique identifier for the account associated with the subscription. - /// The unique subscription identifier. - /// A task that represents the asynchronous operation. The task result contains the created subscription order. - /// Thrown when no matching unpaid or expired subscription is found. - public async Task CreateSubscriptionOrder(Guid accountId, string identifier) - { - var subscription = await db.WalletSubscriptions - .Where(s => s.AccountId == accountId && s.Identifier == identifier) - .Where(s => s.Status != SubscriptionStatus.Expired) - .Include(s => s.Coupon) - .OrderByDescending(s => s.BegunAt) - .FirstOrDefaultAsync(); - if (subscription is null) throw new InvalidOperationException("No matching subscription found."); - - var subscriptionInfo = SubscriptionTypeData.SubscriptionDict - .TryGetValue(subscription.Identifier, out var template) - ? template - : null; - if (subscriptionInfo is null) throw new InvalidOperationException("No matching subscription found."); - - return await payment.CreateOrderAsync( - null, - subscriptionInfo.Currency, - subscription.FinalPrice, - appIdentifier: SubscriptionOrderIdentifier, - meta: new Dictionary() - { - ["subscription_id"] = subscription.Id.ToString(), - ["subscription_identifier"] = subscription.Identifier, - } - ); - } - - public async Task HandleSubscriptionOrder(Order order) - { - if (order.AppIdentifier != SubscriptionOrderIdentifier || order.Status != OrderStatus.Paid || - order.Meta?["subscription_id"] is not JsonElement subscriptionIdJson) - throw new InvalidOperationException("Invalid order."); - - var subscriptionId = Guid.TryParse(subscriptionIdJson.ToString(), out var parsedSubscriptionId) - ? parsedSubscriptionId - : Guid.Empty; - if (subscriptionId == Guid.Empty) - throw new InvalidOperationException("Invalid order."); - var subscription = await db.WalletSubscriptions - .Where(s => s.Id == subscriptionId) - .Include(s => s.Coupon) - .FirstOrDefaultAsync(); - if (subscription is null) - throw new InvalidOperationException("Invalid order."); - - if (subscription.Status == SubscriptionStatus.Expired) - { - var now = SystemClock.Instance.GetCurrentInstant(); - var cycle = subscription.BegunAt.Minus(subscription.RenewalAt ?? subscription.EndedAt ?? now); - - var nextRenewalAt = subscription.RenewalAt?.Plus(cycle); - var nextEndedAt = subscription.EndedAt?.Plus(cycle); - - subscription.RenewalAt = nextRenewalAt; - subscription.EndedAt = nextEndedAt; - } - - subscription.Status = SubscriptionStatus.Active; - - db.Update(subscription); - await db.SaveChangesAsync(); - - if (subscription.Identifier.StartsWith(SubscriptionType.StellarProgram)) - { - await db.AccountProfiles - .Where(a => a.AccountId == subscription.AccountId) - .ExecuteUpdateAsync(s => s.SetProperty(a => a.StellarMembership, subscription.ToReference())); - } - - await NotifySubscriptionBegun(subscription); - - return subscription; - } - - /// - /// Updates the status of expired subscriptions to reflect their current state. - /// This helps maintain accurate subscription records and is typically called periodically. - /// - /// Maximum number of subscriptions to process - /// Number of subscriptions that were marked as expired - public async Task UpdateExpiredSubscriptionsAsync(int batchSize = 100) - { - var now = SystemClock.Instance.GetCurrentInstant(); - - // Find active subscriptions that have passed their end date - var expiredSubscriptions = await db.WalletSubscriptions - .Where(s => s.IsActive) - .Where(s => s.Status == SubscriptionStatus.Active) - .Where(s => s.EndedAt.HasValue && s.EndedAt.Value < now) - .Take(batchSize) - .ToListAsync(); - - if (expiredSubscriptions.Count == 0) - return 0; - - foreach (var subscription in expiredSubscriptions) - { - subscription.Status = SubscriptionStatus.Expired; - - // Clear the cache for this subscription - var cacheKey = $"{SubscriptionCacheKeyPrefix}{subscription.AccountId}:{subscription.Identifier}"; - await cache.RemoveAsync(cacheKey); - } - - await db.SaveChangesAsync(); - return expiredSubscriptions.Count; - } - - private async Task NotifySubscriptionBegun(Subscription subscription) - { - var account = await db.Accounts.FirstOrDefaultAsync(a => a.Id == subscription.AccountId); - if (account is null) return; - - AccountService.SetCultureInfo(account); - - var humanReadableName = - SubscriptionTypeData.SubscriptionHumanReadable.TryGetValue(subscription.Identifier, out var humanReadable) - ? humanReadable - : subscription.Identifier; - var duration = subscription.EndedAt is not null - ? subscription.EndedAt.Value.Minus(subscription.BegunAt).Days.ToString() - : "infinite"; - - await nty.SendNotification( - account, - "subscriptions.begun", - localizer["SubscriptionAppliedTitle", humanReadableName], - null, - localizer["SubscriptionAppliedBody", duration, humanReadableName], - new Dictionary() - { - ["subscription_id"] = subscription.Id.ToString(), - } - ); - } - - private const string SubscriptionCacheKeyPrefix = "subscription:"; - - public async Task GetSubscriptionAsync(Guid accountId, params string[] identifiers) - { - // Create a unique cache key for this subscription - var cacheKey = $"{SubscriptionCacheKeyPrefix}{accountId}:{string.Join(",", identifiers)}"; - - // Try to get the subscription from cache first - var (found, cachedSubscription) = await cache.GetAsyncWithStatus(cacheKey); - if (found && cachedSubscription != null) - { - return cachedSubscription; - } - - // If not in cache, get from database - var subscription = await db.WalletSubscriptions - .Where(s => s.AccountId == accountId && identifiers.Contains(s.Identifier)) - .OrderByDescending(s => s.BegunAt) - .FirstOrDefaultAsync(); - - // Cache the result if found (with 30 minutes expiry) - if (subscription != null) - await cache.SetAsync(cacheKey, subscription, TimeSpan.FromMinutes(30)); - - return subscription; - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/Wallet.cs b/DysonNetwork.Sphere/Wallet/Wallet.cs deleted file mode 100644 index e69d251..0000000 --- a/DysonNetwork.Sphere/Wallet/Wallet.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; - -namespace DysonNetwork.Sphere.Wallet; - -public class Wallet : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - - public ICollection Pockets { get; set; } = new List(); - - public Guid AccountId { get; set; } - public Account.Account Account { get; set; } = null!; -} - -public class WalletPocket : ModelBase -{ - public Guid Id { get; set; } = Guid.NewGuid(); - [MaxLength(128)] public string Currency { get; set; } = null!; - public decimal Amount { get; set; } - - public Guid WalletId { get; set; } - [JsonIgnore] public Wallet Wallet { get; set; } = null!; -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/WalletController.cs b/DysonNetwork.Sphere/Wallet/WalletController.cs deleted file mode 100644 index 6b256b9..0000000 --- a/DysonNetwork.Sphere/Wallet/WalletController.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using DysonNetwork.Sphere.Permission; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Wallet; - -[ApiController] -[Route("/api/wallets")] -public class WalletController(AppDatabase db, WalletService ws, PaymentService payment) : ControllerBase -{ - [HttpPost] - [Authorize] - public async Task> CreateWallet() - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - try - { - var wallet = await ws.CreateWalletAsync(currentUser.Id); - return Ok(wallet); - } - catch (Exception err) - { - return BadRequest(err.Message); - } - } - - [HttpGet] - [Authorize] - public async Task> GetWallet() - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - var wallet = await ws.GetWalletAsync(currentUser.Id); - if (wallet is null) return NotFound("Wallet was not found, please create one first."); - return Ok(wallet); - } - - [HttpGet("transactions")] - [Authorize] - public async Task>> GetTransactions( - [FromQuery] int offset = 0, [FromQuery] int take = 20 - ) - { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); - - var query = db.PaymentTransactions.AsQueryable() - .Include(t => t.PayeeWallet) - .Include(t => t.PayerWallet) - .Where(t => (t.PayeeWallet != null && t.PayeeWallet.AccountId == currentUser.Id) || - (t.PayerWallet != null && t.PayerWallet.AccountId == currentUser.Id)); - - var transactionCount = await query.CountAsync(); - var transactions = await query - .Skip(offset) - .Take(take) - .OrderByDescending(t => t.CreatedAt) - .ToListAsync(); - - Response.Headers["X-Total"] = transactionCount.ToString(); - - return Ok(transactions); - } - - public class WalletBalanceRequest - { - public string? Remark { get; set; } - [Required] public decimal Amount { get; set; } - [Required] public string Currency { get; set; } = null!; - [Required] public Guid AccountId { get; set; } - } - - [HttpPost("balance")] - [Authorize] - [RequiredPermission("maintenance", "wallets.balance.modify")] - public async Task> ModifyWalletBalance([FromBody] WalletBalanceRequest request) - { - var wallet = await ws.GetWalletAsync(request.AccountId); - if (wallet is null) return NotFound("Wallet was not found."); - - var transaction = request.Amount >= 0 - ? await payment.CreateTransactionAsync( - payerWalletId: null, - payeeWalletId: wallet.Id, - currency: request.Currency, - amount: request.Amount, - remarks: request.Remark - ) - : await payment.CreateTransactionAsync( - payerWalletId: wallet.Id, - payeeWalletId: null, - currency: request.Currency, - amount: request.Amount, - remarks: request.Remark - ); - - return Ok(transaction); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Wallet/WalletService.cs b/DysonNetwork.Sphere/Wallet/WalletService.cs deleted file mode 100644 index 4d4d086..0000000 --- a/DysonNetwork.Sphere/Wallet/WalletService.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace DysonNetwork.Sphere.Wallet; - -public class WalletService(AppDatabase db) -{ - public async Task GetWalletAsync(Guid accountId) - { - return await db.Wallets - .Include(w => w.Pockets) - .FirstOrDefaultAsync(w => w.AccountId == accountId); - } - - public async Task CreateWalletAsync(Guid accountId) - { - var existingWallet = await db.Wallets.FirstOrDefaultAsync(w => w.AccountId == accountId); - if (existingWallet != null) - { - throw new InvalidOperationException($"Wallet already exists for account {accountId}"); - } - - var wallet = new Wallet { AccountId = accountId }; - - db.Wallets.Add(wallet); - await db.SaveChangesAsync(); - - return wallet; - } - - public async Task<(WalletPocket wallet, bool isNewlyCreated)> GetOrCreateWalletPocketAsync( - Guid walletId, - string currency, - decimal? initialAmount = null - ) - { - var pocket = await db.WalletPockets.FirstOrDefaultAsync(p => p.Currency == currency && p.WalletId == walletId); - if (pocket != null) return (pocket, false); - - pocket = new WalletPocket - { - Currency = currency, - Amount = initialAmount ?? 0, - WalletId = walletId - }; - - db.WalletPockets.Add(pocket); - return (pocket, true); - } -} \ No newline at end of file diff --git a/DysonNetwork.Sphere/Connection/WebReader/EmbeddableBase.cs b/DysonNetwork.Sphere/WebReader/EmbeddableBase.cs similarity index 95% rename from DysonNetwork.Sphere/Connection/WebReader/EmbeddableBase.cs rename to DysonNetwork.Sphere/WebReader/EmbeddableBase.cs index afca49a..d1a499a 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/EmbeddableBase.cs +++ b/DysonNetwork.Sphere/WebReader/EmbeddableBase.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Text.Json.Serialization; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; /// /// The embeddable can be used in the post or messages' meta's embeds fields diff --git a/DysonNetwork.Sphere/Connection/WebReader/LinkEmbed.cs b/DysonNetwork.Sphere/WebReader/LinkEmbed.cs similarity index 96% rename from DysonNetwork.Sphere/Connection/WebReader/LinkEmbed.cs rename to DysonNetwork.Sphere/WebReader/LinkEmbed.cs index ab2131f..b83cdcc 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/LinkEmbed.cs +++ b/DysonNetwork.Sphere/WebReader/LinkEmbed.cs @@ -1,4 +1,4 @@ -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; /// /// The link embed is a part of the embeddable implementations diff --git a/DysonNetwork.Sphere/Connection/WebReader/ScrapedArticle.cs b/DysonNetwork.Sphere/WebReader/ScrapedArticle.cs similarity index 70% rename from DysonNetwork.Sphere/Connection/WebReader/ScrapedArticle.cs rename to DysonNetwork.Sphere/WebReader/ScrapedArticle.cs index 6c39028..2c724e3 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/ScrapedArticle.cs +++ b/DysonNetwork.Sphere/WebReader/ScrapedArticle.cs @@ -1,4 +1,4 @@ -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; public class ScrapedArticle { diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebArticle.cs b/DysonNetwork.Sphere/WebReader/WebArticle.cs similarity index 96% rename from DysonNetwork.Sphere/Connection/WebReader/WebArticle.cs rename to DysonNetwork.Sphere/WebReader/WebArticle.cs index 09b4291..fb06ed7 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebArticle.cs +++ b/DysonNetwork.Sphere/WebReader/WebArticle.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; public class WebArticle : ModelBase { diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebArticleController.cs b/DysonNetwork.Sphere/WebReader/WebArticleController.cs similarity index 97% rename from DysonNetwork.Sphere/Connection/WebReader/WebArticleController.cs rename to DysonNetwork.Sphere/WebReader/WebArticleController.cs index 96b73b6..05f4d50 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebArticleController.cs +++ b/DysonNetwork.Sphere/WebReader/WebArticleController.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; [ApiController] [Route("/api/feeds/articles")] diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebFeedController.cs b/DysonNetwork.Sphere/WebReader/WebFeedController.cs similarity index 78% rename from DysonNetwork.Sphere/Connection/WebReader/WebFeedController.cs rename to DysonNetwork.Sphere/WebReader/WebFeedController.cs index 4001447..047e7fa 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebFeedController.cs +++ b/DysonNetwork.Sphere/WebReader/WebFeedController.cs @@ -1,9 +1,10 @@ using System.ComponentModel.DataAnnotations; +using DysonNetwork.Shared.Proto; using DysonNetwork.Sphere.Publisher; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; [Authorize] [ApiController] @@ -43,7 +44,7 @@ public class WebFeedController(WebFeedService webFeed, PublisherService ps) : Co [Authorize] public async Task CreateWebFeed([FromRoute] string pubName, [FromBody] WebFeedRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); if (string.IsNullOrWhiteSpace(request.Url) || string.IsNullOrWhiteSpace(request.Title)) return BadRequest("Url and title are required"); @@ -51,7 +52,8 @@ public class WebFeedController(WebFeedService webFeed, PublisherService ps) : Co var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); - if (!await ps.IsMemberWithRole(publisher.Id, currentUser.Id, PublisherMemberRole.Editor)) + var accountId = Guid.Parse(currentUser.Id); + if (!await ps.IsMemberWithRole(publisher.Id, accountId, PublisherMemberRole.Editor)) return StatusCode(403, "You must be an editor of the publisher to create a web feed"); var feed = await webFeed.CreateWebFeedAsync(publisher, request); @@ -62,12 +64,13 @@ public class WebFeedController(WebFeedService webFeed, PublisherService ps) : Co [Authorize] public async Task UpdateFeed([FromRoute] string pubName, Guid id, [FromBody] WebFeedRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); - if (!await ps.IsMemberWithRole(publisher.Id, currentUser.Id, PublisherMemberRole.Editor)) + var accountId = Guid.Parse(currentUser.Id); + if (!await ps.IsMemberWithRole(publisher.Id, accountId, PublisherMemberRole.Editor)) return StatusCode(403, "You must be an editor of the publisher to update a web feed"); var feed = await webFeed.GetFeedAsync(id, publisherId: publisher.Id); @@ -82,12 +85,13 @@ public class WebFeedController(WebFeedService webFeed, PublisherService ps) : Co [Authorize] public async Task DeleteFeed([FromRoute] string pubName, Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); - if (!await ps.IsMemberWithRole(publisher.Id, currentUser.Id, PublisherMemberRole.Editor)) + var accountId = Guid.Parse(currentUser.Id); + if (!await ps.IsMemberWithRole(publisher.Id, accountId, PublisherMemberRole.Editor)) return StatusCode(403, "You must be an editor of the publisher to delete a web feed"); var feed = await webFeed.GetFeedAsync(id, publisherId: publisher.Id); @@ -104,12 +108,13 @@ public class WebFeedController(WebFeedService webFeed, PublisherService ps) : Co [Authorize] public async Task Scrap([FromRoute] string pubName, Guid id) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized(); var publisher = await ps.GetPublisherByName(pubName); if (publisher is null) return NotFound(); - if (!await ps.IsMemberWithRole(publisher.Id, currentUser.Id, PublisherMemberRole.Editor)) + var accountId = Guid.Parse(currentUser.Id); + if (!await ps.IsMemberWithRole(publisher.Id, accountId, PublisherMemberRole.Editor)) return StatusCode(403, "You must be an editor of the publisher to scrape a web feed"); var feed = await webFeed.GetFeedAsync(id, publisherId: publisher.Id); diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebFeedScraperJob.cs b/DysonNetwork.Sphere/WebReader/WebFeedScraperJob.cs similarity index 94% rename from DysonNetwork.Sphere/Connection/WebReader/WebFeedScraperJob.cs rename to DysonNetwork.Sphere/WebReader/WebFeedScraperJob.cs index fb9bc61..753d0c4 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebFeedScraperJob.cs +++ b/DysonNetwork.Sphere/WebReader/WebFeedScraperJob.cs @@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Quartz; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; [DisallowConcurrentExecution] public class WebFeedScraperJob( diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebFeedService.cs b/DysonNetwork.Sphere/WebReader/WebFeedService.cs similarity index 98% rename from DysonNetwork.Sphere/Connection/WebReader/WebFeedService.cs rename to DysonNetwork.Sphere/WebReader/WebFeedService.cs index fe8273b..8ced368 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebFeedService.cs +++ b/DysonNetwork.Sphere/WebReader/WebFeedService.cs @@ -2,7 +2,7 @@ using System.ServiceModel.Syndication; using System.Xml; using Microsoft.EntityFrameworkCore; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; public class WebFeedService( AppDatabase database, diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebReaderController.cs b/DysonNetwork.Sphere/WebReader/WebReaderController.cs similarity index 98% rename from DysonNetwork.Sphere/Connection/WebReader/WebReaderController.cs rename to DysonNetwork.Sphere/WebReader/WebReaderController.cs index 013e790..c400d0e 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebReaderController.cs +++ b/DysonNetwork.Sphere/WebReader/WebReaderController.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.RateLimiting; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; /// /// Controller for web scraping and link preview services diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebReaderException.cs b/DysonNetwork.Sphere/WebReader/WebReaderException.cs similarity index 87% rename from DysonNetwork.Sphere/Connection/WebReader/WebReaderException.cs rename to DysonNetwork.Sphere/WebReader/WebReaderException.cs index 31b8032..651ac54 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebReaderException.cs +++ b/DysonNetwork.Sphere/WebReader/WebReaderException.cs @@ -1,6 +1,6 @@ using System; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; /// /// Exception thrown when an error occurs during web reading operations diff --git a/DysonNetwork.Sphere/Connection/WebReader/WebReaderService.cs b/DysonNetwork.Sphere/WebReader/WebReaderService.cs similarity index 99% rename from DysonNetwork.Sphere/Connection/WebReader/WebReaderService.cs rename to DysonNetwork.Sphere/WebReader/WebReaderService.cs index d7f9bda..3992be7 100644 --- a/DysonNetwork.Sphere/Connection/WebReader/WebReaderService.cs +++ b/DysonNetwork.Sphere/WebReader/WebReaderService.cs @@ -1,10 +1,10 @@ using System.Globalization; using AngleSharp; using AngleSharp.Dom; -using DysonNetwork.Sphere.Storage; +using DysonNetwork.Shared.Cache; using HtmlAgilityPack; -namespace DysonNetwork.Sphere.Connection.WebReader; +namespace DysonNetwork.Sphere.WebReader; /// /// The service is amin to providing scrapping service to the Solar Network. @@ -13,7 +13,8 @@ namespace DysonNetwork.Sphere.Connection.WebReader; public class WebReaderService( IHttpClientFactory httpClientFactory, ILogger logger, - ICacheService cache) + ICacheService cache +) { private const string LinkPreviewCachePrefix = "scrap:preview:"; private const string LinkPreviewCacheGroup = "scrap:preview"; @@ -38,6 +39,7 @@ public class WebReaderService( logger.LogWarning("Failed to scrap article content for URL: {Url}", url); return null; } + var html = await response.Content.ReadAsStringAsync(cancellationToken); var doc = new HtmlDocument(); doc.LoadHtml(html); diff --git a/DysonNetwork.sln.DotSettings.user b/DysonNetwork.sln.DotSettings.user index c388d6b..04f33c9 100644 --- a/DysonNetwork.sln.DotSettings.user +++ b/DysonNetwork.sln.DotSettings.user @@ -71,6 +71,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded