diff --git a/extra/admin-api/ConfigTest/ConfigTest.csproj b/extra/admin-api/ConfigTest/ConfigTest.csproj
deleted file mode 100644
index 7eea9a8..0000000
--- a/extra/admin-api/ConfigTest/ConfigTest.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- net10.0
- enable
- enable
- dotnet-ConfigTest-18d89c0e-df5d-447b-8429-7d526a35ab13
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/extra/admin-api/ConfigTest/Program.cs b/extra/admin-api/ConfigTest/Program.cs
deleted file mode 100644
index 5945bcf..0000000
--- a/extra/admin-api/ConfigTest/Program.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using ConfigTest;
-using Microsoft.EntityFrameworkCore;
-using Spacebar.Db.Contexts;
-
-var builder = Host.CreateApplicationBuilder(args);
-builder.Services.AddHostedService();
-builder.Services.AddDbContext(options => {
- options
- .UseNpgsql(builder.Configuration.GetConnectionString("Spacebar"))
- .EnableDetailedErrors();
-}, ServiceLifetime.Singleton);
-
-var host = builder.Build();
-host.Run();
diff --git a/extra/admin-api/ConfigTest/Properties/launchSettings.json b/extra/admin-api/ConfigTest/Properties/launchSettings.json
deleted file mode 100644
index c355f36..0000000
--- a/extra/admin-api/ConfigTest/Properties/launchSettings.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json.schemastore.org/launchsettings.json",
- "profiles": {
- "ConfigTest": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "environmentVariables": {
- "DOTNET_ENVIRONMENT": "Development"
- }
- }
- }
-}
diff --git a/extra/admin-api/ConfigTest/Worker.cs b/extra/admin-api/ConfigTest/Worker.cs
deleted file mode 100644
index dd3ef77..0000000
--- a/extra/admin-api/ConfigTest/Worker.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Text.Json.Nodes;
-using Spacebar.ConfigModel.Extensions;
-using Spacebar.Db.Contexts;
-
-namespace ConfigTest;
-
-public class Worker(ILogger logger, SpacebarDbContext db) : BackgroundService
-{
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
- var config = db.Configs
- .OrderBy(x => x.Key)
- .ToDictionary(x => x.Key, x => x.Value);
- foreach (var (key, value) in config)
- {
- Console.WriteLine("Config Key: {0}, Value: {1}", key, value ?? "[NULL]");
- }
-
- var readConfig = config.ToNestedJsonObject();
- Console.WriteLine(readConfig);
- var mapped = readConfig.ToFlatKv();
- foreach (var (key, value) in mapped)
- {
- Console.WriteLine("Mapped Key: {0}, Value: {1}", key, value ?? "[NULL]");
- }
-
- // check that they're equal
- foreach (var (key, value) in config)
- {
- if (!mapped.ContainsKey(key))
- {
- Console.WriteLine("Missing Key in Mapped: {0}", key);
- continue;
- }
-
- if (mapped[key] != value)
- {
- Console.WriteLine("Value Mismatch for Key: {0}, Original: {1}, Mapped: {2}", key, value ?? "[NULL]", mapped[key] ?? "[NULL]");
- }
- }
- Environment.Exit(0);
- }
-}
\ No newline at end of file
diff --git a/extra/admin-api/ConfigTest/appsettings.Development.json b/extra/admin-api/ConfigTest/appsettings.Development.json
deleted file mode 100644
index 0324577..0000000
--- a/extra/admin-api/ConfigTest/appsettings.Development.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Trace", //Warning
- "Microsoft.AspNetCore.Mvc": "Warning", //Warning
- "Microsoft.AspNetCore.HostFiltering": "Warning", //Warning
- "Microsoft.AspNetCore.Cors": "Warning", //Warning
- // "Microsoft.EntityFrameworkCore": "Warning"
- "Microsoft.EntityFrameworkCore.Database.Command": "Debug"
- }
- },
- "ConnectionStrings": {
- "Spacebar": "Host=127.0.0.1; Username=postgres; Database=spacebar; Port=5432; Include Error Detail=true; Maximum Pool Size=1000; Command Timeout=6000; Timeout=600;",
- },
- "RabbitMQ": {
- "Host": "127.0.0.1",
- "Port": 5673,
- "Username": "guest",
- "Password": "guest"
- },
- "SpacebarAdminApi": {
- "Enforce2FA": true,
- "OverrideUid": null,
- "DisableAuthentication": false
- }
-}
diff --git a/extra/admin-api/ConfigTest/appsettings.json b/extra/admin-api/ConfigTest/appsettings.json
deleted file mode 100644
index 10f68b8..0000000
--- a/extra/admin-api/ConfigTest/appsettings.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "AllowedHosts": "*"
-}
diff --git a/extra/admin-api/DiscordEmojiConverter/DiscordEmojiConverter.csproj b/extra/admin-api/DiscordEmojiConverter/DiscordEmojiConverter.csproj
deleted file mode 100644
index 72d306b..0000000
--- a/extra/admin-api/DiscordEmojiConverter/DiscordEmojiConverter.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Exe
- net10.0
- enable
- enable
-
-
-
-
-
-
-
diff --git a/extra/admin-api/DiscordEmojiConverter/DiscordEmojiJson.cs b/extra/admin-api/DiscordEmojiConverter/DiscordEmojiJson.cs
deleted file mode 100644
index 71c4a53..0000000
--- a/extra/admin-api/DiscordEmojiConverter/DiscordEmojiJson.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace DiscordEmojiConverter;
-
-public class DiscordEmojiJson {
- [JsonPropertyName("emojis")]
- public List? Emojis { get; set; }
-
- [JsonPropertyName("emojisByCategory")]
- public Dictionary>? EmojisByCategory { get; set; }
-
- [JsonPropertyName("nameToEmoji")]
- public Dictionary? NameToEmoji { get; set; }
-
- [JsonPropertyName("surrogateToEmoji")]
- public Dictionary? SurrogateToEmoji { get; set; }
-
- [JsonPropertyName("numDiversitySprites")]
- public int? NumDiversitySprites { get; set; }
-
- [JsonPropertyName("numNonDiversitySprites")]
- public int? NumNonDiversitySprites { get; set; }
-}
-
-public class DiscordEmoji {
- [JsonPropertyName("names")]
- public List? Names { get; set; }
-
- [JsonPropertyName("surrogates")]
- public string? Surrogates { get; set; }
-
- [JsonPropertyName("unicodeVersion")]
- public float? UnicodeVersion { get; set; }
-
- [JsonPropertyName("spriteIndex")]
- public int? SpriteIndex { get; set; }
-
- [JsonPropertyName("hasMultiDiversity")]
- public bool? HasMultiDiversity { get; set; }
-
- [JsonPropertyName("hasMultiDiversityParent")]
- public bool? HasMultiDiversityParent { get; set; }
-
- [JsonPropertyName("hasDiversity")]
- public bool? HasDiversity { get; set; }
-
- [JsonPropertyName("hasDiversityParent")]
- public bool? HasDiversityParent { get; set; }
-
- [JsonPropertyName("diversityChildren")]
- public List? DiversityChildren { get; set; }
-
- [JsonPropertyName("diversity")]
- public List? Diversity { get; set; }
-}
\ No newline at end of file
diff --git a/extra/admin-api/DiscordEmojiConverter/Program.cs b/extra/admin-api/DiscordEmojiConverter/Program.cs
deleted file mode 100644
index 9659395..0000000
--- a/extra/admin-api/DiscordEmojiConverter/Program.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// See https://aka.ms/new-console-template for more information
-
-using System.Text.Json;
-using System.Text.Json.Nodes;
-using System.Text.Json.Serialization;
-using ArcaneLibs.Extensions;
-using DiscordEmojiConverter;
-
-var emojis = JsonSerializer.Deserialize(File.OpenRead(args[0]),
- new JsonSerializerOptions() { UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow });
-
-emojis.SurrogateToEmoji = null;
-emojis.NameToEmoji = null;
-emojis.NumDiversitySprites = null;
-emojis.NumNonDiversitySprites = null;
-
-foreach (var emoji in emojis.Emojis!)
-{
- emoji.HasDiversity = null;
- emoji.HasDiversityParent = null;
- emoji.HasMultiDiversity = null;
- emoji.HasMultiDiversityParent = null;
- emoji.SpriteIndex = null;
- emoji.UnicodeVersion = null;
-}
-
-Console.WriteLine(emojis.ToJson(ignoreNull: true, indent: false));
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/ApplicationModel.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/ApplicationModel.cs
new file mode 100644
index 0000000..5428579
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/ApplicationModel.cs
@@ -0,0 +1,33 @@
+namespace Spacebar.Models.AdminApi;
+
+public class ApplicationModel {
+ public string Id { get; set; } = null!;
+ public string Name { get; set; } = null!;
+ public string? Icon { get; set; }
+ public string? Description { get; set; }
+ public string? Summary { get; set; }
+ public string? Type { get; set; }
+ public bool Hook { get; set; }
+ public bool BotPublic { get; set; }
+ public bool BotRequireCodeGrant { get; set; }
+ public int Flags { get; set; }
+ public string? RedirectUris { get; set; }
+ public int? RpcApplicationState { get; set; }
+ public int? StoreApplicationState { get; set; }
+ public int? VerificationState { get; set; }
+ public string? InteractionsEndpointUrl { get; set; }
+ public bool? IntegrationPublic { get; set; }
+ public bool? IntegrationRequireCodeGrant { get; set; }
+ public int? DiscoverabilityState { get; set; }
+ public int? DiscoveryEligibilityFlags { get; set; }
+ public string? Tags { get; set; }
+ public string? CoverImage { get; set; }
+ public string? InstallParams { get; set; }
+ public string? TermsOfServiceUrl { get; set; }
+ public string? PrivacyPolicyUrl { get; set; }
+ public string? GuildId { get; set; }
+ public string? CustomInstallUrl { get; set; }
+ public string? OwnerId { get; set; }
+ public string? BotUserId { get; set; }
+ public string? TeamId { get; set; }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/AsyncActionResult.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/AsyncActionResult.cs
new file mode 100644
index 0000000..c306b95
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/AsyncActionResult.cs
@@ -0,0 +1,18 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.Models.AdminApi;
+
+public class AsyncActionResult {
+ public AsyncActionResult() { }
+
+ public AsyncActionResult(string type, object? data) {
+ MessageType = type;
+ Data = data;
+ }
+
+ [JsonPropertyName("type")]
+ public string MessageType { get; set; }
+
+ [JsonPropertyName("data")]
+ public object Data { get; set; }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/FileMetadataModel.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/FileMetadataModel.cs
new file mode 100644
index 0000000..56c5eaf
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/FileMetadataModel.cs
@@ -0,0 +1,23 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.Models.AdminApi;
+
+public class FileMetadataModel {
+ public string UserId { get; set; } = null!;
+ public string Id { get; set; } = null!;
+
+ [JsonConverter(typeof(JsonStringEnumConverter))]
+ public FileUploadType Type { get; set; }
+
+
+ public enum FileUploadType {
+ Attachment,
+ Avatar,
+ Banner,
+ GuildIcon,
+ GuildSplash,
+ GuildCover,
+ Emoji,
+ Sticker
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/ForceJoinRequest.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/ForceJoinRequest.cs
new file mode 100644
index 0000000..495e517
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/ForceJoinRequest.cs
@@ -0,0 +1,7 @@
+namespace Spacebar.Models.AdminApi;
+
+public class ForceJoinRequest {
+ public string? UserId { get; set; } = null!;
+ public bool MakeAdmin { get; set; } = false;
+ public bool MakeOwner { get; set; } = false;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/GuildModel.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/GuildModel.cs
new file mode 100644
index 0000000..ae516f1
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/GuildModel.cs
@@ -0,0 +1,53 @@
+namespace Spacebar.Models.AdminApi;
+
+public class GuildModel {
+ public string Id { get; set; } = null!;
+ public string? AfkChannelId { get; set; }
+ public int? AfkTimeout { get; set; }
+ public string? Banner { get; set; }
+ public int? DefaultMessageNotifications { get; set; }
+ public string? Description { get; set; }
+ public string? DiscoverySplash { get; set; }
+ public int? ExplicitContentFilter { get; set; }
+ public string Features { get; set; } = null!;
+ public string? PrimaryCategoryId { get; set; }
+ public string? Icon { get; set; }
+ public bool Large { get; set; }
+ public int? MaxMembers { get; set; }
+ public int? MaxPresences { get; set; }
+ public int? MaxVideoChannelUsers { get; set; }
+ public int? MemberCount { get; set; }
+ public int? PresenceCount { get; set; }
+ public string? TemplateId { get; set; }
+ public int? MfaLevel { get; set; }
+ public string Name { get; set; } = null!;
+ public string? OwnerId { get; set; }
+ public string? PreferredLocale { get; set; }
+ public int? PremiumSubscriptionCount { get; set; }
+ public int PremiumTier { get; set; }
+ public string? PublicUpdatesChannelId { get; set; }
+ public string? RulesChannelId { get; set; }
+ public string? Region { get; set; }
+ public string? Splash { get; set; }
+ public string? SystemChannelId { get; set; }
+ public int? SystemChannelFlags { get; set; }
+ public bool Unavailable { get; set; }
+ public int? VerificationLevel { get; set; }
+ public string WelcomeScreen { get; set; } = null!;
+ public string? WidgetChannelId { get; set; }
+ public bool WidgetEnabled { get; set; }
+ public int? NsfwLevel { get; set; }
+ public bool Nsfw { get; set; }
+ public string? Parent { get; set; }
+ public bool? PremiumProgressBarEnabled { get; set; }
+ public string ChannelOrdering { get; set; } = null!;
+
+ public int ChannelCount { get; set; }
+ public int RoleCount { get; set; }
+ public int EmojiCount { get; set; }
+ public int StickerCount { get; set; }
+ public int InviteCount { get; set; }
+ public int MessageCount { get; set; }
+ public int BanCount { get; set; }
+ public int VoiceStateCount { get; set; }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/Rights.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/Rights.cs
new file mode 100644
index 0000000..62785f5
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/Rights.cs
@@ -0,0 +1,81 @@
+using System.Diagnostics.CodeAnalysis;
+
+namespace Spacebar.Models.AdminApi;
+
+public static class SpacebarRights {
+ [Flags]
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
+ public enum Rights : ulong {
+ OPERATOR = 1ul << 0, // has all rights
+ MANAGE_APPLICATIONS = 1ul << 1,
+ MANAGE_GUILDS = 1ul << 2, // Manage all guilds instance-wide
+ MANAGE_MESSAGES = 1ul << 3, // Can't see other messages but delete/edit them in channels that they can see
+ MANAGE_RATE_LIMITS = 1ul << 4,
+ MANAGE_ROUTING = 1ul << 5, // can create custom message routes to any channel/guild
+ MANAGE_TICKETS = 1ul << 6, // can respond to and resolve support tickets
+ MANAGE_USERS = 1ul << 7,
+ ADD_MEMBERS = 1ul << 8, // can manually add any members in their guilds
+ BYPASS_RATE_LIMITS = 1ul << 9,
+ CREATE_APPLICATIONS = 1ul << 10,
+ CREATE_CHANNELS = 1ul << 11, // can create guild channels or threads in the guilds that they have permission
+ CREATE_DMS = 1ul << 12,
+ CREATE_DM_GROUPS = 1ul << 13, // can create group DMs or custom orphan channels
+ CREATE_GUILDS = 1ul << 14,
+ CREATE_INVITES = 1ul << 15, // can create mass invites in the guilds that they have CREATE_INSTANT_INVITE
+ CREATE_ROLES = 1ul << 16,
+ CREATE_TEMPLATES = 1ul << 17,
+ CREATE_WEBHOOKS = 1ul << 18,
+ JOIN_GUILDS = 1ul << 19,
+ PIN_MESSAGES = 1ul << 20,
+ SELF_ADD_REACTIONS = 1ul << 21,
+ SELF_DELETE_MESSAGES = 1ul << 22,
+ SELF_EDIT_MESSAGES = 1ul << 23,
+ SELF_EDIT_NAME = 1ul << 24,
+ SEND_MESSAGES = 1ul << 25,
+ USE_ACTIVITIES = 1ul << 26, // use (game) activities in voice channels (e.g. Watch together)
+ USE_VIDEO = 1ul << 27,
+ USE_VOICE = 1ul << 28,
+ INVITE_USERS = 1ul << 29, // can create user-specific invites in the guilds that they have INVITE_USERS
+ SELF_DELETE_DISABLE = 1ul << 30, // can disable/delete own account
+ DEBTABLE = 1ul << 31, // can use pay-to-use features
+ CREDITABLE = 1ul << 32, // can receive money from monetisation related features
+ KICK_BAN_MEMBERS = 1ul << 33,
+
+ // can kick or ban guild or group DM members in the guilds/groups that they have KICK_MEMBERS, or BAN_MEMBERS
+ SELF_LEAVE_GROUPS = 1ul << 34,
+
+ // can leave the guilds or group DMs that they joined on their own (one can always leave a guild or group DMs they have been force-added)
+ PRESENCE = 1ul << 35,
+
+ // inverts the presence confidentiality default (OPERATOR's presence is not routed by default, others' are) for a given user
+ SELF_ADD_DISCOVERABLE = 1ul << 36, // can mark discoverable guilds that they have permissions to mark as discoverable
+ MANAGE_GUILD_DIRECTORY = 1ul << 37, // can change anything in the primary guild directory
+ POGGERS = 1ul << 38, // can send confetti, screenshake, random user mention (@someone)
+ USE_ACHIEVEMENTS = 1ul << 39, // can use achievements and cheers
+ INITIATE_INTERACTIONS = 1ul << 40, // can initiate interactions
+ RESPOND_TO_INTERACTIONS = 1ul << 41, // can respond to interactions
+ SEND_BACKDATED_EVENTS = 1ul << 42, // can send backdated events
+ USE_MASS_INVITES = 1ul << 43, // added per @xnacly's request - can accept mass invites
+ ACCEPT_INVITES = 1ul << 44, // added per @xnacly's request - can accept user-specific invites and DM requests
+ SELF_EDIT_FLAGS = 1ul << 45, // can modify own flags
+ EDIT_FLAGS = 1ul << 46, // can set others' flags
+ MANAGE_GROUPS = 1ul << 47, // can manage others' groups
+ VIEW_SERVER_STATS = 1ul << 48, // added per @chrischrome's request - can view server stats
+ RESEND_VERIFICATION_EMAIL = 1ul << 49, // can resend verification emails (/auth/verify/resend)
+ CREATE_REGISTRATION_TOKENS = 1ul << 50, // can create registration tokens (/auth/generate-registration-tokens)
+ }
+
+ public static bool HasAllRights(this Rights val, Rights rights) {
+ if (val.HasFlag(Rights.OPERATOR)) {
+ return true;
+ }
+
+ return (val & rights) == rights;
+ }
+
+ public static void AssertHasAllRights(this Rights val, Rights rights) {
+ if (!val.HasAllRights(rights)) {
+ throw new UnauthorizedAccessException("Insufficient rights: missing " + rights);
+ }
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/Spacebar.Models.AdminApi.csproj b/extra/admin-api/Models/Spacebar.Models.AdminApi/Spacebar.Models.AdminApi.csproj
new file mode 100644
index 0000000..d25bf93
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/Spacebar.Models.AdminApi.csproj
@@ -0,0 +1,10 @@
+
+
+
+ net10.0
+ preview
+ enable
+ enable
+
+
+
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/StickerModel.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/StickerModel.cs
new file mode 100644
index 0000000..0ad81b8
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/StickerModel.cs
@@ -0,0 +1,19 @@
+namespace Spacebar.Models.AdminApi;
+
+public class StickerModel {
+ public string Id { get; set; } = null!;
+ public string Name { get; set; } = null!;
+ public string? Description { get; set; }
+ public bool? Available { get; set; }
+ public string? Tags { get; set; }
+ public string? PackId { get; set; }
+ public string? GuildId { get; set; }
+ public string? UserId { get; set; }
+ public int Type { get; set; }
+ public int FormatType { get; set; }
+ // public virtual Guild? Guild { get; set; }
+ // public virtual StickerPack? Pack { get; set; }
+ // public virtual ICollection StickerPacks { get; set; } = new List();
+ // public virtual User? User { get; set; }
+ // public virtual ICollection Messages { get; set; } = new List();
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.AdminApi/UserModel.cs b/extra/admin-api/Models/Spacebar.Models.AdminApi/UserModel.cs
new file mode 100644
index 0000000..dd1d483
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.AdminApi/UserModel.cs
@@ -0,0 +1,66 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.Models.AdminApi;
+
+public class UserModel {
+ public string Id { get; set; } = null!;
+ public string Username { get; set; } = null!;
+ public string Discriminator { get; set; } = null!;
+ public string? Avatar { get; set; }
+ public int? AccentColor { get; set; }
+ public string? Banner { get; set; }
+ public string? ThemeColors { get; set; }
+ public string? Pronouns { get; set; }
+ public string? Phone { get; set; }
+ public bool Desktop { get; set; }
+ public bool Mobile { get; set; }
+ public bool Premium { get; set; }
+ public int PremiumType { get; set; }
+ public bool Bot { get; set; }
+ public string Bio { get; set; } = null!;
+ public bool System { get; set; }
+ public bool NsfwAllowed { get; set; }
+ public bool MfaEnabled { get; set; }
+ public bool WebauthnEnabled { get; set; }
+ public DateTime CreatedAt { get; set; }
+ public DateTime? PremiumSince { get; set; }
+ public bool Verified { get; set; }
+ public bool Disabled { get; set; }
+ public bool Deleted { get; set; }
+ public string? Email { get; set; }
+
+ [JsonNumberHandling(JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString)]
+ public ulong Flags { get; set; }
+
+ [JsonNumberHandling(JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString)]
+ public ulong PublicFlags { get; set; }
+
+ [JsonNumberHandling(JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString)]
+ public ulong Rights { get; set; }
+
+ public ApplicationModel? ApplicationBotUser { get; set; }
+ public List ConnectedAccounts { get; set; } = new();
+ public int GuildCount { get; set; }
+ public int OwnedGuildCount { get; set; }
+ public int SessionCount { get; set; }
+ public int TemplateCount { get; set; }
+ public int VoiceStateCount { get; set; }
+ public int MessageCount { get; set; }
+
+ public class ConnectedAccountModel {
+ public string Id { get; set; } = null!;
+ public string ExternalId { get; set; } = null!;
+ public string? UserId { get; set; }
+ public bool FriendSync { get; set; }
+ public string Name { get; set; } = null!;
+ public bool Revoked { get; set; }
+ public int ShowActivity { get; set; }
+ public string Type { get; set; } = null!;
+ public bool Verified { get; set; }
+ public int Visibility { get; set; }
+ public string Integrations { get; set; } = null!;
+ public string? Metadata { get; set; }
+ public int MetadataVisibility { get; set; }
+ public bool TwoWayLink { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/Config.cs b/extra/admin-api/Models/Spacebar.Models.Config/Config.cs
new file mode 100644
index 0000000..26e9d0f
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/Config.cs
@@ -0,0 +1,33 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class Config {
+ [JsonPropertyName("admin")]
+ public EndpointConfig Admin { get; set; } = null!;
+
+ [JsonPropertyName("api")]
+ public EndpointConfig Api { get; set; } = null!;
+
+ [JsonPropertyName("gateway")]
+ public EndpointConfig Gateway { get; set; } = null!;
+
+ [JsonPropertyName("cdn")]
+ public EndpointConfig Cdn { get; set; } = null!;
+}
+
+public class EndpointConfig {
+ [JsonPropertyName("endpointPrivate")]
+ public string? EndpointPrivate { get; set; }
+
+ [JsonPropertyName("endpointPublic")]
+ public string? EndpointPublic { get; set; }
+}
+
+public class ApiConfig : EndpointConfig {
+ [JsonPropertyName("activeVersions")]
+ public List ActiveVersions { get; set; } = null!;
+
+ [JsonPropertyName("defaultVersion")]
+ public string DefaultVersion { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/DefaultsConfiguration.cs b/extra/admin-api/Models/Spacebar.Models.Config/DefaultsConfiguration.cs
new file mode 100644
index 0000000..3cac4cb
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/DefaultsConfiguration.cs
@@ -0,0 +1,37 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class DefaultsConfiguration
+{
+ [JsonPropertyName("guild")] public GuildDefaults Guild = new();
+ [JsonPropertyName("user")] public ChannelDefaults Channel = new();
+}
+
+public class GuildDefaults
+{
+ [JsonPropertyName("maxPresences")] public int MaxPresences { get; set; } = 250000;
+
+ [JsonPropertyName("maxVideoChannelUsers")]
+ public int MaxVideoChannelUsers { get; set; } = 200;
+
+ [JsonPropertyName("afkTimeout")] public int AfkTimeout { get; set; } = 300;
+
+ [JsonPropertyName("defaultMessageNotifications")]
+ public int DefaultMessageNotifications { get; set; } = 1;
+
+ [JsonPropertyName("explicitContentFilter")]
+ public int ExplicitContentFilter { get; set; } = 0;
+}
+
+public class ChannelDefaults
+{
+ [JsonPropertyName("premium")]
+ public bool Premium { get; set; } = true;
+
+ [JsonPropertyName("premiumType")]
+ public int PremiumType { get; set; } = 2;
+
+ [JsonPropertyName("verified")]
+ public bool Verified { get; set; } = true;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/Extensions/JsonExtensions.cs b/extra/admin-api/Models/Spacebar.Models.Config/Extensions/JsonExtensions.cs
new file mode 100644
index 0000000..20ae733
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/Extensions/JsonExtensions.cs
@@ -0,0 +1,119 @@
+using System.Text.Json;
+using System.Text.Json.Nodes;
+
+namespace Spacebar.ConfigModel.Extensions;
+
+public static class JsonExtensions
+{
+ extension(Dictionary kv)
+ {
+ public JsonObject ToNestedJsonObject(string path = "$")
+ {
+ JsonObject root = new();
+ // group by prefix
+ var groups = kv.GroupBy(kvItem => kvItem.Key.Split('_', 2)[0]);
+ foreach (var group in groups)
+ {
+ var prefix = group.Key;
+
+ if (group.Count() == 1 && !group.First().Key.Contains('_'))
+ {
+ root[prefix] = group.First().Value == null ? null : JsonNode.Parse(group.First().Value!);
+ Console.WriteLine("[CONFIG] Single Key: {0}.{1}, Value: {2}", path, prefix, root[prefix]?.ToJsonString());
+ continue;
+ }
+
+ var nestedValues = group.Where(x => x.Key.Contains('_')).ToDictionary(kvItem => kvItem.Key[(prefix.Length + 1)..], kvItem => kvItem.Value);
+
+ if (nestedValues.All(x => int.TryParse(x.Key.Split('_')[0], out _)))
+ {
+ Console.WriteLine("[CONFIG] Array Key Detected: {0}.{1}", path, prefix);
+ var arr = new JsonArray();
+ if (nestedValues.All(x => x.Key.Contains('_')))
+ {
+ var objs = nestedValues.GroupBy(x => x.Key.Split('_', 2)[0]);
+ foreach (var objGroup in objs.OrderBy(x => int.Parse(x.Key)))
+ {
+ var i = objGroup.Key;
+ var objValues = objGroup.ToDictionary(kvItem => kvItem.Key[(i.Length + 1)..], kvItem => kvItem.Value);
+ var obj = objValues.ToNestedJsonObject($"{path}.{prefix}[{i}]");
+ arr.Add(obj);
+ Console.WriteLine($" - ${path}.{prefix}[{i}]: {obj.ToJsonString()}");
+ }
+ }
+ else
+ foreach (var (i, arrayItem) in nestedValues.OrderBy(x => int.Parse(x.Key)))
+ {
+ arr.Add(arrayItem == null ? null : JsonNode.Parse(arrayItem));
+ Console.WriteLine($" - {path}.{prefix}[{i}]: {arrayItem}");
+ }
+
+ root[prefix] = arr;
+ }
+ else
+ {
+ root[prefix] = nestedValues.ToNestedJsonObject($"{path}.{prefix}");
+ }
+ }
+
+ return root;
+ }
+ }
+
+ extension(JsonObject jo)
+ {
+ public Dictionary ToFlatKv(string path = "$")
+ {
+ var kv = new Dictionary();
+ var jso = new JsonSerializerOptions()
+ {
+ Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
+ };
+
+ foreach (var (key, value) in jo)
+ {
+ var currentPath = path == "$" ? key : $"{path}_{key}";
+
+ switch (value)
+ {
+ case JsonObject nestedObj:
+ var nestedKv = nestedObj.ToFlatKv(currentPath);
+ foreach (var (nestedKey, nestedValue) in nestedKv)
+ {
+ kv[nestedKey] = nestedValue;
+ }
+
+ break;
+ case JsonArray arr:
+ for (int i = 0; i < arr.Count; i++)
+ {
+ var item = arr[i];
+ var itemPath = $"{currentPath}_{i}";
+ switch (item)
+ {
+ case JsonObject arrObj:
+ var arrObjKv = arrObj.ToFlatKv(itemPath);
+ foreach (var (arrObjKey, arrObjValue) in arrObjKv)
+ {
+ kv[arrObjKey] = arrObjValue;
+ }
+
+ break;
+ default:
+ kv[itemPath] = item?.ToJsonString(jso);
+ break;
+ }
+ }
+
+ break;
+ default:
+ Console.WriteLine(value?.GetType());
+ kv[currentPath] = value?.ToJsonString(jso);
+ break;
+ }
+ }
+
+ return kv;
+ }
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/GeneralConfiguration.cs b/extra/admin-api/Models/Spacebar.Models.Config/GeneralConfiguration.cs
new file mode 100644
index 0000000..1e00675
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/GeneralConfiguration.cs
@@ -0,0 +1,35 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class GeneralConfiguration {
+ [JsonPropertyName("instanceName")]
+ public string InstanceName { get; set; } = "Spacebar Instance";
+
+ [JsonPropertyName("serverName")]
+ public string? ServerName { get; set; } = null;
+
+ [JsonPropertyName("instanceDescription")]
+ public string InstanceDescription { get; set; } = "This is a Spacebar instance made in the pre-release days";
+
+ [JsonPropertyName("frontPage")]
+ public string? FrontPage { get; set; } = null;
+
+ [JsonPropertyName("tosPage")]
+ public string? TosPage { get; set; } = null;
+
+ [JsonPropertyName("correspondenceEmail")]
+ public string? CorrespondenceEmail { get; set; } = null;
+
+ [JsonPropertyName("correspondenceUserID")]
+ public string? CorrespondenceUserID { get; set; } = null;
+
+ [JsonPropertyName("image")]
+ public string? Image { get; set; } = null;
+
+ [JsonPropertyName("instanceId")]
+ public string InstanceId { get; set; } = null!; // {get;set;}=Snowflake.generate();
+
+ [JsonPropertyName("autoCreateBotUsers")]
+ public bool AutoCreateBotUsers { get; set; } = false;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/LimitsConfiguration.cs b/extra/admin-api/Models/Spacebar.Models.Config/LimitsConfiguration.cs
new file mode 100644
index 0000000..56648bd
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/LimitsConfiguration.cs
@@ -0,0 +1,189 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class LimitsConfiguration {
+ [JsonPropertyName("user")]
+ public UserLimits User { get; set; } = new UserLimits();
+
+ [JsonPropertyName("guild")]
+ public GuildLimits Guild { get; set; } = new GuildLimits();
+
+ [JsonPropertyName("message")]
+ public MessageLimits Message { get; set; } = new MessageLimits();
+
+ [JsonPropertyName("channel")]
+ public ChannelLimits Channel { get; set; } = new ChannelLimits();
+
+ [JsonPropertyName("rate")]
+ public RateLimits Rate { get; set; } = new RateLimits();
+
+ [JsonPropertyName("absoluteRate")]
+ public GlobalRateLimits AbsoluteRate { get; set; } = new GlobalRateLimits();
+}
+
+public class GlobalRateLimits {
+ [JsonPropertyName("register")]
+ public GlobalRateLimit Register { get; set; } = new() {
+ Enabled = true,
+ Count = 25,
+ Window = 60 * 60 * 1000
+ };
+
+ [JsonPropertyName("sendMessage")]
+ public GlobalRateLimit SendMessage { get; set; } = new() {
+ Enabled = true,
+ Count = 200,
+ Window = 60 * 1000
+ };
+
+ public class GlobalRateLimit : RateLimits.RateLimitOptions {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = true;
+ }
+}
+
+public class RateLimits {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = true;
+
+ [JsonPropertyName("ip")]
+ public RateLimitOptions Ip { get; set; } = new RateLimitOptions() {
+ Count = 500,
+ Window = 5
+ };
+
+ [JsonPropertyName("global")]
+ public RateLimitOptions Global { get; set; } = new RateLimitOptions() {
+ Count = 250,
+ Window = 5
+ };
+
+ [JsonPropertyName("error")]
+ public RateLimitOptions Error { get; set; } = new RateLimitOptions() {
+ Count = 50,
+ Window = 5
+ };
+
+ [JsonPropertyName("routes")]
+ public RouteRateLimits Routes { get; set; } = new RouteRateLimits();
+
+ public class RouteRateLimits {
+ [JsonPropertyName("guild")]
+ public RateLimitOptions Guild { get; set; } = new RateLimitOptions() {
+ Count = 5,
+ Window = 5
+ };
+
+ [JsonPropertyName("webhook")]
+ public RateLimitOptions Webhook { get; set; } = new RateLimitOptions() {
+ Count = 10,
+ Window = 5
+ };
+
+ [JsonPropertyName("channel")]
+ public RateLimitOptions Channel { get; set; } = new RateLimitOptions() {
+ Count = 10,
+ Window = 5
+ };
+
+ [JsonPropertyName("auth")]
+ public AuthRateLimits Auth { get; set; } = new AuthRateLimits();
+
+ public class AuthRateLimits {
+ [JsonPropertyName("login")]
+ public RateLimitOptions Login { get; set; } = new RateLimitOptions() {
+ Count = 5,
+ Window = 60
+ };
+
+ [JsonPropertyName("register")]
+ public RateLimitOptions Register { get; set; } = new RateLimitOptions() {
+ Count = 2,
+ Window = 60 * 60 * 12
+ };
+ }
+ }
+
+ public class RateLimitOptions {
+ [JsonPropertyName("count")]
+ public int Count { get; set; }
+
+ [JsonPropertyName("window")]
+ public int Window { get; set; }
+
+ [JsonIgnore]
+ public TimeSpan WindowTimeSpan => TimeSpan.FromSeconds(Window);
+ }
+}
+
+public class ChannelLimits {
+ [JsonPropertyName("maxPins")]
+ public int MaxPins { get; set; } = 500;
+
+ [JsonPropertyName("maxTopic")]
+ public int MaxTopic { get; set; } = 1024;
+
+ [JsonPropertyName("maxWebhooks")]
+ public int MaxWebhooks { get; set; } = 100;
+}
+
+public class MessageLimits {
+ [JsonPropertyName("maxCharacters")]
+ public int MaxCharacters { get; set; } = 1048576;
+
+ [JsonPropertyName("maxTTSCharacters")]
+ public int MaxTTSCharacters { get; set; } = 160;
+
+ [JsonPropertyName("maxReactions")]
+ public int MaxReactions { get; set; } = 2048;
+
+ [JsonPropertyName("maxAttachmentSize")]
+ public int MaxAttachmentSize { get; set; } = 1024 * 1024 * 1024;
+
+ [JsonPropertyName("maxBulkDelete")]
+ public int MaxBulkDelete { get; set; } = 1000;
+
+ [JsonPropertyName("maxEmbedDownloadSize")]
+ public int MaxEmbedDownloadSize { get; set; } = 1024 * 1024 * 1024;
+
+ [JsonPropertyName("maxPreloadCount")]
+ public int MaxPreloadCount { get; set; } = 100;
+}
+
+public class GuildLimits {
+ [JsonPropertyName("maxRoles")]
+ public int MaxRoles { get; set; } = 1000;
+
+ [JsonPropertyName("maxEmojis")]
+ public int MaxEmojis { get; set; } = 2000;
+
+ [JsonPropertyName("maxStickers")]
+ public int MaxStickers { get; set; } = 500;
+
+ [JsonPropertyName("maxMembers")]
+ public int MaxMembers { get; set; } = 25000000;
+
+ [JsonPropertyName("maxChannels")]
+ public int MaxChannels { get; set; } = 65535;
+
+ [JsonPropertyName("maxBulkBanUsers")]
+ public int MaxBulkBanUsers { get; set; } = 200;
+
+ [JsonPropertyName("maxChannelsInCategory")]
+ public int MaxChannelsInCategory { get; set; } = 65536;
+}
+
+public class UserLimits {
+ [JsonPropertyName("maxGuilds")]
+ public int MaxGuilds { get; set; } = 1048576;
+
+ [JsonPropertyName("maxUsername")]
+ public int MaxUsername { get; set; } = 32;
+
+ [JsonPropertyName("maxFriends")]
+ public int MaxFriends { get; set; } = 5000;
+
+ [JsonPropertyName("maxBio")]
+ public int MaxBio { get; set; } = 190;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/SecurityConfiguration.cs b/extra/admin-api/Models/Spacebar.Models.Config/SecurityConfiguration.cs
new file mode 100644
index 0000000..e1592c8
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/SecurityConfiguration.cs
@@ -0,0 +1,83 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class SecurityConfiguration {
+ [JsonPropertyName("captcha")]
+ public CaptchaConfiguration Captcha { get; set; } = new();
+
+ [JsonPropertyName("twoFactor")]
+ public TwoFactorConfiguration TwoFactor { get; set; } = new();
+
+ [JsonPropertyName("autoUpdate")]
+ public bool AutoUpdate { get; set; } = true;
+
+ [JsonPropertyName("requestSignature")] public string RequestSignature; // {get;set;}=crypto.randomBytes(32).toString("base64");
+
+ [JsonPropertyName("jwtSecret")]
+ public string? JwtSecret { get; set; } = null;
+
+ [JsonPropertyName("forwardedFor")]
+ public string? ForwardedFor { get; set; } = null;
+
+ [JsonPropertyName("trustedProxies")]
+ public string TrustedProxies { get; set; } = null;
+
+ [JsonPropertyName("abuseIpDbApiKey")]
+ public string? AbuseIpDbApiKey { get; set; } = null;
+
+ [JsonPropertyName("abuseipdbBlacklistRatelimit")]
+ public int AbuseipdbBlacklistRatelimit { get; set; } = 5;
+
+ [JsonPropertyName("abuseipdbConfidenceScoreTreshold")]
+ public int AbuseipdbConfidenceScoreTreshold { get; set; } = 50;
+
+ [JsonPropertyName("ipdataApiKey")]
+ public string? IpdataApiKey { get; set; } = null;
+
+ [JsonPropertyName("mfaBackupCodeCount")]
+ public int MfaBackupCodeCount { get; set; } = 10;
+
+ [JsonPropertyName("statsWorldReadable")]
+ public bool StatsWorldReadable { get; set; } = true;
+
+ [JsonPropertyName("defaultRegistrationTokenExpiration")]
+ public int DefaultRegistrationTokenExpiration { get; set; } = 1000 * 60 * 60 * 24 * 7;
+
+ [JsonPropertyName("cdnSignUrls")]
+ public bool CdnSignUrls { get; set; } = false;
+
+ [JsonPropertyName("cdnSignatureKey")]
+ public string CdnSignatureKey { get; set; } = null!; // crypto.randomBytes(32).toString("base64");
+
+ [JsonPropertyName("cdnSignatureDuration")]
+ public string CdnSignatureDuration { get; set; } = "24h";
+
+ [JsonPropertyName("cdnSignatureIncludeIp")]
+ public bool CdnSignatureIncludeIp { get; set; } = true;
+
+ [JsonPropertyName("cdnSignatureIncludeUserAgent")]
+ public bool CdnSignatureIncludeUserAgent { get; set; } = true;
+}
+
+public class CaptchaConfiguration {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = false;
+
+ ///
+ /// One of: null, recaptcha, hcaptcha
+ ///
+ [JsonPropertyName("service")]
+ public string Service { get; set; } = "none";
+
+ [JsonPropertyName("sitekey")]
+ public string? SiteKey { get; set; } = null;
+
+ [JsonPropertyName("secret")]
+ public string? Secret { get; set; } = null;
+}
+
+public class TwoFactorConfiguration {
+ [JsonPropertyName("generateBackupCodes")]
+ public bool GenerateBackupCodes { get; set; } = true;
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/ServerConfiguration.cs b/extra/admin-api/Models/Spacebar.Models.Config/ServerConfiguration.cs
new file mode 100644
index 0000000..2ea107b
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/ServerConfiguration.cs
@@ -0,0 +1,371 @@
+using System.Text.Json.Serialization;
+
+namespace Spacebar.ConfigModel;
+
+public class ServerConfiguration {
+ [JsonPropertyName("admin")]
+ public EndpointConfiguration Admin { get; set; } = new();
+
+ [JsonPropertyName("gateway")]
+ public EndpointConfiguration Gateway { get; set; } = new();
+
+ [JsonPropertyName("cdn")]
+ public CdnConfiguration Cdn { get; set; } = new();
+
+ [JsonPropertyName("api")]
+ public ApiConfiguration Api { get; set; } = new();
+
+ [JsonPropertyName("general")]
+ public GeneralConfiguration General { get; set; } = new();
+
+ [JsonPropertyName("limits")]
+ public LimitsConfiguration Limits { get; set; } = new();
+
+ [JsonPropertyName("security")]
+ public SecurityConfiguration Security { get; set; } = new();
+
+ [JsonPropertyName("login")]
+ public LoginConfiguration Login { get; set; } = new();
+
+ [JsonPropertyName("register")]
+ public RegisterConfiguration Register { get; set; } = new RegisterConfiguration();
+
+ [JsonPropertyName("regions")]
+ public RegionConfiguration Regions { get; set; } = new();
+
+ [JsonPropertyName("guild")]
+ public GuildConfiguration Guild { get; set; } = new();
+
+ [JsonPropertyName("gif")]
+ public GifConfiguration Gif { get; set; } = new GifConfiguration();
+
+ [JsonPropertyName("rabbitmq")]
+ public RabbitMQConfiguration Rabbitmq { get; set; } = new RabbitMQConfiguration();
+
+ [JsonPropertyName("templates")]
+ public TemplateConfiguration Templates { get; set; } = new TemplateConfiguration();
+
+ [JsonPropertyName("defaults")]
+ public DefaultsConfiguration Defaults { get; set; } = new();
+
+ [JsonPropertyName("external")]
+ public ExternalTokensConfiguration External { get; set; } = new();
+
+ // TODO: lazy
+ // [JsonPropertyName("email")]
+ // public EmailConfiguration Email { get; set; } = new EmailConfiguration();
+
+ [JsonPropertyName("passwordReset")]
+ public PasswordResetConfiguration PasswordReset { get; set; } = new PasswordResetConfiguration();
+
+ [JsonPropertyName("user")]
+ public UserConfiguration User { get; set; } = new UserConfiguration();
+}
+
+public class RegisterConfiguration {
+ [JsonPropertyName("email")]
+ public RegistrationEmailConfiguration Email { get; set; } = new RegistrationEmailConfiguration();
+
+ [JsonPropertyName("dateOfBirth")]
+ public DateOfBirthConfiguration DateOfBirth { get; set; } = new DateOfBirthConfiguration();
+
+ [JsonPropertyName("password")]
+ public PasswordConfiguration Password { get; set; } = new PasswordConfiguration();
+
+ [JsonPropertyName("disabled")]
+ public bool Disabled { get; set; } = false;
+
+ [JsonPropertyName("requireCaptcha")]
+ public bool RequireCaptcha { get; set; } = true;
+
+ [JsonPropertyName("requireInvite")]
+ public bool RequireInvite { get; set; } = false;
+
+ [JsonPropertyName("guestsRequireInvite")]
+ public bool GuestsRequireInvite { get; set; } = true;
+
+ [JsonPropertyName("allowNewRegistration")]
+ public bool AllowNewRegistration { get; set; } = true;
+
+ [JsonPropertyName("allowMultipleAccounts")]
+ public bool AllowMultipleAccounts { get; set; } = true;
+
+ [JsonPropertyName("blockIpDataCoThreatTypes")]
+ public List BlockIpDataCoThreatTypes { get; set; } = [
+ "tor", "icloud_relay", "proxy", "datacenter", "anonymous", "known_attacker", "known_abuser", "threat"
+ ]; // matching ipdata's threat.is_* fields as of 2025/11/30, minus bogon
+
+ [JsonPropertyName("blockAsnTypes")]
+ public List BlockAsnTypes { get; set; } = [""];
+
+ [JsonPropertyName("blockAsns")]
+ public List BlockAsns { get; set; } = [""];
+
+ [JsonPropertyName("blockAbuseIpDbAboveScore")]
+ public int BlockAbuseIpDbAboveScore { get; set; } = 75; // 0 to disable
+
+ [JsonPropertyName("incrementingDiscriminators")]
+ public bool IncrementingDiscriminators { get; set; } = false; // random otherwise
+
+ [JsonPropertyName("defaultRights")]
+ public string DefaultRights { get; set; } = "875069521787904"; // See `npm run generate:rights`
+
+ [JsonPropertyName("checkIp")]
+ public bool CheckIp { get; set; } = true;
+}
+
+public class PasswordConfiguration {
+ [JsonPropertyName("required")]
+ public bool Required { get; set; } = true;
+
+ [JsonPropertyName("minLength")]
+ public int MinLength { get; set; } = 8;
+
+ [JsonPropertyName("minNumbers")]
+ public int MinNumbers { get; set; } = 2;
+
+ [JsonPropertyName("minUpperCase")]
+ public int MinUpperCase { get; set; } = 2;
+
+ [JsonPropertyName("minSymbols")]
+ public int MinSymbols { get; set; } = 0;
+}
+
+public class DateOfBirthConfiguration {
+ [JsonPropertyName("required")]
+ public bool Required { get; set; } = true;
+
+ [JsonPropertyName("minimum")]
+ public int Minimum { get; set; } = 13;
+}
+
+public class RegistrationEmailConfiguration {
+ [JsonPropertyName("required")]
+ public bool Required { get; set; } = false;
+
+ [JsonPropertyName("allowlist")]
+ public bool Allowlist { get; set; } = false;
+
+ [JsonPropertyName("blocklist")]
+ public bool Blocklist { get; set; } = false;
+
+ [JsonPropertyName("domains")]
+ public List Domains { get; set; } = [];
+}
+
+public class TemplateConfiguration {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = true;
+
+ [JsonPropertyName("allowTemplateCreation")]
+ public bool AllowTemplateCreation { get; set; } = true;
+
+ [JsonPropertyName("allowDiscordTemplates")]
+ public bool AllowDiscordTemplates { get; set; } = true;
+
+ [JsonPropertyName("allowRaws")]
+ public bool AllowRaws { get; set; } = true;
+}
+
+public class PasswordResetConfiguration {
+ [JsonPropertyName("requireCaptcha")]
+ public bool RequireCaptcha { get; set; } = false;
+}
+
+public class UserConfiguration {
+ [JsonPropertyName("blockedContains")]
+ public List BlockedContains { get; set; } = [];
+
+ [JsonPropertyName("blockedEquals")]
+ public List BlockedEquals { get; set; } = [];
+}
+
+public class RabbitMQConfiguration {
+ [JsonPropertyName("host")]
+ public string? Host { get; set; } = null;
+}
+
+public class GifConfiguration {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = true;
+
+ [JsonPropertyName("provider")]
+ public string Provider { get; set; } = "tenor";
+
+ [JsonPropertyName("apiKey")]
+ public string? ApiKey { get; set; } = "LIVDSRZULELA";
+}
+
+public class EndpointConfiguration {
+ [JsonPropertyName("endpointPrivate")]
+ public string? EndpointPrivate { get; set; }
+
+ [JsonPropertyName("endpointPublic")]
+ public string? EndpointPublic { get; set; }
+}
+
+public class ApiConfiguration : EndpointConfiguration {
+ [JsonPropertyName("activeVersions")]
+ public List ActiveVersions { get; set; } = null!;
+
+ [JsonPropertyName("defaultVersion")]
+ public string DefaultVersion { get; set; } = null!;
+}
+
+public class CdnConfiguration : EndpointConfiguration {
+ [JsonPropertyName("resizeHeightMax")]
+ public int ResizeHeightMax { get; set; } = 1000;
+
+ [JsonPropertyName("resizeWidthMax")]
+ public int ResizeWidthMax { get; set; } = 1000;
+
+ [JsonPropertyName("imagorServerUrl")]
+ public string? ImagorServerUrl { get; set; } = null;
+
+ [JsonPropertyName("proxyCacheHeaderSeconds")]
+ public int ProxyCacheHeaderSeconds { get; set; } = 60 * 60 * 24;
+
+ [JsonPropertyName("maxAttachmentSize")]
+ public int MaxAttachmentSize { get; set; } = 25 * 1024 * 1024; // 25 MB
+
+ // limits: CdnLimitsConfiguration {get;set;}=new CdnLimitsConfiguration();
+}
+
+public class CdnLimitsConfiguration {
+ [JsonPropertyName("icon")]
+ public CdnImageLimitsConfiguration Icon { get; set; } = new();
+
+ [JsonPropertyName("roleIcon")]
+ public CdnImageLimitsConfiguration RoleIcon { get; set; } = new();
+
+ [JsonPropertyName("emoji")]
+ public CdnImageLimitsConfiguration Emoji { get; set; } = new();
+
+ [JsonPropertyName("sticker")]
+ public CdnImageLimitsConfiguration Sticker { get; set; } = new();
+
+ [JsonPropertyName("banner")]
+ public CdnImageLimitsConfiguration Banner { get; set; } = new();
+
+ [JsonPropertyName("splash")]
+ public CdnImageLimitsConfiguration Splash { get; set; } = new();
+
+ [JsonPropertyName("avatar")]
+ public CdnImageLimitsConfiguration Avatar { get; set; } = new();
+
+ [JsonPropertyName("discoverySplash")]
+ public CdnImageLimitsConfiguration DiscoverySplash { get; set; } = new();
+
+ [JsonPropertyName("appIcon")]
+ public CdnImageLimitsConfiguration AppIcon { get; set; } = new();
+
+ [JsonPropertyName("discoverSplash")]
+ public CdnImageLimitsConfiguration DiscoverSplash { get; set; } = new(); //what even is this?
+
+ [JsonPropertyName("teamIcon")]
+ public CdnImageLimitsConfiguration TeamIcon { get; set; } = new();
+
+ [JsonPropertyName("channelIcon")]
+ public CdnImageLimitsConfiguration ChannelIcon { get; set; } = new(); // is this even used?
+
+ [JsonPropertyName("guildAvatar")]
+ public CdnImageLimitsConfiguration GuildAvatar { get; set; } = new();
+}
+
+public class CdnImageLimitsConfiguration {
+ [JsonPropertyName("maxHeight")]
+ public int MaxHeight { get; set; } = 8192;
+
+ [JsonPropertyName("maxWidth")]
+ public int MaxWidth { get; set; } = 8192;
+
+ [JsonPropertyName("maxSize")]
+ public int MaxSize { get; set; } = 10 * 1024 * 1024; // 10 MB
+
+ // "always" | "never" | "premium"
+ [JsonPropertyName("allowAnimated")]
+ public string AllowAnimated { get; set; } = "always";
+}
+
+public class LoginConfiguration {
+ [JsonPropertyName("requireCaptcha")]
+ public bool RequireCaptcha { get; set; } = false;
+
+ [JsonPropertyName("requireVerification")]
+ public bool RequireVerification { get; set; } = false;
+}
+
+public class RegionConfiguration {
+ [JsonPropertyName("default")]
+ public string Default { get; set; } = "spacebar-central";
+
+ [JsonPropertyName("useDefaultAsOptimal")]
+ public bool UseDefaultAsOptimal { get; set; } = true;
+
+ [JsonPropertyName("available")]
+ public List Available { get; set; } = [];
+
+ public class Region {
+ [JsonPropertyName("id")]
+ public string Id { get; set; } = null!;
+
+ [JsonPropertyName("name")]
+ public string Name { get; set; } = null!;
+
+ [JsonPropertyName("endpoint")]
+ public string Endpoint { get; set; } = null!;
+
+ [JsonPropertyName("vip")]
+ public bool Vip { get; set; } = false;
+
+ [JsonPropertyName("custom")]
+ public bool Custom { get; set; } = false;
+
+ [JsonPropertyName("deprecated")]
+ public bool Deprecated { get; set; } = false;
+ }
+}
+
+public class ExternalTokensConfiguration {
+ [JsonPropertyName("twitter")]
+ public string? Twitter { get; set; } = null;
+}
+
+public class GuildConfiguration {
+ [JsonPropertyName("defaultFeatures")]
+ public List DefaultFeatures { get; set; } = [];
+
+ [JsonPropertyName("autoJoin")]
+ public GuildAutoJoinConfiguration AutoJoin { get; set; } = new();
+
+ [JsonPropertyName("discovery")]
+ public GuildDiscoveryConfiguration Discovery { get; set; } = new();
+
+ public class GuildDiscoveryConfiguration {
+ [JsonPropertyName("showAllGuilds")]
+ public bool ShowAllGuilds { get; set; } = false;
+
+ [JsonPropertyName("useRecommendation")]
+ public bool UseRecommendation { get; set; } = false;
+
+ [JsonPropertyName("offset")]
+ public int Offset { get; set; } = 0;
+
+ [JsonPropertyName("limit")]
+ public int Limit { get; set; } = 24;
+ }
+
+ public class GuildAutoJoinConfiguration {
+ [JsonPropertyName("enabled")]
+ public bool Enabled { get; set; } = false;
+
+ [JsonPropertyName("guilds")]
+ public List Guilds { get; set; } = [];
+
+ [JsonPropertyName("canLeave")]
+ public bool CanLeave { get; set; } = true;
+
+ [JsonPropertyName("bots")]
+ public bool Bots { get; set; } = false;
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/Models/Spacebar.Models.Config/Spacebar.Models.Config.csproj b/extra/admin-api/Models/Spacebar.Models.Config/Spacebar.Models.Config.csproj
new file mode 100644
index 0000000..237d661
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Config/Spacebar.Models.Config.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs b/extra/admin-api/Models/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs
new file mode 100644
index 0000000..716079d
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Contexts/SpacebarDbContext.cs
@@ -0,0 +1,699 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+using Spacebar.Models.Db.Models;
+using Stream = Spacebar.Models.Db.Models.Stream;
+
+namespace Spacebar.Models.Db.Contexts;
+
+public partial class SpacebarDbContext : DbContext
+{
+ public SpacebarDbContext(DbContextOptions options)
+ : base(options)
+ {
+ }
+
+ public virtual DbSet Applications { get; set; }
+
+ public virtual DbSet ApplicationCommands { get; set; }
+
+ public virtual DbSet Attachments { get; set; }
+
+ public virtual DbSet AuditLogs { get; set; }
+
+ public virtual DbSet AutomodRules { get; set; }
+
+ public virtual DbSet BackupCodes { get; set; }
+
+ public virtual DbSet Badges { get; set; }
+
+ public virtual DbSet Bans { get; set; }
+
+ public virtual DbSet Categories { get; set; }
+
+ public virtual DbSet Channels { get; set; }
+
+ public virtual DbSet ClientReleases { get; set; }
+
+ public virtual DbSet CloudAttachments { get; set; }
+
+ public virtual DbSet Configs { get; set; }
+
+ public virtual DbSet ConnectedAccounts { get; set; }
+
+ public virtual DbSet ConnectionConfigs { get; set; }
+
+ public virtual DbSet EmbedCaches { get; set; }
+
+ public virtual DbSet Emojis { get; set; }
+
+ public virtual DbSet Guilds { get; set; }
+
+ public virtual DbSet InstanceBans { get; set; }
+
+ public virtual DbSet Invites { get; set; }
+
+ public virtual DbSet Members { get; set; }
+
+ public virtual DbSet Messages { get; set; }
+
+ public virtual DbSet Migrations { get; set; }
+
+ public virtual DbSet Notes { get; set; }
+
+ public virtual DbSet RateLimits { get; set; }
+
+ public virtual DbSet ReadStates { get; set; }
+
+ public virtual DbSet Recipients { get; set; }
+
+ public virtual DbSet Relationships { get; set; }
+
+ public virtual DbSet Roles { get; set; }
+
+ public virtual DbSet SecurityKeys { get; set; }
+
+ public virtual DbSet SecuritySettings { get; set; }
+
+ public virtual DbSet Sessions { get; set; }
+
+ public virtual DbSet Stickers { get; set; }
+
+ public virtual DbSet StickerPacks { get; set; }
+
+ public virtual DbSet Streams { get; set; }
+
+ public virtual DbSet StreamSessions { get; set; }
+
+ public virtual DbSet Teams { get; set; }
+
+ public virtual DbSet TeamMembers { get; set; }
+
+ public virtual DbSet Templates { get; set; }
+
+ public virtual DbSet Users { get; set; }
+
+ public virtual DbSet UserSettings { get; set; }
+
+ public virtual DbSet UserSettingsProtos { get; set; }
+
+ public virtual DbSet ValidRegistrationTokens { get; set; }
+
+ public virtual DbSet VoiceStates { get; set; }
+
+ public virtual DbSet Webhooks { get; set; }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_938c0a27255637bde919591888f");
+
+ entity.HasOne(d => d.BotUser).WithOne(p => p.ApplicationBotUser)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_2ce5a55796fe4c2f77ece57a647");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Applications).HasConstraintName("FK_e5bf78cdbbe9ba91062d74c5aba");
+
+ entity.HasOne(d => d.Owner).WithMany(p => p.ApplicationOwners)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_e57508958bf92b9d9d25231b5e8");
+
+ entity.HasOne(d => d.Team).WithMany(p => p.Applications)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_a36ed02953077f408d0f3ebc424");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_0f73c2f025989c407947e1f75fe");
+
+ entity.Property(e => e.DmPermission).HasDefaultValue(true);
+ entity.Property(e => e.Options).HasDefaultValueSql("'[]'::text");
+ entity.Property(e => e.Type).HasDefaultValue(1);
+ entity.Property(e => e.Version).HasDefaultValueSql("'0'::character varying");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_5e1f050bcff31e3084a1d662412");
+
+ entity.HasOne(d => d.Message).WithMany(p => p.Attachments)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_623e10eec51ada466c5038979e3");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_1bb179d048bbc581caa3b013439");
+
+ entity.HasOne(d => d.Target).WithMany(p => p.AuditLogTargets).HasConstraintName("FK_3cd01cd3ae7aab010310d96ac8e");
+
+ entity.HasOne(d => d.User).WithMany(p => p.AuditLogUsers).HasConstraintName("FK_bd2726fd31b35443f2245b93ba0");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_99789ae863507f5aed9e58d7866");
+
+ entity.HasOne(d => d.Creator).WithMany(p => p.AutomodRules)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_12d3d60b961393d310429c062b7");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_34ab957382dbc57e8fb53f1638f");
+
+ entity.HasOne(d => d.User).WithMany(p => p.BackupCodes)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_70066ea80d2f4b871beda32633b");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_8a651318b8de577e8e217676466");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_a4d6f261bffa4615c62d756566a");
+
+ entity.HasOne(d => d.Executor).WithMany(p => p.BanExecutors).HasConstraintName("FK_07ad88c86d1f290d46748410d58");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Bans)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_9d3ab7dd180ebdd245cdb66ecad");
+
+ entity.HasOne(d => d.User).WithMany(p => p.BanUsers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_5999e8e449f80a236ff72023559");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_24dbc6126a28ff948da33e97d3b");
+
+ entity.Property(e => e.Id).ValueGeneratedNever();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_bc603823f3f741359c2339389f9");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Channels)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_c253dafe5f3a03ec00cd8fb4581");
+
+ entity.HasOne(d => d.Owner).WithMany(p => p.Channels).HasConstraintName("FK_3873ed438575cce703ecff4fc7b");
+
+ entity.HasOne(d => d.Parent).WithMany(p => p.InverseParent).HasConstraintName("FK_3274522d14af40540b1a883fc80");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_4c4ea258342d2d6ba1be0a71a43");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_5794827a3ee7c9318612dcb70c8");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.CloudAttachments)
+ .OnDelete(DeleteBehavior.SetNull)
+ .HasConstraintName("FK_998d5fe91008ba5b09e1322104c");
+
+ entity.HasOne(d => d.User).WithMany(p => p.CloudAttachments)
+ .OnDelete(DeleteBehavior.SetNull)
+ .HasConstraintName("FK_8bf8cc8767e48cb482ff644fce6");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Key).HasName("PK_26489c99ddbb4c91631ef5cc791");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_70416f1da0be645bb31da01c774");
+
+ entity.HasOne(d => d.User).WithMany(p => p.ConnectedAccounts)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_f47244225a6a1eac04a3463dd90");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Key).HasName("PK_bc0554f736ad71dde346549488a");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_0abb7581d4efc5a8b1361389c5e");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_9adb96a675f555c6169bad7ba62");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Emojis).HasConstraintName("FK_4b988e0db89d94cebcf07f598cc");
+
+ entity.HasOne(d => d.User).WithMany(p => p.Emojis).HasConstraintName("FK_fa7ddd5f9a214e28ce596548421");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_e7e7f2a51bd6d96a9ac2aa560f9");
+
+ entity.HasOne(d => d.AfkChannel).WithMany(p => p.GuildAfkChannels).HasConstraintName("FK_f591a66b8019d87b0fe6c12dad6");
+
+ entity.HasOne(d => d.Owner).WithMany(p => p.Guilds).HasConstraintName("FK_fc1a451727e3643ca572a3bb394");
+
+ entity.HasOne(d => d.PublicUpdatesChannel).WithMany(p => p.GuildPublicUpdatesChannels).HasConstraintName("FK_8d450b016dc8bec35f36729e4b0");
+
+ entity.HasOne(d => d.RulesChannel).WithMany(p => p.GuildRulesChannels).HasConstraintName("FK_95828668aa333460582e0ca6396");
+
+ entity.HasOne(d => d.SystemChannel).WithMany(p => p.GuildSystemChannels).HasConstraintName("FK_cfc3d3ad260f8121c95b31a1fce");
+
+ entity.HasOne(d => d.Template).WithMany(p => p.Guilds).HasConstraintName("FK_e2a2f873a64a5cf62526de42325");
+
+ entity.HasOne(d => d.WidgetChannel).WithMany(p => p.GuildWidgetChannels).HasConstraintName("FK_9d1d665379eefde7876a17afa99");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_3aa6e80a6d325601054892b1340");
+
+ entity.Property(e => e.CreatedAt).HasDefaultValueSql("now()");
+
+ entity.HasOne(d => d.OriginInstanceBan).WithOne(p => p.InverseOriginInstanceBan)
+ .OnDelete(DeleteBehavior.SetNull)
+ .HasConstraintName("FK_0b02d18d0d830f160c921192a30");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Code).HasName("PK_33fd8a248db1cd832baa8aa25bf");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.Invites)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_6a15b051fe5050aa00a4b9ff0f6");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Invites)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_3f4939aa1461e8af57fea3fb05d");
+
+ entity.HasOne(d => d.Inviter).WithMany(p => p.InviteInviters)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_15c35422032e0b22b4ada95f48f");
+
+ entity.HasOne(d => d.TargetUser).WithMany(p => p.InviteTargetUsers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_11a0d394f8fc649c19ce5f16b59");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Index).HasName("PK_b4a6b8c2478e5df990909c6cf6a");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Members).HasConstraintName("FK_16aceddd5b89825b8ed6029ad1c");
+
+ entity.HasOne(d => d.IdNavigation).WithMany(p => p.Members).HasConstraintName("FK_28b53062261b996d9c99fa12404");
+
+ entity.HasMany(d => d.Roles).WithMany(p => p.Indices)
+ .UsingEntity>(
+ "MemberRole",
+ r => r.HasOne().WithMany()
+ .HasForeignKey("RoleId")
+ .HasConstraintName("FK_e9080e7a7997a0170026d5139c1"),
+ l => l.HasOne().WithMany()
+ .HasForeignKey("Index")
+ .HasConstraintName("FK_5d7ddc8a5f9c167f548625e772e"),
+ j =>
+ {
+ j.HasKey("Index", "RoleId").HasName("PK_951c1d72a0fd1da8760b4a1fd66");
+ j.ToTable("member_roles");
+ j.HasIndex(new[] { "Index" }, "IDX_5d7ddc8a5f9c167f548625e772");
+ j.HasIndex(new[] { "RoleId" }, "IDX_e9080e7a7997a0170026d5139c");
+ j.IndexerProperty("Index").HasColumnName("index");
+ j.IndexerProperty("RoleId")
+ .HasColumnType("character varying")
+ .HasColumnName("role_id");
+ });
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_18325f38ae6de43878487eff986");
+
+ entity.Property(e => e.MessageSnapshots).HasDefaultValueSql("'[]'::text");
+ entity.Property(e => e.Timestamp).HasDefaultValueSql("now()");
+
+ entity.HasOne(d => d.Application).WithMany(p => p.Messages).HasConstraintName("FK_5d3ec1cb962de6488637fd779d6");
+
+ entity.HasOne(d => d.Author).WithMany(p => p.MessageAuthors)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_05535bc695e9f7ee104616459d3");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.Messages)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_86b9109b155eb70c0a2ca3b4b6d");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Messages)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_b193588441b085352a4c0109423");
+
+ entity.HasOne(d => d.Member).WithMany(p => p.MessageMembers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_b0525304f2262b7014245351c76");
+
+ entity.HasOne(d => d.MessageReferenceNavigation).WithMany(p => p.InverseMessageReferenceNavigation)
+ .OnDelete(DeleteBehavior.SetNull)
+ .HasConstraintName("FK_61a92bb65b302a76d9c1fcd3174");
+
+ entity.HasOne(d => d.Webhook).WithMany(p => p.Messages).HasConstraintName("FK_f83c04bcf1df4e5c0e7a52ed348");
+
+ entity.HasMany(d => d.Channels).WithMany(p => p.MessagesNavigation)
+ .UsingEntity>(
+ "MessageChannelMention",
+ r => r.HasOne().WithMany()
+ .HasForeignKey("ChannelsId")
+ .HasConstraintName("FK_bdb8c09e1464cabf62105bf4b9d"),
+ l => l.HasOne().WithMany()
+ .HasForeignKey("MessagesId")
+ .HasConstraintName("FK_2a27102ecd1d81b4582a4360921"),
+ j =>
+ {
+ j.HasKey("MessagesId", "ChannelsId").HasName("PK_85cb45351497cd9d06a79ced65e");
+ j.ToTable("message_channel_mentions");
+ j.HasIndex(new[] { "MessagesId" }, "IDX_2a27102ecd1d81b4582a436092");
+ j.HasIndex(new[] { "ChannelsId" }, "IDX_bdb8c09e1464cabf62105bf4b9");
+ j.IndexerProperty("MessagesId")
+ .HasColumnType("character varying")
+ .HasColumnName("messagesId");
+ j.IndexerProperty("ChannelsId")
+ .HasColumnType("character varying")
+ .HasColumnName("channelsId");
+ });
+
+ entity.HasMany(d => d.Roles).WithMany(p => p.Messages)
+ .UsingEntity>(
+ "MessageRoleMention",
+ r => r.HasOne().WithMany()
+ .HasForeignKey("RolesId")
+ .HasConstraintName("FK_29d63eb1a458200851bc37d074b"),
+ l => l.HasOne().WithMany()
+ .HasForeignKey("MessagesId")
+ .HasConstraintName("FK_a8242cf535337a490b0feaea0b4"),
+ j =>
+ {
+ j.HasKey("MessagesId", "RolesId").HasName("PK_74dba92cc300452a6e14b83ed44");
+ j.ToTable("message_role_mentions");
+ j.HasIndex(new[] { "RolesId" }, "IDX_29d63eb1a458200851bc37d074");
+ j.HasIndex(new[] { "MessagesId" }, "IDX_a8242cf535337a490b0feaea0b");
+ j.IndexerProperty("MessagesId")
+ .HasColumnType("character varying")
+ .HasColumnName("messagesId");
+ j.IndexerProperty("RolesId")
+ .HasColumnType("character varying")
+ .HasColumnName("rolesId");
+ });
+
+ entity.HasMany(d => d.Stickers).WithMany(p => p.Messages)
+ .UsingEntity>(
+ "MessageSticker",
+ r => r.HasOne().WithMany()
+ .HasForeignKey("StickersId")
+ .HasConstraintName("FK_e22a70819d07659c7a71c112a1f"),
+ l => l.HasOne().WithMany()
+ .HasForeignKey("MessagesId")
+ .HasConstraintName("FK_40bb6f23e7cc133292e92829d28"),
+ j =>
+ {
+ j.HasKey("MessagesId", "StickersId").HasName("PK_ed820c4093d0b8cd1d2bcf66087");
+ j.ToTable("message_stickers");
+ j.HasIndex(new[] { "MessagesId" }, "IDX_40bb6f23e7cc133292e92829d2");
+ j.HasIndex(new[] { "StickersId" }, "IDX_e22a70819d07659c7a71c112a1");
+ j.IndexerProperty("MessagesId")
+ .HasColumnType("character varying")
+ .HasColumnName("messagesId");
+ j.IndexerProperty("StickersId")
+ .HasColumnType("character varying")
+ .HasColumnName("stickersId");
+ });
+
+ entity.HasMany(d => d.Users).WithMany(p => p.Messages)
+ .UsingEntity>(
+ "MessageUserMention",
+ r => r.HasOne().WithMany()
+ .HasForeignKey("UsersId")
+ .HasConstraintName("FK_b831eb18ceebd28976239b1e2f8"),
+ l => l.HasOne().WithMany()
+ .HasForeignKey("MessagesId")
+ .HasConstraintName("FK_a343387fc560ef378760681c236"),
+ j =>
+ {
+ j.HasKey("MessagesId", "UsersId").HasName("PK_9b9b6e245ad47a48dbd7605d4fb");
+ j.ToTable("message_user_mentions");
+ j.HasIndex(new[] { "MessagesId" }, "IDX_a343387fc560ef378760681c23");
+ j.HasIndex(new[] { "UsersId" }, "IDX_b831eb18ceebd28976239b1e2f");
+ j.IndexerProperty("MessagesId")
+ .HasColumnType("character varying")
+ .HasColumnName("messagesId");
+ j.IndexerProperty("UsersId")
+ .HasColumnType("character varying")
+ .HasColumnName("usersId");
+ });
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_8c82d7f526340ab734260ea46be");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_af6206538ea96c4e77e9f400c3d");
+
+ entity.HasOne(d => d.Owner).WithMany(p => p.NoteOwners)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_f9e103f8ae67cb1787063597925");
+
+ entity.HasOne(d => d.Target).WithMany(p => p.NoteTargets)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_23e08e5b4481711d573e1abecdc");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_3b4449f1f5fc167d921ee619f65");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_e6956a804978f01b713b1ed58e2");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.ReadStates).HasConstraintName("FK_40da2fca4e0eaf7a23b5bfc5d34");
+
+ entity.HasOne(d => d.User).WithMany(p => p.ReadStates).HasConstraintName("FK_195f92e4dd1254a4e348c043763");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_de8fc5a9c364568f294798fe1e9");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.Recipients).HasConstraintName("FK_2f18ee1ba667f233ae86c0ea60e");
+
+ entity.HasOne(d => d.User).WithMany(p => p.Recipients).HasConstraintName("FK_6157e8b6ba4e6e3089616481fe2");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_ba20e2f5cf487408e08e4dcecaf");
+
+ entity.HasOne(d => d.From).WithMany(p => p.RelationshipFroms).HasConstraintName("FK_9af4194bab1250b1c584ae4f1d7");
+
+ entity.HasOne(d => d.To).WithMany(p => p.RelationshipTos).HasConstraintName("FK_9c7f6b98a9843b76dce1b0c878b");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_c1433d71a4838793a49dcad46ab");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Roles).HasConstraintName("FK_c32c1ab1c4dc7dcb0278c4b1b8b");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_6e95cdd91779e7cca06d1fff89c");
+
+ entity.HasOne(d => d.User).WithMany(p => p.SecurityKeys)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_24c97d0771cafedce6d7163eaad");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_4aec436cf81177ae97a1bcec3c7");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.SessionId).HasName("PK_9340188c93349808f10d1db74a8");
+
+ entity.Property(e => e.Activities).HasDefaultValueSql("'[]'::text");
+ entity.Property(e => e.CreatedAt).HasDefaultValueSql("now()");
+
+ entity.HasOne(d => d.User).WithMany(p => p.Sessions).HasConstraintName("FK_085d540d9f418cfbdc7bd55bb19");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_e1dafa4063a5532645cc2810374");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.Stickers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_193d551d852aca5347ef5c9f205");
+
+ entity.HasOne(d => d.Pack).WithMany(p => p.Stickers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_e7cfa5cefa6661b3fb8fda8ce69");
+
+ entity.HasOne(d => d.User).WithMany(p => p.Stickers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_8f4ee73f2bb2325ff980502e158");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_a27381efea0f876f5d3233af655");
+
+ entity.HasOne(d => d.CoverStickerId1Navigation).WithMany(p => p.StickerPacks).HasConstraintName("FK_448fafba4355ee1c837bbc865f1");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_40440b6f569ebc02bc71c25c499");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.Streams).HasConstraintName("FK_5101f0cded27ff0aae78fc4eed7");
+
+ entity.HasOne(d => d.Owner).WithMany(p => p.Streams).HasConstraintName("FK_1b566f9b54d1cda271da53ac82f");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_49bdc3f66394c12478f8371c546");
+
+ entity.HasOne(d => d.Stream).WithMany(p => p.StreamSessions).HasConstraintName("FK_8b5a028a34dae9ee54af37c9c32");
+
+ entity.HasOne(d => d.User).WithMany(p => p.StreamSessions).HasConstraintName("FK_13ae5c29aff4d0890c54179511a");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_7e5523774a38b08a6236d322403");
+
+ entity.HasOne(d => d.OwnerUser).WithMany(p => p.Teams).HasConstraintName("FK_13f00abf7cb6096c43ecaf8c108");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_ca3eae89dcf20c9fd95bf7460aa");
+
+ entity.HasOne(d => d.Team).WithMany(p => p.TeamMembers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_fdad7d5768277e60c40e01cdcea");
+
+ entity.HasOne(d => d.User).WithMany(p => p.TeamMembers)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_c2bf4967c8c2a6b845dadfbf3d4");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_515948649ce0bbbe391de702ae5");
+
+ entity.HasOne(d => d.Creator).WithMany(p => p.Templates).HasConstraintName("FK_d7374b7f8f5fbfdececa4fb62e1");
+
+ entity.HasOne(d => d.SourceGuild).WithMany(p => p.Templates)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_445d00eaaea0e60a017a5ed0c11");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_a3ffb1c0c8416b9fc6f907b7433");
+
+ entity.HasOne(d => d.SettingsIndexNavigation).WithOne(p => p.User).HasConstraintName("FK_0c14beb78d8c5ccba66072adbc7");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Index).HasName("PK_e81f8bb92802737337d35c00981");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.UserId).HasName("PK_8ff3d1961a48b693810c9f99853");
+
+ entity.HasOne(d => d.User).WithOne(p => p.UserSettingsProto)
+ .OnDelete(DeleteBehavior.ClientSetNull)
+ .HasConstraintName("FK_8ff3d1961a48b693810c9f99853");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Token).HasName("PK_e0f5c8e3fcefe3134a092c50485");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_ada09a50c134fad1369b510e3ce");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.VoiceStates)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_9f8d389866b40b6657edd026dd4");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.VoiceStates)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_03779ef216d4b0358470d9cb748");
+
+ entity.HasOne(d => d.User).WithMany(p => p.VoiceStates)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_5fe1d5f931a67e85039c640001b");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_9e8795cfc899ab7bdaa831e8527");
+
+ entity.HasOne(d => d.Application).WithMany(p => p.Webhooks)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_c3e5305461931763b56aa905f1c");
+
+ entity.HasOne(d => d.Channel).WithMany(p => p.WebhookChannels)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_df528cf77e82f8032230e7e37d8");
+
+ entity.HasOne(d => d.Guild).WithMany(p => p.WebhookGuilds)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_487a7af59d189f744fe394368fc");
+
+ entity.HasOne(d => d.SourceChannel).WithMany(p => p.WebhookSourceChannels)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_4495b7032a33c6b8b605d030398");
+
+ entity.HasOne(d => d.SourceGuild).WithMany(p => p.WebhookSourceGuilds)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_3a285f4f49c40e0706d3018bc9f");
+
+ entity.HasOne(d => d.User).WithMany(p => p.Webhooks)
+ .OnDelete(DeleteBehavior.Cascade)
+ .HasConstraintName("FK_0d523f6f997c86e052c49b1455f");
+ });
+
+ OnModelCreatingPartial(modelBuilder);
+ }
+
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Application.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Application.cs
new file mode 100644
index 0000000..bb9661d
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Application.cs
@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("applications")]
+[Index("BotUserId", Name = "REL_2ce5a55796fe4c2f77ece57a64", IsUnique = true)]
+public partial class Application
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("icon", TypeName = "character varying")]
+ public string? Icon { get; set; }
+
+ [Column("description", TypeName = "character varying")]
+ public string? Description { get; set; }
+
+ [Column("summary", TypeName = "character varying")]
+ public string? Summary { get; set; }
+
+ [Column("type")]
+ public string? Type { get; set; }
+
+ [Column("hook")]
+ public bool Hook { get; set; }
+
+ [Column("bot_public")]
+ public bool BotPublic { get; set; }
+
+ [Column("bot_require_code_grant")]
+ public bool BotRequireCodeGrant { get; set; }
+
+ [Column("verify_key", TypeName = "character varying")]
+ public string VerifyKey { get; set; } = null!;
+
+ [Column("flags")]
+ public int Flags { get; set; }
+
+ [Column("redirect_uris")]
+ public string? RedirectUris { get; set; }
+
+ [Column("rpc_application_state")]
+ public int? RpcApplicationState { get; set; }
+
+ [Column("store_application_state")]
+ public int? StoreApplicationState { get; set; }
+
+ [Column("verification_state")]
+ public int? VerificationState { get; set; }
+
+ [Column("interactions_endpoint_url", TypeName = "character varying")]
+ public string? InteractionsEndpointUrl { get; set; }
+
+ [Column("integration_public")]
+ public bool? IntegrationPublic { get; set; }
+
+ [Column("integration_require_code_grant")]
+ public bool? IntegrationRequireCodeGrant { get; set; }
+
+ [Column("discoverability_state")]
+ public int? DiscoverabilityState { get; set; }
+
+ [Column("discovery_eligibility_flags")]
+ public int? DiscoveryEligibilityFlags { get; set; }
+
+ [Column("tags")]
+ public string? Tags { get; set; }
+
+ [Column("cover_image", TypeName = "character varying")]
+ public string? CoverImage { get; set; }
+
+ [Column("install_params")]
+ public string? InstallParams { get; set; }
+
+ [Column("terms_of_service_url", TypeName = "character varying")]
+ public string? TermsOfServiceUrl { get; set; }
+
+ [Column("privacy_policy_url", TypeName = "character varying")]
+ public string? PrivacyPolicyUrl { get; set; }
+
+ [Column("owner_id", TypeName = "character varying")]
+ public string? OwnerId { get; set; }
+
+ [Column("bot_user_id", TypeName = "character varying")]
+ public string? BotUserId { get; set; }
+
+ [Column("team_id", TypeName = "character varying")]
+ public string? TeamId { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("custom_install_url", TypeName = "character varying")]
+ public string? CustomInstallUrl { get; set; }
+
+ [ForeignKey("BotUserId")]
+ [InverseProperty("ApplicationBotUser")]
+ public virtual User? BotUser { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Applications")]
+ public virtual Guild? Guild { get; set; }
+
+ [InverseProperty("Application")]
+ public virtual ICollection Messages { get; set; } = new List();
+
+ [ForeignKey("OwnerId")]
+ [InverseProperty("ApplicationOwners")]
+ public virtual User? Owner { get; set; }
+
+ [ForeignKey("TeamId")]
+ [InverseProperty("Applications")]
+ public virtual Team? Team { get; set; }
+
+ [InverseProperty("Application")]
+ public virtual ICollection Webhooks { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/ApplicationCommand.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/ApplicationCommand.cs
new file mode 100644
index 0000000..bad2fd9
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/ApplicationCommand.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("application_commands")]
+public partial class ApplicationCommand
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("type")]
+ public int Type { get; set; }
+
+ [Column("application_id", TypeName = "character varying")]
+ public string ApplicationId { get; set; } = null!;
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("name_localizations")]
+ public string? NameLocalizations { get; set; }
+
+ [Column("description", TypeName = "character varying")]
+ public string Description { get; set; } = null!;
+
+ [Column("description_localizations")]
+ public string? DescriptionLocalizations { get; set; }
+
+ [Column("options")]
+ public string Options { get; set; } = null!;
+
+ [Column("default_member_permissions", TypeName = "character varying")]
+ public string? DefaultMemberPermissions { get; set; }
+
+ [Column("dm_permission")]
+ public bool DmPermission { get; set; }
+
+ [Column("permissions")]
+ public string? Permissions { get; set; }
+
+ [Column("nsfw")]
+ public bool Nsfw { get; set; }
+
+ [Column("integration_types")]
+ public string? IntegrationTypes { get; set; }
+
+ [Column("global_popularity_rank")]
+ public int GlobalPopularityRank { get; set; }
+
+ [Column("contexts")]
+ public string? Contexts { get; set; }
+
+ [Column("version", TypeName = "character varying")]
+ public string Version { get; set; } = null!;
+
+ [Column("handler")]
+ public int Handler { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Attachment.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Attachment.cs
new file mode 100644
index 0000000..7cff948
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Attachment.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("attachments")]
+public partial class Attachment
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("filename", TypeName = "character varying")]
+ public string Filename { get; set; } = null!;
+
+ [Column("size")]
+ public int Size { get; set; }
+
+ [Column("url", TypeName = "character varying")]
+ public string Url { get; set; } = null!;
+
+ [Column("proxy_url", TypeName = "character varying")]
+ public string ProxyUrl { get; set; } = null!;
+
+ [Column("height")]
+ public int? Height { get; set; }
+
+ [Column("width")]
+ public int? Width { get; set; }
+
+ [Column("content_type", TypeName = "character varying")]
+ public string? ContentType { get; set; }
+
+ [Column("message_id", TypeName = "character varying")]
+ public string? MessageId { get; set; }
+
+ [ForeignKey("MessageId")]
+ [InverseProperty("Attachments")]
+ public virtual Message? Message { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/AuditLog.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/AuditLog.cs
new file mode 100644
index 0000000..68bcf58
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/AuditLog.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("audit_logs")]
+public partial class AuditLog
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("action_type")]
+ public int ActionType { get; set; }
+
+ [Column("options")]
+ public string? Options { get; set; }
+
+ [Column("changes")]
+ public string Changes { get; set; } = null!;
+
+ [Column("reason", TypeName = "character varying")]
+ public string? Reason { get; set; }
+
+ [Column("target_id", TypeName = "character varying")]
+ public string? TargetId { get; set; }
+
+ [ForeignKey("TargetId")]
+ [InverseProperty("AuditLogTargets")]
+ public virtual User? Target { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("AuditLogUsers")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/AutomodRule.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/AutomodRule.cs
new file mode 100644
index 0000000..e0da822
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/AutomodRule.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("automod_rules")]
+public partial class AutomodRule
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("enabled")]
+ public bool Enabled { get; set; }
+
+ [Column("event_type")]
+ public int EventType { get; set; }
+
+ [Column("exempt_channels")]
+ public string ExemptChannels { get; set; } = null!;
+
+ [Column("exempt_roles")]
+ public string ExemptRoles { get; set; } = null!;
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string GuildId { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("position")]
+ public int Position { get; set; }
+
+ [Column("trigger_type")]
+ public int TriggerType { get; set; }
+
+ [Column("trigger_metadata")]
+ public string? TriggerMetadata { get; set; }
+
+ [Column("actions")]
+ public string Actions { get; set; } = null!;
+
+ [Column("creator_id", TypeName = "character varying")]
+ public string? CreatorId { get; set; }
+
+ [ForeignKey("CreatorId")]
+ [InverseProperty("AutomodRules")]
+ public virtual User? Creator { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/BackupCode.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/BackupCode.cs
new file mode 100644
index 0000000..5793336
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/BackupCode.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("backup_codes")]
+public partial class BackupCode
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("code", TypeName = "character varying")]
+ public string Code { get; set; } = null!;
+
+ [Column("consumed")]
+ public bool Consumed { get; set; }
+
+ [Column("expired")]
+ public bool Expired { get; set; }
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("BackupCodes")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Badge.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Badge.cs
new file mode 100644
index 0000000..e92ddd4
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Badge.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("badges")]
+public partial class Badge
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("description", TypeName = "character varying")]
+ public string Description { get; set; } = null!;
+
+ [Column("icon", TypeName = "character varying")]
+ public string Icon { get; set; } = null!;
+
+ [Column("link", TypeName = "character varying")]
+ public string? Link { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Ban.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Ban.cs
new file mode 100644
index 0000000..634dad1
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Ban.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("bans")]
+public partial class Ban
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("executor_id", TypeName = "character varying")]
+ public string? ExecutorId { get; set; }
+
+ [Column("ip", TypeName = "character varying")]
+ public string? Ip { get; set; }
+
+ [Column("reason", TypeName = "character varying")]
+ public string? Reason { get; set; }
+
+ [ForeignKey("ExecutorId")]
+ [InverseProperty("BanExecutors")]
+ public virtual User? Executor { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Bans")]
+ public virtual Guild? Guild { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("BanUsers")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Category.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Category.cs
new file mode 100644
index 0000000..accd6c2
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Category.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("categories")]
+public partial class Category
+{
+ [Key]
+ [Column("id")]
+ public int Id { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string? Name { get; set; }
+
+ [Column("localizations")]
+ public string Localizations { get; set; } = null!;
+
+ [Column("is_primary")]
+ public bool? IsPrimary { get; set; }
+
+ [Column("icon", TypeName = "character varying")]
+ public string? Icon { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Channel.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Channel.cs
new file mode 100644
index 0000000..057a9a3
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Channel.cs
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("channels")]
+public partial class Channel
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string? Name { get; set; }
+
+ [Column("icon")]
+ public string? Icon { get; set; }
+
+ [Column("type")]
+ public int Type { get; set; }
+
+ [Column("last_message_id", TypeName = "character varying")]
+ public string? LastMessageId { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("parent_id", TypeName = "character varying")]
+ public string? ParentId { get; set; }
+
+ [Column("owner_id", TypeName = "character varying")]
+ public string? OwnerId { get; set; }
+
+ [Column("last_pin_timestamp")]
+ public int? LastPinTimestamp { get; set; }
+
+ [Column("default_auto_archive_duration")]
+ public int? DefaultAutoArchiveDuration { get; set; }
+
+ [Column("permission_overwrites")]
+ public string? PermissionOverwrites { get; set; }
+
+ [Column("video_quality_mode")]
+ public int? VideoQualityMode { get; set; }
+
+ [Column("bitrate")]
+ public int? Bitrate { get; set; }
+
+ [Column("user_limit")]
+ public int? UserLimit { get; set; }
+
+ [Column("nsfw")]
+ public bool Nsfw { get; set; }
+
+ [Column("rate_limit_per_user")]
+ public int? RateLimitPerUser { get; set; }
+
+ [Column("topic", TypeName = "character varying")]
+ public string? Topic { get; set; }
+
+ [Column("retention_policy_id", TypeName = "character varying")]
+ public string? RetentionPolicyId { get; set; }
+
+ [Column("flags")]
+ public int Flags { get; set; }
+
+ [Column("default_thread_rate_limit_per_user")]
+ public int? DefaultThreadRateLimitPerUser { get; set; }
+
+ [InverseProperty("Channel")]
+ public virtual ICollection CloudAttachments { get; set; } = new List();
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Channels")]
+ public virtual Guild? Guild { get; set; }
+
+ [InverseProperty("AfkChannel")]
+ public virtual ICollection GuildAfkChannels { get; set; } = new List();
+
+ [InverseProperty("PublicUpdatesChannel")]
+ public virtual ICollection GuildPublicUpdatesChannels { get; set; } = new List();
+
+ [InverseProperty("RulesChannel")]
+ public virtual ICollection GuildRulesChannels { get; set; } = new List();
+
+ [InverseProperty("SystemChannel")]
+ public virtual ICollection GuildSystemChannels { get; set; } = new List();
+
+ [InverseProperty("WidgetChannel")]
+ public virtual ICollection GuildWidgetChannels { get; set; } = new List();
+
+ [InverseProperty("Parent")]
+ public virtual ICollection InverseParent { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection Invites { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection Messages { get; set; } = new List();
+
+ [ForeignKey("OwnerId")]
+ [InverseProperty("Channels")]
+ public virtual User? Owner { get; set; }
+
+ [ForeignKey("ParentId")]
+ [InverseProperty("InverseParent")]
+ public virtual Channel? Parent { get; set; }
+
+ [InverseProperty("Channel")]
+ public virtual ICollection ReadStates { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection Recipients { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection Streams { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection VoiceStates { get; set; } = new List();
+
+ [InverseProperty("Channel")]
+ public virtual ICollection WebhookChannels { get; set; } = new List();
+
+ [InverseProperty("SourceChannel")]
+ public virtual ICollection WebhookSourceChannels { get; set; } = new List();
+
+ [ForeignKey("ChannelsId")]
+ [InverseProperty("Channels")]
+ public virtual ICollection MessagesNavigation { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/ClientRelease.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/ClientRelease.cs
new file mode 100644
index 0000000..ad4befb
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/ClientRelease.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("client_release")]
+public partial class ClientRelease
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("pub_date", TypeName = "timestamp without time zone")]
+ public DateTime PubDate { get; set; }
+
+ [Column("url", TypeName = "character varying")]
+ public string Url { get; set; } = null!;
+
+ [Column("platform", TypeName = "character varying")]
+ public string Platform { get; set; } = null!;
+
+ [Column("enabled")]
+ public bool Enabled { get; set; }
+
+ [Column("notes", TypeName = "character varying")]
+ public string? Notes { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/CloudAttachment.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/CloudAttachment.cs
new file mode 100644
index 0000000..3b78060
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/CloudAttachment.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("cloud_attachments")]
+public partial class CloudAttachment
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string? ChannelId { get; set; }
+
+ [Column("upload_filename", TypeName = "character varying")]
+ public string UploadFilename { get; set; } = null!;
+
+ [Column("user_attachment_id", TypeName = "character varying")]
+ public string? UserAttachmentId { get; set; }
+
+ [Column("user_filename", TypeName = "character varying")]
+ public string UserFilename { get; set; } = null!;
+
+ [Column("user_file_size")]
+ public int? UserFileSize { get; set; }
+
+ [Column("user_original_content_type", TypeName = "character varying")]
+ public string? UserOriginalContentType { get; set; }
+
+ [Column("user_is_clip")]
+ public bool? UserIsClip { get; set; }
+
+ [Column("size")]
+ public int? Size { get; set; }
+
+ [Column("height")]
+ public int? Height { get; set; }
+
+ [Column("width")]
+ public int? Width { get; set; }
+
+ [Column("content_type", TypeName = "character varying")]
+ public string? ContentType { get; set; }
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("CloudAttachments")]
+ public virtual Channel? Channel { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("CloudAttachments")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Config.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Config.cs
new file mode 100644
index 0000000..31016c6
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Config.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("config")]
+public partial class Config
+{
+ [Key]
+ [Column("key", TypeName = "character varying")]
+ public string Key { get; set; } = null!;
+
+ [Column("value")]
+ public string? Value { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectedAccount.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectedAccount.cs
new file mode 100644
index 0000000..977797b
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectedAccount.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("connected_accounts")]
+public partial class ConnectedAccount
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("external_id", TypeName = "character varying")]
+ public string ExternalId { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("friend_sync")]
+ public bool FriendSync { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("revoked")]
+ public bool Revoked { get; set; }
+
+ [Column("show_activity")]
+ public int ShowActivity { get; set; }
+
+ [Column("type", TypeName = "character varying")]
+ public string Type { get; set; } = null!;
+
+ [Column("verified")]
+ public bool Verified { get; set; }
+
+ [Column("visibility")]
+ public int Visibility { get; set; }
+
+ [Column("integrations")]
+ public string Integrations { get; set; } = null!;
+
+ [Column("metadata")]
+ public string? Metadata { get; set; }
+
+ [Column("metadata_visibility")]
+ public int MetadataVisibility { get; set; }
+
+ [Column("two_way_link")]
+ public bool TwoWayLink { get; set; }
+
+ [Column("token_data")]
+ public string? TokenData { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("ConnectedAccounts")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectionConfig.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectionConfig.cs
new file mode 100644
index 0000000..0bbd0dd
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/ConnectionConfig.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("connection_config")]
+public partial class ConnectionConfig
+{
+ [Key]
+ [Column("key", TypeName = "character varying")]
+ public string Key { get; set; } = null!;
+
+ [Column("value")]
+ public string? Value { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/EmbedCache.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/EmbedCache.cs
new file mode 100644
index 0000000..3ae84bc
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/EmbedCache.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("embed_cache")]
+public partial class EmbedCache
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("url", TypeName = "character varying")]
+ public string Url { get; set; } = null!;
+
+ [Column("embed")]
+ public string Embed { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Emoji.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Emoji.cs
new file mode 100644
index 0000000..faa5224
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Emoji.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("emojis")]
+public partial class Emoji
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("animated")]
+ public bool Animated { get; set; }
+
+ [Column("available")]
+ public bool Available { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string GuildId { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("managed")]
+ public bool Managed { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("require_colons")]
+ public bool RequireColons { get; set; }
+
+ [Column("roles")]
+ public string Roles { get; set; } = null!;
+
+ [Column("groups")]
+ public string? Groups { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Emojis")]
+ public virtual Guild Guild { get; set; } = null!;
+
+ [ForeignKey("UserId")]
+ [InverseProperty("Emojis")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Guild.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Guild.cs
new file mode 100644
index 0000000..f4729ae
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Guild.cs
@@ -0,0 +1,199 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("guilds")]
+public partial class Guild
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("afk_channel_id", TypeName = "character varying")]
+ public string? AfkChannelId { get; set; }
+
+ [Column("afk_timeout")]
+ public int? AfkTimeout { get; set; }
+
+ [Column("banner", TypeName = "character varying")]
+ public string? Banner { get; set; }
+
+ [Column("default_message_notifications")]
+ public int? DefaultMessageNotifications { get; set; }
+
+ [Column("description", TypeName = "character varying")]
+ public string? Description { get; set; }
+
+ [Column("discovery_splash", TypeName = "character varying")]
+ public string? DiscoverySplash { get; set; }
+
+ [Column("explicit_content_filter")]
+ public int? ExplicitContentFilter { get; set; }
+
+ [Column("features")]
+ public string Features { get; set; } = null!;
+
+ [Column("primary_category_id", TypeName = "character varying")]
+ public string? PrimaryCategoryId { get; set; }
+
+ [Column("icon", TypeName = "character varying")]
+ public string? Icon { get; set; }
+
+ [Column("large")]
+ public bool Large { get; set; }
+
+ [Column("max_members")]
+ public int? MaxMembers { get; set; }
+
+ [Column("max_presences")]
+ public int? MaxPresences { get; set; }
+
+ [Column("max_video_channel_users")]
+ public int? MaxVideoChannelUsers { get; set; }
+
+ [Column("member_count")]
+ public int? MemberCount { get; set; }
+
+ [Column("presence_count")]
+ public int? PresenceCount { get; set; }
+
+ [Column("template_id", TypeName = "character varying")]
+ public string? TemplateId { get; set; }
+
+ [Column("mfa_level")]
+ public int? MfaLevel { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("owner_id", TypeName = "character varying")]
+ public string? OwnerId { get; set; }
+
+ [Column("preferred_locale", TypeName = "character varying")]
+ public string? PreferredLocale { get; set; }
+
+ [Column("premium_subscription_count")]
+ public int? PremiumSubscriptionCount { get; set; }
+
+ [Column("premium_tier")]
+ public int PremiumTier { get; set; }
+
+ [Column("public_updates_channel_id", TypeName = "character varying")]
+ public string? PublicUpdatesChannelId { get; set; }
+
+ [Column("rules_channel_id", TypeName = "character varying")]
+ public string? RulesChannelId { get; set; }
+
+ [Column("region", TypeName = "character varying")]
+ public string? Region { get; set; }
+
+ [Column("splash", TypeName = "character varying")]
+ public string? Splash { get; set; }
+
+ [Column("system_channel_id", TypeName = "character varying")]
+ public string? SystemChannelId { get; set; }
+
+ [Column("system_channel_flags")]
+ public int? SystemChannelFlags { get; set; }
+
+ [Column("unavailable")]
+ public bool Unavailable { get; set; }
+
+ [Column("verification_level")]
+ public int? VerificationLevel { get; set; }
+
+ [Column("welcome_screen")]
+ public string WelcomeScreen { get; set; } = null!;
+
+ [Column("widget_channel_id", TypeName = "character varying")]
+ public string? WidgetChannelId { get; set; }
+
+ [Column("widget_enabled")]
+ public bool WidgetEnabled { get; set; }
+
+ [Column("nsfw_level")]
+ public int? NsfwLevel { get; set; }
+
+ [Column("nsfw")]
+ public bool Nsfw { get; set; }
+
+ [Column("parent", TypeName = "character varying")]
+ public string? Parent { get; set; }
+
+ [Column("premium_progress_bar_enabled")]
+ public bool? PremiumProgressBarEnabled { get; set; }
+
+ [Column("channel_ordering")]
+ public string ChannelOrdering { get; set; } = null!;
+
+ [ForeignKey("AfkChannelId")]
+ [InverseProperty("GuildAfkChannels")]
+ public virtual Channel? AfkChannel { get; set; }
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Applications { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Bans { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Channels { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Emojis { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Invites { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Members { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Messages { get; set; } = new List();
+
+ [ForeignKey("OwnerId")]
+ [InverseProperty("Guilds")]
+ public virtual User? Owner { get; set; }
+
+ [ForeignKey("PublicUpdatesChannelId")]
+ [InverseProperty("GuildPublicUpdatesChannels")]
+ public virtual Channel? PublicUpdatesChannel { get; set; }
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Roles { get; set; } = new List();
+
+ [ForeignKey("RulesChannelId")]
+ [InverseProperty("GuildRulesChannels")]
+ public virtual Channel? RulesChannel { get; set; }
+
+ [InverseProperty("Guild")]
+ public virtual ICollection Stickers { get; set; } = new List();
+
+ [ForeignKey("SystemChannelId")]
+ [InverseProperty("GuildSystemChannels")]
+ public virtual Channel? SystemChannel { get; set; }
+
+ [ForeignKey("TemplateId")]
+ [InverseProperty("Guilds")]
+ public virtual Template? Template { get; set; }
+
+ [InverseProperty("SourceGuild")]
+ public virtual ICollection Templates { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection VoiceStates { get; set; } = new List();
+
+ [InverseProperty("Guild")]
+ public virtual ICollection WebhookGuilds { get; set; } = new List();
+
+ [InverseProperty("SourceGuild")]
+ public virtual ICollection WebhookSourceGuilds { get; set; } = new List();
+
+ [ForeignKey("WidgetChannelId")]
+ [InverseProperty("GuildWidgetChannels")]
+ public virtual Channel? WidgetChannel { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/InstanceBan.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/InstanceBan.cs
new file mode 100644
index 0000000..48ff0e7
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/InstanceBan.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("instance_bans")]
+[Index("OriginInstanceBanId", Name = "REL_0b02d18d0d830f160c921192a3", IsUnique = true)]
+public partial class InstanceBan
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("reason", TypeName = "character varying")]
+ public string Reason { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("fingerprint", TypeName = "character varying")]
+ public string? Fingerprint { get; set; }
+
+ [Column("ip_address", TypeName = "character varying")]
+ public string? IpAddress { get; set; }
+
+ [Column("is_from_other_instance_ban")]
+ public bool IsFromOtherInstanceBan { get; set; }
+
+ [Column("origin_instance_ban_id", TypeName = "character varying")]
+ public string? OriginInstanceBanId { get; set; }
+
+ [Column("is_allowlisted")]
+ public bool IsAllowlisted { get; set; }
+
+ [InverseProperty("OriginInstanceBan")]
+ public virtual InstanceBan? InverseOriginInstanceBan { get; set; }
+
+ [ForeignKey("OriginInstanceBanId")]
+ [InverseProperty("InverseOriginInstanceBan")]
+ public virtual InstanceBan? OriginInstanceBan { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Invite.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Invite.cs
new file mode 100644
index 0000000..b53a397
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Invite.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("invites")]
+public partial class Invite
+{
+ [Key]
+ [Column("code", TypeName = "character varying")]
+ public string Code { get; set; } = null!;
+
+ [Column("temporary")]
+ public bool Temporary { get; set; }
+
+ [Column("uses")]
+ public int Uses { get; set; }
+
+ [Column("max_uses")]
+ public int MaxUses { get; set; }
+
+ [Column("max_age")]
+ public int MaxAge { get; set; }
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("expires_at", TypeName = "timestamp without time zone")]
+ public DateTime? ExpiresAt { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string? ChannelId { get; set; }
+
+ [Column("inviter_id", TypeName = "character varying")]
+ public string? InviterId { get; set; }
+
+ [Column("target_user_id", TypeName = "character varying")]
+ public string? TargetUserId { get; set; }
+
+ [Column("target_user_type")]
+ public int? TargetUserType { get; set; }
+
+ [Column("vanity_url")]
+ public bool? VanityUrl { get; set; }
+
+ [Column("flags")]
+ public int Flags { get; set; }
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("Invites")]
+ public virtual Channel? Channel { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Invites")]
+ public virtual Guild? Guild { get; set; }
+
+ [ForeignKey("InviterId")]
+ [InverseProperty("InviteInviters")]
+ public virtual User? Inviter { get; set; }
+
+ [ForeignKey("TargetUserId")]
+ [InverseProperty("InviteTargetUsers")]
+ public virtual User? TargetUser { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Member.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Member.cs
new file mode 100644
index 0000000..dfa24f3
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Member.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("members")]
+[Index("Id", "GuildId", Name = "IDX_bb2bf9386ac443afbbbf9f12d3", IsUnique = true)]
+public partial class Member
+{
+ [Key]
+ [Column("index")]
+ public int Index { get; set; }
+
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string GuildId { get; set; } = null!;
+
+ [Column("nick", TypeName = "character varying")]
+ public string? Nick { get; set; }
+
+ [Column("joined_at", TypeName = "timestamp without time zone")]
+ public DateTime JoinedAt { get; set; }
+
+ [Column("premium_since")]
+ public long? PremiumSince { get; set; }
+
+ [Column("deaf")]
+ public bool Deaf { get; set; }
+
+ [Column("mute")]
+ public bool Mute { get; set; }
+
+ [Column("pending")]
+ public bool Pending { get; set; }
+
+ [Column("settings")]
+ public string Settings { get; set; } = null!;
+
+ [Column("last_message_id", TypeName = "character varying")]
+ public string? LastMessageId { get; set; }
+
+ [Column("joined_by", TypeName = "character varying")]
+ public string? JoinedBy { get; set; }
+
+ [Column("avatar", TypeName = "character varying")]
+ public string? Avatar { get; set; }
+
+ [Column("banner", TypeName = "character varying")]
+ public string? Banner { get; set; }
+
+ [Column("bio", TypeName = "character varying")]
+ public string Bio { get; set; } = null!;
+
+ [Column("theme_colors")]
+ public string? ThemeColors { get; set; }
+
+ [Column("pronouns", TypeName = "character varying")]
+ public string? Pronouns { get; set; }
+
+ [Column("communication_disabled_until", TypeName = "timestamp without time zone")]
+ public DateTime? CommunicationDisabledUntil { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Members")]
+ public virtual Guild Guild { get; set; } = null!;
+
+ [ForeignKey("Id")]
+ [InverseProperty("Members")]
+ public virtual User IdNavigation { get; set; } = null!;
+
+ [ForeignKey("Index")]
+ [InverseProperty("Indices")]
+ public virtual ICollection Roles { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Message.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Message.cs
new file mode 100644
index 0000000..ca0abd7
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Message.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("messages")]
+[Index("AuthorId", Name = "IDX_05535bc695e9f7ee104616459d")]
+[Index("ChannelId", "Id", Name = "IDX_3ed7a60fb7dbe04e1ba9332a8b", IsUnique = true)]
+[Index("ChannelId", Name = "IDX_86b9109b155eb70c0a2ca3b4b6")]
+public partial class Message
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string? ChannelId { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("author_id", TypeName = "character varying")]
+ public string? AuthorId { get; set; }
+
+ [Column("member_id", TypeName = "character varying")]
+ public string? MemberId { get; set; }
+
+ [Column("webhook_id", TypeName = "character varying")]
+ public string? WebhookId { get; set; }
+
+ [Column("application_id", TypeName = "character varying")]
+ public string? ApplicationId { get; set; }
+
+ [Column("content", TypeName = "character varying")]
+ public string? Content { get; set; }
+
+ [Column("timestamp", TypeName = "timestamp without time zone")]
+ public DateTime Timestamp { get; set; }
+
+ [Column("edited_timestamp", TypeName = "timestamp without time zone")]
+ public DateTime? EditedTimestamp { get; set; }
+
+ [Column("tts")]
+ public bool? Tts { get; set; }
+
+ [Column("mention_everyone")]
+ public bool? MentionEveryone { get; set; }
+
+ [Column("embeds")]
+ public string Embeds { get; set; } = null!;
+
+ [Column("reactions")]
+ public string Reactions { get; set; } = null!;
+
+ [Column("nonce")]
+ public string? Nonce { get; set; }
+
+ [Column("type")]
+ public int Type { get; set; }
+
+ [Column("activity")]
+ public string? Activity { get; set; }
+
+ [Column("message_reference")]
+ public string? MessageReference { get; set; }
+
+ [Column("interaction")]
+ public string? Interaction { get; set; }
+
+ [Column("components")]
+ public string? Components { get; set; }
+
+ [Column("message_reference_id", TypeName = "character varying")]
+ public string? MessageReferenceId { get; set; }
+
+ [Column("flags")]
+ public int Flags { get; set; }
+
+ [Column("poll")]
+ public string? Poll { get; set; }
+
+ [Column("username", TypeName = "character varying")]
+ public string? Username { get; set; }
+
+ [Column("avatar", TypeName = "character varying")]
+ public string? Avatar { get; set; }
+
+ [Column("pinned_at", TypeName = "timestamp without time zone")]
+ public DateTime? PinnedAt { get; set; }
+
+ [Column("interaction_metadata")]
+ public string? InteractionMetadata { get; set; }
+
+ [Column("message_snapshots")]
+ public string MessageSnapshots { get; set; } = null!;
+
+ [ForeignKey("ApplicationId")]
+ [InverseProperty("Messages")]
+ public virtual Application? Application { get; set; }
+
+ [InverseProperty("Message")]
+ public virtual ICollection Attachments { get; set; } = new List();
+
+ [ForeignKey("AuthorId")]
+ [InverseProperty("MessageAuthors")]
+ public virtual User? Author { get; set; }
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("Messages")]
+ public virtual Channel? Channel { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Messages")]
+ public virtual Guild? Guild { get; set; }
+
+ [InverseProperty("MessageReferenceNavigation")]
+ public virtual ICollection InverseMessageReferenceNavigation { get; set; } = new List();
+
+ [ForeignKey("MemberId")]
+ [InverseProperty("MessageMembers")]
+ public virtual User? Member { get; set; }
+
+ [ForeignKey("MessageReferenceId")]
+ [InverseProperty("InverseMessageReferenceNavigation")]
+ public virtual Message? MessageReferenceNavigation { get; set; }
+
+ [ForeignKey("WebhookId")]
+ [InverseProperty("Messages")]
+ public virtual Webhook? Webhook { get; set; }
+
+ [ForeignKey("MessagesId")]
+ [InverseProperty("MessagesNavigation")]
+ public virtual ICollection Channels { get; set; } = new List();
+
+ [ForeignKey("MessagesId")]
+ [InverseProperty("Messages")]
+ public virtual ICollection Roles { get; set; } = new List();
+
+ [ForeignKey("MessagesId")]
+ [InverseProperty("Messages")]
+ public virtual ICollection Stickers { get; set; } = new List();
+
+ [ForeignKey("MessagesId")]
+ [InverseProperty("Messages")]
+ public virtual ICollection Users { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Migration.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Migration.cs
new file mode 100644
index 0000000..d5748e5
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Migration.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("migrations")]
+public partial class Migration
+{
+ [Key]
+ [Column("id")]
+ public int Id { get; set; }
+
+ [Column("timestamp")]
+ public long Timestamp { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Note.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Note.cs
new file mode 100644
index 0000000..38b230f
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Note.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("notes")]
+[Index("OwnerId", "TargetId", Name = "UQ_74e6689b9568cc965b8bfc9150b", IsUnique = true)]
+public partial class Note
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("content", TypeName = "character varying")]
+ public string Content { get; set; } = null!;
+
+ [Column("owner_id", TypeName = "character varying")]
+ public string? OwnerId { get; set; }
+
+ [Column("target_id", TypeName = "character varying")]
+ public string? TargetId { get; set; }
+
+ [ForeignKey("OwnerId")]
+ [InverseProperty("NoteOwners")]
+ public virtual User? Owner { get; set; }
+
+ [ForeignKey("TargetId")]
+ [InverseProperty("NoteTargets")]
+ public virtual User? Target { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/RateLimit.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/RateLimit.cs
new file mode 100644
index 0000000..9748832
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/RateLimit.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("rate_limits")]
+public partial class RateLimit
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("executor_id", TypeName = "character varying")]
+ public string ExecutorId { get; set; } = null!;
+
+ [Column("hits")]
+ public int Hits { get; set; }
+
+ [Column("blocked")]
+ public bool Blocked { get; set; }
+
+ [Column("expires_at", TypeName = "timestamp without time zone")]
+ public DateTime ExpiresAt { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/ReadState.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/ReadState.cs
new file mode 100644
index 0000000..43bc0ac
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/ReadState.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("read_states")]
+[Index("ChannelId", "UserId", Name = "IDX_0abf8b443321bd3cf7f81ee17a", IsUnique = true)]
+public partial class ReadState
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string ChannelId { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string UserId { get; set; } = null!;
+
+ [Column("last_message_id", TypeName = "character varying")]
+ public string? LastMessageId { get; set; }
+
+ [Column("public_ack", TypeName = "character varying")]
+ public string? PublicAck { get; set; }
+
+ [Column("notifications_cursor", TypeName = "character varying")]
+ public string? NotificationsCursor { get; set; }
+
+ [Column("last_pin_timestamp", TypeName = "timestamp without time zone")]
+ public DateTime? LastPinTimestamp { get; set; }
+
+ [Column("mention_count")]
+ public int? MentionCount { get; set; }
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("ReadStates")]
+ public virtual Channel Channel { get; set; } = null!;
+
+ [ForeignKey("UserId")]
+ [InverseProperty("ReadStates")]
+ public virtual User User { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Recipient.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Recipient.cs
new file mode 100644
index 0000000..50fa20c
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Recipient.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("recipients")]
+public partial class Recipient
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string ChannelId { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string UserId { get; set; } = null!;
+
+ [Column("closed")]
+ public bool Closed { get; set; }
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("Recipients")]
+ public virtual Channel Channel { get; set; } = null!;
+
+ [ForeignKey("UserId")]
+ [InverseProperty("Recipients")]
+ public virtual User User { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Relationship.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Relationship.cs
new file mode 100644
index 0000000..799c9ae
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Relationship.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("relationships")]
+[Index("FromId", "ToId", Name = "IDX_a0b2ff0a598df0b0d055934a17", IsUnique = true)]
+public partial class Relationship
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("from_id", TypeName = "character varying")]
+ public string FromId { get; set; } = null!;
+
+ [Column("to_id", TypeName = "character varying")]
+ public string ToId { get; set; } = null!;
+
+ [Column("nickname", TypeName = "character varying")]
+ public string? Nickname { get; set; }
+
+ [Column("type")]
+ public int Type { get; set; }
+
+ [ForeignKey("FromId")]
+ [InverseProperty("RelationshipFroms")]
+ public virtual User From { get; set; } = null!;
+
+ [ForeignKey("ToId")]
+ [InverseProperty("RelationshipTos")]
+ public virtual User To { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Role.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Role.cs
new file mode 100644
index 0000000..a57875c
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Role.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("roles")]
+public partial class Role
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string GuildId { get; set; } = null!;
+
+ [Column("color")]
+ public int Color { get; set; }
+
+ [Column("hoist")]
+ public bool Hoist { get; set; }
+
+ [Column("managed")]
+ public bool Managed { get; set; }
+
+ [Column("mentionable")]
+ public bool Mentionable { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("permissions", TypeName = "character varying")]
+ public string Permissions { get; set; } = null!;
+
+ [Column("position")]
+ public int Position { get; set; }
+
+ [Column("icon", TypeName = "character varying")]
+ public string? Icon { get; set; }
+
+ [Column("unicode_emoji", TypeName = "character varying")]
+ public string? UnicodeEmoji { get; set; }
+
+ [Column("tags")]
+ public string? Tags { get; set; }
+
+ [Column("flags")]
+ public int Flags { get; set; }
+
+ [Column("colors")]
+ public string Colors { get; set; } = null!;
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Roles")]
+ public virtual Guild Guild { get; set; } = null!;
+
+ [ForeignKey("RoleId")]
+ [InverseProperty("Roles")]
+ public virtual ICollection Indices { get; set; } = new List();
+
+ [ForeignKey("RolesId")]
+ [InverseProperty("Roles")]
+ public virtual ICollection Messages { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/SecurityKey.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/SecurityKey.cs
new file mode 100644
index 0000000..a7a962e
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/SecurityKey.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("security_keys")]
+public partial class SecurityKey
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("key_id", TypeName = "character varying")]
+ public string KeyId { get; set; } = null!;
+
+ [Column("public_key", TypeName = "character varying")]
+ public string PublicKey { get; set; } = null!;
+
+ [Column("counter")]
+ public int Counter { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [ForeignKey("UserId")]
+ [InverseProperty("SecurityKeys")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/SecuritySetting.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/SecuritySetting.cs
new file mode 100644
index 0000000..cb52206
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/SecuritySetting.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("security_settings")]
+public partial class SecuritySetting
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string? ChannelId { get; set; }
+
+ [Column("encryption_permission_mask")]
+ public int EncryptionPermissionMask { get; set; }
+
+ [Column("allowed_algorithms")]
+ public string AllowedAlgorithms { get; set; } = null!;
+
+ [Column("current_algorithm", TypeName = "character varying")]
+ public string CurrentAlgorithm { get; set; } = null!;
+
+ [Column("used_since_message", TypeName = "character varying")]
+ public string? UsedSinceMessage { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Session.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Session.cs
new file mode 100644
index 0000000..31c559d
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Session.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("sessions")]
+[Index("UserId", Name = "IDX_085d540d9f418cfbdc7bd55bb1")]
+public partial class Session
+{
+ [Column("user_id", TypeName = "character varying")]
+ public string UserId { get; set; } = null!;
+
+ [Key]
+ [Column("session_id", TypeName = "character varying")]
+ public string SessionId { get; set; } = null!;
+
+ [Column("activities")]
+ public string Activities { get; set; } = null!;
+
+ [Column("client_info")]
+ public string ClientInfo { get; set; } = null!;
+
+ [Column("status", TypeName = "character varying")]
+ public string Status { get; set; } = null!;
+
+ [Column("client_status")]
+ public string ClientStatus { get; set; } = null!;
+
+ [Column("is_admin_session")]
+ public bool IsAdminSession { get; set; }
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("last_seen", TypeName = "timestamp without time zone")]
+ public DateTime? LastSeen { get; set; }
+
+ [Column("last_seen_ip", TypeName = "character varying")]
+ public string? LastSeenIp { get; set; }
+
+ [Column("last_seen_location", TypeName = "character varying")]
+ public string? LastSeenLocation { get; set; }
+
+ [Column("last_seen_location_info")]
+ public string? LastSeenLocationInfo { get; set; }
+
+ [Column("session_nickname", TypeName = "character varying")]
+ public string? SessionNickname { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("Sessions")]
+ public virtual User User { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Sticker.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Sticker.cs
new file mode 100644
index 0000000..048d3a0
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Sticker.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("stickers")]
+public partial class Sticker
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("description", TypeName = "character varying")]
+ public string? Description { get; set; }
+
+ [Column("available")]
+ public bool? Available { get; set; }
+
+ [Column("tags", TypeName = "character varying")]
+ public string? Tags { get; set; }
+
+ [Column("pack_id", TypeName = "character varying")]
+ public string? PackId { get; set; }
+
+ [Column("guild_id", TypeName = "character varying")]
+ public string? GuildId { get; set; }
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("type")]
+ public int Type { get; set; }
+
+ [Column("format_type")]
+ public int FormatType { get; set; }
+
+ [ForeignKey("GuildId")]
+ [InverseProperty("Stickers")]
+ public virtual Guild? Guild { get; set; }
+
+ [ForeignKey("PackId")]
+ [InverseProperty("Stickers")]
+ public virtual StickerPack? Pack { get; set; }
+
+ [InverseProperty("CoverStickerId1Navigation")]
+ public virtual ICollection StickerPacks { get; set; } = new List();
+
+ [ForeignKey("UserId")]
+ [InverseProperty("Stickers")]
+ public virtual User? User { get; set; }
+
+ [ForeignKey("StickersId")]
+ [InverseProperty("Stickers")]
+ public virtual ICollection Messages { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/StickerPack.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/StickerPack.cs
new file mode 100644
index 0000000..96369f8
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/StickerPack.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("sticker_packs")]
+public partial class StickerPack
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("description", TypeName = "character varying")]
+ public string? Description { get; set; }
+
+ [Column("banner_asset_id", TypeName = "character varying")]
+ public string? BannerAssetId { get; set; }
+
+ [Column("cover_sticker_id", TypeName = "character varying")]
+ public string? CoverStickerId { get; set; }
+
+ [Column("coverStickerId", TypeName = "character varying")]
+ public string? CoverStickerId1 { get; set; }
+
+ [ForeignKey("CoverStickerId1")]
+ [InverseProperty("StickerPacks")]
+ public virtual Sticker? CoverStickerId1Navigation { get; set; }
+
+ [InverseProperty("Pack")]
+ public virtual ICollection Stickers { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Stream.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Stream.cs
new file mode 100644
index 0000000..db1b2cb
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Stream.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("streams")]
+public partial class Stream
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("owner_id", TypeName = "character varying")]
+ public string OwnerId { get; set; } = null!;
+
+ [Column("channel_id", TypeName = "character varying")]
+ public string ChannelId { get; set; } = null!;
+
+ [Column("endpoint", TypeName = "character varying")]
+ public string Endpoint { get; set; } = null!;
+
+ [ForeignKey("ChannelId")]
+ [InverseProperty("Streams")]
+ public virtual Channel Channel { get; set; } = null!;
+
+ [ForeignKey("OwnerId")]
+ [InverseProperty("Streams")]
+ public virtual User Owner { get; set; } = null!;
+
+ [InverseProperty("Stream")]
+ public virtual ICollection StreamSessions { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/StreamSession.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/StreamSession.cs
new file mode 100644
index 0000000..cbc64dc
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/StreamSession.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("stream_sessions")]
+public partial class StreamSession
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("stream_id", TypeName = "character varying")]
+ public string StreamId { get; set; } = null!;
+
+ [Column("user_id", TypeName = "character varying")]
+ public string UserId { get; set; } = null!;
+
+ [Column("token", TypeName = "character varying")]
+ public string? Token { get; set; }
+
+ [Column("session_id", TypeName = "character varying")]
+ public string SessionId { get; set; } = null!;
+
+ [Column("used")]
+ public bool Used { get; set; }
+
+ [ForeignKey("StreamId")]
+ [InverseProperty("StreamSessions")]
+ public virtual Stream Stream { get; set; } = null!;
+
+ [ForeignKey("UserId")]
+ [InverseProperty("StreamSessions")]
+ public virtual User User { get; set; } = null!;
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Team.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Team.cs
new file mode 100644
index 0000000..3443ad3
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Team.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("teams")]
+public partial class Team
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("icon", TypeName = "character varying")]
+ public string? Icon { get; set; }
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("owner_user_id", TypeName = "character varying")]
+ public string? OwnerUserId { get; set; }
+
+ [InverseProperty("Team")]
+ public virtual ICollection Applications { get; set; } = new List();
+
+ [ForeignKey("OwnerUserId")]
+ [InverseProperty("Teams")]
+ public virtual User? OwnerUser { get; set; }
+
+ [InverseProperty("Team")]
+ public virtual ICollection TeamMembers { get; set; } = new List();
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/TeamMember.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/TeamMember.cs
new file mode 100644
index 0000000..106ddee
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/TeamMember.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("team_members")]
+public partial class TeamMember
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("membership_state")]
+ public int MembershipState { get; set; }
+
+ [Column("permissions")]
+ public string Permissions { get; set; } = null!;
+
+ [Column("team_id", TypeName = "character varying")]
+ public string? TeamId { get; set; }
+
+ [Column("user_id", TypeName = "character varying")]
+ public string? UserId { get; set; }
+
+ [Column("role", TypeName = "character varying")]
+ public string Role { get; set; } = null!;
+
+ [ForeignKey("TeamId")]
+ [InverseProperty("TeamMembers")]
+ public virtual Team? Team { get; set; }
+
+ [ForeignKey("UserId")]
+ [InverseProperty("TeamMembers")]
+ public virtual User? User { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/Template.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/Template.cs
new file mode 100644
index 0000000..4c65ed9
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/Template.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("templates")]
+[Index("Code", Name = "UQ_be38737bf339baf63b1daeffb55", IsUnique = true)]
+public partial class Template
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("code", TypeName = "character varying")]
+ public string Code { get; set; } = null!;
+
+ [Column("name", TypeName = "character varying")]
+ public string Name { get; set; } = null!;
+
+ [Column("description", TypeName = "character varying")]
+ public string? Description { get; set; }
+
+ [Column("usage_count")]
+ public int? UsageCount { get; set; }
+
+ [Column("creator_id", TypeName = "character varying")]
+ public string? CreatorId { get; set; }
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("updated_at", TypeName = "timestamp without time zone")]
+ public DateTime UpdatedAt { get; set; }
+
+ [Column("source_guild_id", TypeName = "character varying")]
+ public string? SourceGuildId { get; set; }
+
+ [Column("serialized_source_guild")]
+ public string SerializedSourceGuild { get; set; } = null!;
+
+ [ForeignKey("CreatorId")]
+ [InverseProperty("Templates")]
+ public virtual User? Creator { get; set; }
+
+ [InverseProperty("Template")]
+ public virtual ICollection Guilds { get; set; } = new List();
+
+ [ForeignKey("SourceGuildId")]
+ [InverseProperty("Templates")]
+ public virtual Guild? SourceGuild { get; set; }
+}
diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs
new file mode 100644
index 0000000..242402b
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs
@@ -0,0 +1,234 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Spacebar.Models.Db.Models;
+
+[Table("users")]
+[Index("SettingsIndex", Name = "REL_0c14beb78d8c5ccba66072adbc", IsUnique = true)]
+public partial class User
+{
+ [Key]
+ [Column("id", TypeName = "character varying")]
+ public string Id { get; set; } = null!;
+
+ [Column("username", TypeName = "character varying")]
+ public string Username { get; set; } = null!;
+
+ [Column("discriminator", TypeName = "character varying")]
+ public string Discriminator { get; set; } = null!;
+
+ [Column("avatar", TypeName = "character varying")]
+ public string? Avatar { get; set; }
+
+ [Column("accent_color")]
+ public int? AccentColor { get; set; }
+
+ [Column("banner", TypeName = "character varying")]
+ public string? Banner { get; set; }
+
+ [Column("theme_colors")]
+ public string? ThemeColors { get; set; }
+
+ [Column("pronouns", TypeName = "character varying")]
+ public string? Pronouns { get; set; }
+
+ [Column("phone", TypeName = "character varying")]
+ public string? Phone { get; set; }
+
+ [Column("desktop")]
+ public bool Desktop { get; set; }
+
+ [Column("mobile")]
+ public bool Mobile { get; set; }
+
+ [Column("premium")]
+ public bool Premium { get; set; }
+
+ [Column("premium_type")]
+ public int PremiumType { get; set; }
+
+ [Column("bot")]
+ public bool Bot { get; set; }
+
+ [Column("bio", TypeName = "character varying")]
+ public string Bio { get; set; } = null!;
+
+ [Column("system")]
+ public bool System { get; set; }
+
+ [Column("nsfw_allowed")]
+ public bool NsfwAllowed { get; set; }
+
+ [Column("mfa_enabled")]
+ public bool MfaEnabled { get; set; }
+
+ [Column("totp_secret", TypeName = "character varying")]
+ public string? TotpSecret { get; set; }
+
+ [Column("totp_last_ticket", TypeName = "character varying")]
+ public string? TotpLastTicket { get; set; }
+
+ [Column("created_at", TypeName = "timestamp without time zone")]
+ public DateTime CreatedAt { get; set; }
+
+ [Column("premium_since", TypeName = "timestamp without time zone")]
+ public DateTime? PremiumSince { get; set; }
+
+ [Column("verified")]
+ public bool Verified { get; set; }
+
+ [Column("disabled")]
+ public bool Disabled { get; set; }
+
+ [Column("deleted")]
+ public bool Deleted { get; set; }
+
+ [Column("email", TypeName = "character varying")]
+ public string? Email { get; set; }
+
+ [Column("flags", TypeName = "character varying")]
+ public ulong Flags { get; set; }
+
+ [Column("public_flags")]
+ public ulong PublicFlags { get; set; }
+
+ [Column("purchased_flags")]
+ public long PurchasedFlags { get; set; }
+
+ [Column("premium_usage_flags")]
+ public int PremiumUsageFlags { get; set; }
+
+ [Column("rights")]
+ public ulong Rights { get; set; }
+
+ [Column("data")]
+ public string Data { get; set; } = null!;
+
+ [Column("fingerprints")]
+ public string Fingerprints { get; set; } = null!;
+
+ [Column("settingsIndex")]
+ public int? SettingsIndex { get; set; }
+
+ [Column("webauthn_enabled")]
+ public bool WebauthnEnabled { get; set; }
+
+ [Column("badge_ids")]
+ public string? BadgeIds { get; set; }
+
+ [InverseProperty("BotUser")]
+ public virtual Application? ApplicationBotUser { get; set; }
+
+ [InverseProperty("Owner")]
+ public virtual ICollection ApplicationOwners { get; set; } = new List();
+
+ [InverseProperty("Target")]
+ public virtual ICollection AuditLogTargets { get; set; } = new List();
+
+ [InverseProperty("User")]
+ public virtual ICollection AuditLogUsers { get; set; } = new List();
+
+ [InverseProperty("Creator")]
+ public virtual ICollection AutomodRules { get; set; } = new List();
+
+ [InverseProperty("User")]
+ public virtual ICollection BackupCodes { get; set; } = new List();
+
+ [InverseProperty("Executor")]
+ public virtual ICollection BanExecutors { get; set; } = new List();
+
+ [InverseProperty("User")]
+ public virtual ICollection BanUsers { get; set; } = new List