From e50319f22067e1e377a0aed23a73edc4cc4475de Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Wed, 23 Jul 2025 17:36:43 -0500 Subject: [PATCH] Filter & List Commands & Dependencies Added --- .../Contracts/IAllowConfigurationAccessor.cs | 4 +- .../Contracts/IChannelAccessor.cs | 8 +- .../IChannelConfigurationAccessor.cs | 4 +- .../Contracts/ICreatorAccessor.cs | 6 +- .../Contracts/ICreatorChannelAccessor.cs | 4 +- .../Contracts/IDropdownPayloadAccessor.cs | 2 +- src/CB.Accessors/Contracts/IGuildAccessor.cs | 6 +- .../Contracts/IGuildConfigurationAccessor.cs | 4 +- .../Contracts/IRoleConfigurationAccessor.cs | 4 +- src/CB.Accessors/Contracts/IUserAccessor.cs | 4 +- .../AllowConfigurationAccessor.cs | 4 +- .../Implementations/ChannelAccessor.cs | 14 +- .../ChannelConfigurationAccessor.cs | 4 +- .../Implementations/CreatorAccessor.cs | 6 +- .../Implementations/CreatorChannelAccessor.cs | 4 +- .../DropdownPayloadAccessor.cs | 2 +- .../Implementations/GuildAccessor.cs | 10 +- .../GuildConfigurationAccessor.cs | 4 +- .../RoleConfigurationAccessor.cs | 4 +- .../Implementations/UserAccessor.cs | 4 +- .../Application/ChannelSlashCommands.cs | 4 +- .../Application/ConfigurationSlashCommands.cs | 25 +- .../Application/DiscoverySlashCommands.cs | 2 +- .../Application/FilterSlashCommands.cs | 9 +- .../Commands/Application/ListSlashCommands.cs | 68 +- src/CB.Bot/Program.cs | 4 + src/CB.Data/CbContext.cs | 17 + src/CB.Data/Entities/Filter.cs | 4 +- .../20250717225501_7172025-554p.Designer.cs | 898 +++++++++++++++++ .../Migrations/20250717225501_7172025-554p.cs | 337 +++++++ .../20250717225700_7172025-556p.Designer.cs | 898 +++++++++++++++++ .../Migrations/20250717225700_7172025-556p.cs | 22 + .../20250717225843_7172025-558p.Designer.cs | 898 +++++++++++++++++ .../Migrations/20250717225843_7172025-558p.cs | 51 + .../20250718013457_7172025-834p.Designer.cs | 910 +++++++++++++++++ .../Migrations/20250718013457_7172025-834p.cs | 39 + .../20250718014125_7172025-841p.Designer.cs | 948 +++++++++++++++++ .../Migrations/20250718014125_7172025-841p.cs | 63 ++ .../20250718015544_7172025-855p.Designer.cs | 952 ++++++++++++++++++ .../Migrations/20250718015544_7172025-855p.cs | 69 ++ .../Migrations/CbContextModelSnapshot.cs | 482 +++++++++ .../Implementations/CreatorEngine.cs | 87 +- src/CB.Shared/Dtos/AllowConfigurationDto.cs | 2 +- src/CB.Shared/Dtos/CbProfile.cs | 2 + ...guration.cs => ChannelConfigurationDto.cs} | 10 +- .../Dtos/ChannelConfigurationSummaryDto.cs | 17 + src/CB.Shared/Dtos/ChannelDto.cs | 1 - src/CB.Shared/Dtos/ClipEmbedDto.cs | 2 +- .../Dtos/DiscordLiveConfigurationDto.cs | 2 +- src/CB.Shared/Dtos/FilterDto.cs | 6 +- ...figuration.cs => GuildConfigurationDto.cs} | 2 +- .../Dtos/GuildConfigurationSummaryDto.cs | 28 + src/CB.Shared/Dtos/LiveEmbedDto.cs | 2 +- src/CB.Shared/Dtos/MessageConfigurationDto.cs | 2 +- src/CB.Shared/Dtos/RoleConfigurationDto.cs | 2 +- src/CB.Shared/Dtos/VodEmbedDto.cs | 2 +- src/CB.Shared/Enums/Platform.cs | 6 +- .../Models/Twitch/TwitchGameChannel.cs | 4 +- 58 files changed, 6808 insertions(+), 171 deletions(-) create mode 100644 src/CB.Data/Migrations/20250717225501_7172025-554p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250717225501_7172025-554p.cs create mode 100644 src/CB.Data/Migrations/20250717225700_7172025-556p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250717225700_7172025-556p.cs create mode 100644 src/CB.Data/Migrations/20250717225843_7172025-558p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250717225843_7172025-558p.cs create mode 100644 src/CB.Data/Migrations/20250718013457_7172025-834p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250718013457_7172025-834p.cs create mode 100644 src/CB.Data/Migrations/20250718014125_7172025-841p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250718014125_7172025-841p.cs create mode 100644 src/CB.Data/Migrations/20250718015544_7172025-855p.Designer.cs create mode 100644 src/CB.Data/Migrations/20250718015544_7172025-855p.cs rename src/CB.Shared/Dtos/{ChannelConfiguration.cs => ChannelConfigurationDto.cs} (51%) create mode 100644 src/CB.Shared/Dtos/ChannelConfigurationSummaryDto.cs rename src/CB.Shared/Dtos/{GuildConfiguration.cs => GuildConfigurationDto.cs} (79%) create mode 100644 src/CB.Shared/Dtos/GuildConfigurationSummaryDto.cs diff --git a/src/CB.Accessors/Contracts/IAllowConfigurationAccessor.cs b/src/CB.Accessors/Contracts/IAllowConfigurationAccessor.cs index bdae907..aa7d835 100644 --- a/src/CB.Accessors/Contracts/IAllowConfigurationAccessor.cs +++ b/src/CB.Accessors/Contracts/IAllowConfigurationAccessor.cs @@ -7,11 +7,11 @@ public interface IAllowConfigurationAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); Task CreateAsync(AllowConfiguration entity); - Task UpdateAsync(AllowConfigurationDto entity); + Task UpdateAsync(AllowConfigurationDto entity); Task DeleteAsync(string id); } \ No newline at end of file diff --git a/src/CB.Accessors/Contracts/IChannelAccessor.cs b/src/CB.Accessors/Contracts/IChannelAccessor.cs index 58dceca..81b9160 100644 --- a/src/CB.Accessors/Contracts/IChannelAccessor.cs +++ b/src/CB.Accessors/Contracts/IChannelAccessor.cs @@ -7,11 +7,13 @@ public interface IChannelAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); - Task CreateAsync(Channel entity); + Task GetChannelConfigurationSummaryByIdAsync(string id); - Task UpdateAsync(ChannelDto entity); + Task CreateAsync(Channel entity); + + Task UpdateAsync(ChannelDto entity); Task DeleteAsync(string id); } \ No newline at end of file diff --git a/src/CB.Accessors/Contracts/IChannelConfigurationAccessor.cs b/src/CB.Accessors/Contracts/IChannelConfigurationAccessor.cs index 9534bc2..548a991 100644 --- a/src/CB.Accessors/Contracts/IChannelConfigurationAccessor.cs +++ b/src/CB.Accessors/Contracts/IChannelConfigurationAccessor.cs @@ -7,11 +7,11 @@ public interface IChannelConfigurationAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); Task CreateAsync(ChannelConfiguration entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, ChannelConfigurationDto dto); Task DeleteAsync(string id); diff --git a/src/CB.Accessors/Contracts/ICreatorAccessor.cs b/src/CB.Accessors/Contracts/ICreatorAccessor.cs index 9ca1d9a..974546f 100644 --- a/src/CB.Accessors/Contracts/ICreatorAccessor.cs +++ b/src/CB.Accessors/Contracts/ICreatorAccessor.cs @@ -9,13 +9,13 @@ public interface ICreatorAccessor { Task> GetAllAsync(); - Task GetByIdAsync(long id); + Task GetByIdAsync(long id); - Task GetByChannelIdAndPlatformAsync(string channelId, Platform platform); + Task GetByChannelIdAndPlatformAsync(string channelId, Platform platform); Task CreateAsync(Creator entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, Creator entity); Task DeleteAsync(string id); diff --git a/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs b/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs index 06770bd..91ee170 100644 --- a/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs +++ b/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs @@ -9,13 +9,13 @@ public interface ICreatorChannelAccessor { Task> GetAllAsync(); - Task GetAsync(long creatorId, + Task GetAsync(long creatorId, string channelId, int channelTypeId); Task CreateAsync(CreatorChannel entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, CreatorChannelDto entity); Task DeleteAsync(long creatorId, diff --git a/src/CB.Accessors/Contracts/IDropdownPayloadAccessor.cs b/src/CB.Accessors/Contracts/IDropdownPayloadAccessor.cs index 98bfde7..623b928 100644 --- a/src/CB.Accessors/Contracts/IDropdownPayloadAccessor.cs +++ b/src/CB.Accessors/Contracts/IDropdownPayloadAccessor.cs @@ -7,7 +7,7 @@ public interface IDropdownPayloadAccessor { Task> GetAllAsync(); - Task GetByIdAsync(int id); + Task GetByIdAsync(int id); Task CreateAsync(DropdownPayload entity); diff --git a/src/CB.Accessors/Contracts/IGuildAccessor.cs b/src/CB.Accessors/Contracts/IGuildAccessor.cs index 4cf8059..95632ad 100644 --- a/src/CB.Accessors/Contracts/IGuildAccessor.cs +++ b/src/CB.Accessors/Contracts/IGuildAccessor.cs @@ -7,11 +7,13 @@ public interface IGuildAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); + + Task GetConfigurationSummaryByIdAsync(string id); Task CreateAsync(Guild entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, Guild entity); Task DeleteAsync(string id); diff --git a/src/CB.Accessors/Contracts/IGuildConfigurationAccessor.cs b/src/CB.Accessors/Contracts/IGuildConfigurationAccessor.cs index a216bbd..5f2a51f 100644 --- a/src/CB.Accessors/Contracts/IGuildConfigurationAccessor.cs +++ b/src/CB.Accessors/Contracts/IGuildConfigurationAccessor.cs @@ -7,11 +7,11 @@ public interface IGuildConfigurationAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); Task CreateAsync(GuildConfiguration entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, GuildConfigurationDto entity); Task DeleteAsync(string id); diff --git a/src/CB.Accessors/Contracts/IRoleConfigurationAccessor.cs b/src/CB.Accessors/Contracts/IRoleConfigurationAccessor.cs index aa66c7d..86b1f8d 100644 --- a/src/CB.Accessors/Contracts/IRoleConfigurationAccessor.cs +++ b/src/CB.Accessors/Contracts/IRoleConfigurationAccessor.cs @@ -7,11 +7,11 @@ public interface IRoleConfigurationAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); Task CreateAsync(RoleConfiguration entity); - Task UpdateAsync(RoleConfigurationDto entity); + Task UpdateAsync(RoleConfigurationDto entity); Task DeleteAsync(string id); } \ No newline at end of file diff --git a/src/CB.Accessors/Contracts/IUserAccessor.cs b/src/CB.Accessors/Contracts/IUserAccessor.cs index 9e79b2f..7086a61 100644 --- a/src/CB.Accessors/Contracts/IUserAccessor.cs +++ b/src/CB.Accessors/Contracts/IUserAccessor.cs @@ -7,11 +7,11 @@ public interface IUserAccessor { Task> GetAllAsync(); - Task GetByIdAsync(string id); + Task GetByIdAsync(string id); Task CreateAsync(User entity); - Task UpdateAsync(string id, + Task UpdateAsync(string id, User entity); Task DeleteAsync(string id); diff --git a/src/CB.Accessors/Implementations/AllowConfigurationAccessor.cs b/src/CB.Accessors/Implementations/AllowConfigurationAccessor.cs index 044c338..ac2565a 100644 --- a/src/CB.Accessors/Implementations/AllowConfigurationAccessor.cs +++ b/src/CB.Accessors/Implementations/AllowConfigurationAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.AllowConfigurations + public Task GetByIdAsync(string id) => context.AllowConfigurations .AsNoTracking() .Where(g => g.GuildId == id) .ProjectTo(mapper.ConfigurationProvider) @@ -34,7 +34,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(AllowConfigurationDto updated) + public async Task UpdateAsync(AllowConfigurationDto updated) { var allowConfiguration = await context .AllowConfigurations diff --git a/src/CB.Accessors/Implementations/ChannelAccessor.cs b/src/CB.Accessors/Implementations/ChannelAccessor.cs index 7704e5c..6f588d0 100644 --- a/src/CB.Accessors/Implementations/ChannelAccessor.cs +++ b/src/CB.Accessors/Implementations/ChannelAccessor.cs @@ -18,13 +18,19 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.Channels + public Task GetByIdAsync(string id) => context.Channels .AsNoTracking() .Where(g => g.Id == id) .ProjectTo(mapper.ConfigurationProvider) .FirstOrDefaultAsync(); - public async Task CreateAsync(Channel entity) + public Task GetChannelConfigurationSummaryByIdAsync(string id) => context.Channels + .AsNoTracking() + .Where(g => g.Id == id) + .ProjectTo(mapper.ConfigurationProvider) + .FirstOrDefaultAsync(); + + public async Task CreateAsync(Channel entity) { entity.CreatedDate = DateTime.UtcNow; entity.ModifiedDate = DateTime.UtcNow; @@ -34,10 +40,10 @@ await context .SaveChangesAsync() .ConfigureAwait(false); - return mapper.Map(entity); + return mapper.Map(entity); } - public async Task UpdateAsync(ChannelDto updated) + public async Task UpdateAsync(ChannelDto updated) { var channel = await context .Channels diff --git a/src/CB.Accessors/Implementations/ChannelConfigurationAccessor.cs b/src/CB.Accessors/Implementations/ChannelConfigurationAccessor.cs index 7cefbc5..9b2e4cf 100644 --- a/src/CB.Accessors/Implementations/ChannelConfigurationAccessor.cs +++ b/src/CB.Accessors/Implementations/ChannelConfigurationAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.ChannelConfigurations + public Task GetByIdAsync(string id) => context.ChannelConfigurations .AsNoTracking() .Where(g => g.GuildId == id) .ProjectTo(mapper.ConfigurationProvider) @@ -34,7 +34,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, ChannelConfigurationDto dto) { var channelConfiguration = await context diff --git a/src/CB.Accessors/Implementations/CreatorAccessor.cs b/src/CB.Accessors/Implementations/CreatorAccessor.cs index 40f7160..1d7a4d1 100644 --- a/src/CB.Accessors/Implementations/CreatorAccessor.cs +++ b/src/CB.Accessors/Implementations/CreatorAccessor.cs @@ -20,13 +20,13 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(long id) => context.Creators + public Task GetByIdAsync(long id) => context.Creators .AsNoTracking() .Where(g => g.Id == id) .ProjectTo(mapper.ConfigurationProvider) .FirstOrDefaultAsync(); - public Task GetByChannelIdAndPlatformAsync(string channelId, Platform platform) => context.Creators + public Task GetByChannelIdAndPlatformAsync(string channelId, Platform platform) => context.Creators .AsNoTracking() .Where(g => g.ChannelId == channelId && g.PlatformId == (int)platform) @@ -46,7 +46,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, Creator updated) { var creator = await context diff --git a/src/CB.Accessors/Implementations/CreatorChannelAccessor.cs b/src/CB.Accessors/Implementations/CreatorChannelAccessor.cs index feeb299..4fa11fa 100644 --- a/src/CB.Accessors/Implementations/CreatorChannelAccessor.cs +++ b/src/CB.Accessors/Implementations/CreatorChannelAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetAsync(long creatorId, + public Task GetAsync(long creatorId, string channelId, int channelTypeId) => context.CreatorChannels .AsNoTracking() @@ -38,7 +38,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, CreatorChannelDto updated) { var creatorChannel = await context diff --git a/src/CB.Accessors/Implementations/DropdownPayloadAccessor.cs b/src/CB.Accessors/Implementations/DropdownPayloadAccessor.cs index d3f19e5..b341438 100644 --- a/src/CB.Accessors/Implementations/DropdownPayloadAccessor.cs +++ b/src/CB.Accessors/Implementations/DropdownPayloadAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(int id) => context.DropdownPayloads + public Task GetByIdAsync(int id) => context.DropdownPayloads .AsNoTracking() .Where(g => g.Id == id) .ProjectTo(mapper.ConfigurationProvider) diff --git a/src/CB.Accessors/Implementations/GuildAccessor.cs b/src/CB.Accessors/Implementations/GuildAccessor.cs index adb996a..b5f1eb5 100644 --- a/src/CB.Accessors/Implementations/GuildAccessor.cs +++ b/src/CB.Accessors/Implementations/GuildAccessor.cs @@ -18,12 +18,18 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.Guilds + public Task GetByIdAsync(string id) => context.Guilds .AsNoTracking() .Where(g => g.Id == id) .ProjectTo(mapper.ConfigurationProvider) .FirstOrDefaultAsync(); + public Task GetConfigurationSummaryByIdAsync(string id) => context.Guilds + .AsNoTracking() + .Where(g => g.Id == id) + .ProjectTo(mapper.ConfigurationProvider) + .FirstOrDefaultAsync(); + public async Task CreateAsync(Guild entity) { entity.CreatedDate = DateTime.UtcNow; @@ -37,7 +43,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, Guild updated) { var guild = await context diff --git a/src/CB.Accessors/Implementations/GuildConfigurationAccessor.cs b/src/CB.Accessors/Implementations/GuildConfigurationAccessor.cs index fb4a119..6f54652 100644 --- a/src/CB.Accessors/Implementations/GuildConfigurationAccessor.cs +++ b/src/CB.Accessors/Implementations/GuildConfigurationAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.GuildConfigurations + public Task GetByIdAsync(string id) => context.GuildConfigurations .AsNoTracking() .Where(g => g.GuildId == id) .ProjectTo(mapper.ConfigurationProvider) @@ -34,7 +34,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, GuildConfigurationDto updated) { var guildConfiguration = await context diff --git a/src/CB.Accessors/Implementations/RoleConfigurationAccessor.cs b/src/CB.Accessors/Implementations/RoleConfigurationAccessor.cs index 081f21d..68673c8 100644 --- a/src/CB.Accessors/Implementations/RoleConfigurationAccessor.cs +++ b/src/CB.Accessors/Implementations/RoleConfigurationAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.RoleConfigurations + public Task GetByIdAsync(string id) => context.RoleConfigurations .AsNoTracking() .Where(g => g.GuildId == id) .ProjectTo(mapper.ConfigurationProvider) @@ -34,7 +34,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(RoleConfigurationDto updated) + public async Task UpdateAsync(RoleConfigurationDto updated) { var roleConfiguration = await context .RoleConfigurations diff --git a/src/CB.Accessors/Implementations/UserAccessor.cs b/src/CB.Accessors/Implementations/UserAccessor.cs index 7d6d8ae..9d3ebad 100644 --- a/src/CB.Accessors/Implementations/UserAccessor.cs +++ b/src/CB.Accessors/Implementations/UserAccessor.cs @@ -18,7 +18,7 @@ public Task> GetAllAsync() => context .ProjectTo(mapper.ConfigurationProvider) .ToListAsync(); - public Task GetByIdAsync(string id) => context.Users + public Task GetByIdAsync(string id) => context.Users .AsNoTracking() .Where(g => g.Id == id) .ProjectTo(mapper.ConfigurationProvider) @@ -37,7 +37,7 @@ await context return mapper.Map(entity); } - public async Task UpdateAsync(string id, + public async Task UpdateAsync(string id, User updated) { var user = await context diff --git a/src/CB.Bot/Commands/Application/ChannelSlashCommands.cs b/src/CB.Bot/Commands/Application/ChannelSlashCommands.cs index 7a8be46..99b3090 100644 --- a/src/CB.Bot/Commands/Application/ChannelSlashCommands.cs +++ b/src/CB.Bot/Commands/Application/ChannelSlashCommands.cs @@ -69,7 +69,7 @@ await SocketInteraction } var guild = await guildAccessor - .GetByIdAsync(Context.Guild.Id.ToString()) + .GetConfigurationSummaryByIdAsync(Context.Guild.Id.ToString()) .ConfigureAwait(false); if (guild == null) @@ -79,7 +79,7 @@ await FollowupAsync("There was an issue retrieving your guild. Contact support." return; } - var existingChannel = await channelAccessor.GetByIdAsync(discordChannel.Id.ToString()).ConfigureAwait(false) + var existingChannel = await channelAccessor.GetChannelConfigurationSummaryByIdAsync(discordChannel.Id.ToString()).ConfigureAwait(false) ?? await channelAccessor.CreateAsync(new() { CreatedDate = DateTime.UtcNow, diff --git a/src/CB.Bot/Commands/Application/ConfigurationSlashCommands.cs b/src/CB.Bot/Commands/Application/ConfigurationSlashCommands.cs index 86b078a..317c5f5 100644 --- a/src/CB.Bot/Commands/Application/ConfigurationSlashCommands.cs +++ b/src/CB.Bot/Commands/Application/ConfigurationSlashCommands.cs @@ -33,7 +33,7 @@ private async Task AllowConfigurationAsync() } var guild = await guildAccessor - .GetByIdAsync(Context.Guild.Id.ToString()) + .GetConfigurationSummaryByIdAsync(Context.Guild.Id.ToString()) .ConfigureAwait(false); if (guild == null) @@ -128,13 +128,13 @@ private async Task ConfigurationAsync() return; } - var guild = await guildAccessor.GetByIdAsync(Context.Guild.Id.ToString()).ConfigureAwait(false); + var guild = await guildAccessor.GetConfigurationSummaryByIdAsync(Context.Guild.Id.ToString()).ConfigureAwait(false); var builder = new EmbedBuilder(); var authorBuilder = new EmbedAuthorBuilder(); var footerBuilder = new EmbedFooterBuilder(); - await BuildEmbed(builder, authorBuilder, footerBuilder, Context.Guild).ConfigureAwait(false); + await BuildEmbed(builder, authorBuilder, footerBuilder).ConfigureAwait(false); PopulateEmbedFields(builder, guild); await SocketInteraction.FollowupAsync(embed: builder.Build()).ConfigureAwait(false); } @@ -142,22 +142,22 @@ private async Task ConfigurationAsync() private async Task BuildEmbed( EmbedBuilder builder, EmbedAuthorBuilder authorBuilder, - EmbedFooterBuilder footerBuilder, - IGuild guild) + EmbedFooterBuilder footerBuilder) { authorBuilder.IconUrl = discordSocketClient.CurrentUser.GetAvatarUrl(); authorBuilder.Name = discordSocketClient.CurrentUser.Username; authorBuilder.Url = "https://couch.bot"; footerBuilder.IconUrl = discordSocketClient.CurrentUser.GetAvatarUrl(); - footerBuilder.Text = $"{guild.Name} Configuration • Established by {(await guild.GetOwnerAsync().ConfigureAwait(false)).Username} on {guild.CreatedAt:d}"; + footerBuilder.Text = $"{Context.Guild.Name} Configuration • Established by {(await Context.Guild.GetOwnerAsync().ConfigureAwait(false)).Username} on {Context.Guild.CreatedAt:d}"; builder.Author = authorBuilder; builder.Footer = footerBuilder; builder.Color = new Color(88, 101, 242); } - private void PopulateEmbedFields(EmbedBuilder builder, GuildDto guild) + private void PopulateEmbedFields(EmbedBuilder builder, + GuildConfigurationSummaryDto guild) { builder.AddField("Allows", GetAllowConfigurationString(guild, 0), true); @@ -183,7 +183,8 @@ private void PopulateEmbedFields(EmbedBuilder builder, GuildDto guild) builder.AddField("Messages", GetMessageConfigurationString(guild)); } - private string GetAllowConfigurationString(GuildDto guild, int section) + private string GetAllowConfigurationString(GuildConfigurationSummaryDto guild, + int section) { var strBuilder = new StringBuilder(); @@ -214,7 +215,7 @@ private string GetAllowConfigurationString(GuildDto guild, int section) return strBuilder.ToString(); } - private string GetChannelConfigurationString(GuildDto guild) + private string GetChannelConfigurationString(GuildConfigurationSummaryDto guild) { var strBuilder = new StringBuilder(); @@ -241,7 +242,7 @@ private string GetChannelConfigurationString(GuildDto guild) return strBuilder.ToString(); } - private string GetServerConfigurationString(GuildDto guild) + private string GetServerConfigurationString(GuildConfigurationSummaryDto guild) { var strBuilder = new StringBuilder(); @@ -254,7 +255,7 @@ private string GetServerConfigurationString(GuildDto guild) return strBuilder.ToString(); } - private string GetRoleConfigurationString(GuildDto guild) + private string GetRoleConfigurationString(GuildConfigurationSummaryDto guild) { var strBuilder = new StringBuilder(); @@ -276,7 +277,7 @@ private string GetRoleConfigurationString(GuildDto guild) return strBuilder.ToString(); } - private string GetMessageConfigurationString(GuildDto guild) + private string GetMessageConfigurationString(GuildConfigurationSummaryDto guild) { var strBuilder = new StringBuilder(); diff --git a/src/CB.Bot/Commands/Application/DiscoverySlashCommands.cs b/src/CB.Bot/Commands/Application/DiscoverySlashCommands.cs index b496f5d..f2c4295 100644 --- a/src/CB.Bot/Commands/Application/DiscoverySlashCommands.cs +++ b/src/CB.Bot/Commands/Application/DiscoverySlashCommands.cs @@ -43,7 +43,7 @@ private async Task DoStuff(bool isEnabled, } var guildChannel = (IGuildChannel)SocketInteraction.Channel; - var guild = await guildAccessor.GetByIdAsync(guildChannel.Guild.Id.ToString()); + var guild = await guildAccessor.GetConfigurationSummaryByIdAsync(guildChannel.Guild.Id.ToString()); if (guild == null) { await SocketInteraction.FollowupAsync( diff --git a/src/CB.Bot/Commands/Application/FilterSlashCommands.cs b/src/CB.Bot/Commands/Application/FilterSlashCommands.cs index 7449973..0703a6c 100644 --- a/src/CB.Bot/Commands/Application/FilterSlashCommands.cs +++ b/src/CB.Bot/Commands/Application/FilterSlashCommands.cs @@ -9,8 +9,7 @@ namespace CB.Bot.Commands.Application; -public class FilterSlashCommands(IGuildAccessor guildAccessor, - IFilterAccessor filterAccessor) +public class FilterSlashCommands(IFilterAccessor filterAccessor) : BaseSlashCommands { [SlashCommand( @@ -29,9 +28,9 @@ private async Task ToggleFilter(string filterText, return; } + var t = (int)platform; filterText = filterText.TrimStart('"').TrimEnd('"'); - var guild = await guildAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); - var existingFilters = await filterAccessor.GetAllAsync(guild?.Id); + var existingFilters = await filterAccessor.GetAllAsync(SocketInteraction.GuildId.ToString()); var existingFilter = existingFilters.FirstOrDefault( x => x.PlatformId == (int)platform && x.FilterTypeId == (int)filterType && @@ -44,7 +43,7 @@ await filterAccessor.CreateAsync(new Filter Text = filterText, PlatformId = (int)platform, FilterTypeId = (int)filterType, - GuildId = guild?.Id.ToString() + GuildId = SocketInteraction.GuildId.ToString() }); await SocketInteraction.FollowupAsync($"{filterType} filter has been created."); diff --git a/src/CB.Bot/Commands/Application/ListSlashCommands.cs b/src/CB.Bot/Commands/Application/ListSlashCommands.cs index 4a780a5..1dc323b 100644 --- a/src/CB.Bot/Commands/Application/ListSlashCommands.cs +++ b/src/CB.Bot/Commands/Application/ListSlashCommands.cs @@ -38,7 +38,7 @@ private async Task ListGamesAsync(int page = 1, return; } - await ProcessGameList(page, channel?.Id.ToString(), Context.Guild, SocketInteraction); + await ProcessGameList(page, channel?.Id.ToString()); } /// @@ -60,7 +60,7 @@ private async Task ListTeamsAsync(int page = 1, return; } - await ProcessTeamList(page, channel?.Id.ToString(), Context.Guild, SocketInteraction); + await ProcessTeamList(page, channel?.Id.ToString()); } /// @@ -82,7 +82,7 @@ private async Task ListCreatorsAsync(int page = 1, return; } - await ProcessCreatorList(page, channel?.Id.ToString(), Context.Guild, SocketInteraction); + await ProcessCreatorList(page, channel?.Id.ToString()); } /// @@ -103,23 +103,20 @@ private async Task ListFiltersAsync(int page = 1) return; } - await ProcessFilterList(page, Context.Guild, SocketInteraction); + await ProcessFilterList(page); } - private async Task ProcessCreatorList( - long page, - string channelId, - IGuild discordGuild, - SocketInteraction socketInteraction) + private async Task ProcessCreatorList(long page, + string channelId) { - var guildCreators = await guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); + var guildCreators = await guildAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); var creators = new List(); if (string.IsNullOrWhiteSpace(channelId)) { guildCreators?.Channels.ToList().ForEach(async x => { - await ValidateChannelDisplayName(socketInteraction, x); + await ValidateChannelDisplayName(x); creators.AddRange(x.CreatorChannels.Select(y => y.Creator).Select(creator => new ListViewModel { DisplayName = creator.DisplayName, @@ -133,7 +130,7 @@ private async Task ProcessCreatorList( { guildCreators?.Channels.Where(x => x.Id.Equals(channelId)).ToList().ForEach(x => { - ValidateChannelDisplayName(socketInteraction, x).GetAwaiter().GetResult(); + ValidateChannelDisplayName(x).GetAwaiter().GetResult(); creators.AddRange(x.CreatorChannels.Select(y=>y.Creator).Select(creator => new ListViewModel { DisplayName = creator.DisplayName, @@ -203,16 +200,12 @@ private async Task ProcessCreatorList( } builder.Description = creators.Count == 0 ? "It doesn't look like you are announcing any creators." : strBuilder.ToString(); - await socketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); + await SocketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); } - private async Task ProcessFilterList( - long page, - IGuild discordGuild, - SocketInteraction socketInteraction) + private async Task ProcessFilterList(long page) { - var guild = await guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); - var filters = await filterAccessor.GetAllAsync(guild.Id); + var filters = await filterAccessor.GetAllAsync(SocketInteraction.GuildId.ToString()); var builder = new EmbedBuilder(); var authorBuilder = new EmbedAuthorBuilder(); @@ -271,16 +264,13 @@ private async Task ProcessFilterList( ) ); - await socketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); + await SocketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); } - private async Task ProcessGameList( - long page, - string channelId, - IGuild discordGuild, - SocketInteraction socketInteraction) + private async Task ProcessGameList(long page, + string channelId) { - var guildCreators = await guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); + var guildCreators = await guildAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); var builder = new EmbedBuilder(); var authorBuilder = new EmbedAuthorBuilder(); @@ -292,7 +282,7 @@ private async Task ProcessGameList( { guildCreators?.Channels.ToList().ForEach(async x => { - await ValidateChannelDisplayName(socketInteraction, x); + await ValidateChannelDisplayName(x); games.AddRange(x.GameChannels.Select(y => y.Game).Select(game => new ListViewModel { DisplayName = game.DisplayName, @@ -304,7 +294,7 @@ private async Task ProcessGameList( { guildCreators?.Channels.Where(x => x.Id.Equals(channelId)).ToList().ForEach(x => { - ValidateChannelDisplayName(socketInteraction, x).GetAwaiter().GetResult(); + ValidateChannelDisplayName(x).GetAwaiter().GetResult(); games.AddRange(x.GameChannels.Select(y => y.Game).Select(game => new ListViewModel { DisplayName = game.DisplayName, @@ -348,15 +338,14 @@ private async Task ProcessGameList( builder.Description = totalGames == 0 ? "It doesn't look like you are announcing any games." : string.Join("\r\n", gamesToDisplay.Select(x => $"<:twitch:844040506056376321> {x.DisplayName} - #{x.ChannelName}")); - await socketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); + await SocketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); } - private async Task ValidateChannelDisplayName(SocketInteraction socketInteraction, - ChannelDto x) + private async Task ValidateChannelDisplayName(ChannelDto x) { if (string.IsNullOrEmpty(x.DisplayName)) { - var guild = discordSocketClient.GetGuild(socketInteraction.GuildId.Value); + var guild = discordSocketClient.GetGuild(SocketInteraction.GuildId.Value); var channel = guild.GetChannel(ulong.Parse(x.Id)); x.DisplayName = channel.Name; x.ModifiedDate = DateTime.UtcNow; @@ -364,13 +353,10 @@ private async Task ValidateChannelDisplayName(SocketInteraction socketInteractio } } - private async Task ProcessTeamList( - long page, - string channelId, - IGuild discordGuild, - SocketInteraction socketInteraction) + private async Task ProcessTeamList(long page, + string channelId) { - var guildCreators = await guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); + var guildCreators = await guildAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); var builder = new EmbedBuilder(); var authorBuilder = new EmbedAuthorBuilder(); @@ -381,7 +367,7 @@ private async Task ProcessTeamList( { guildCreators?.Channels.ToList().ForEach(async x => { - await ValidateChannelDisplayName(socketInteraction, x); + await ValidateChannelDisplayName(x); teams.AddRange(x.TeamChannels.Select(y => y.Team).Select(team => new ListViewModel { DisplayName = team.DisplayName, @@ -393,7 +379,7 @@ private async Task ProcessTeamList( { guildCreators?.Channels.Where(x => x.Id.Equals(channelId)).ToList().ForEach(x => { - ValidateChannelDisplayName(socketInteraction, x).GetAwaiter().GetResult(); + ValidateChannelDisplayName(x).GetAwaiter().GetResult(); teams.AddRange(x.TeamChannels.Select(y => y.Team).Select(team => new ListViewModel { DisplayName = team.DisplayName, @@ -437,6 +423,6 @@ private async Task ProcessTeamList( builder.Description = totalTeams == 0 ? "It doesn't look like you are announcing any teams." : string.Join("\r\n", teamsToDisplay.Select(x => $"<:twitch:844040506056376321> {x.DisplayName} - #{x.ChannelName}")); - await socketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); + await SocketInteraction.FollowupAsync(embed: builder.Build(), ephemeral: true); } } \ No newline at end of file diff --git a/src/CB.Bot/Program.cs b/src/CB.Bot/Program.cs index 57dc870..417a373 100644 --- a/src/CB.Bot/Program.cs +++ b/src/CB.Bot/Program.cs @@ -38,6 +38,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -45,7 +46,10 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/src/CB.Data/CbContext.cs b/src/CB.Data/CbContext.cs index e4d42a4..9bc950a 100644 --- a/src/CB.Data/CbContext.cs +++ b/src/CB.Data/CbContext.cs @@ -107,6 +107,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasForeignKey(x => x.UserId) .OnDelete(DeleteBehavior.NoAction); + // Configure FilterType table + modelBuilder.Entity().HasData( + new FilterType { Id = 1, DisplayName = "Game" }, + new FilterType { Id = 2, DisplayName = "Title" } + ); + // Configure GameChannels table modelBuilder.Entity() .HasKey(cc => new { cc.GameId, cc.ChannelId }); @@ -215,6 +221,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) // Configure MessageConfiguration table modelBuilder.Entity().ToTable("MessageConfigurations"); + // Configure Platform table + modelBuilder.Entity().HasData( + new Platform { Id = 1, DisplayName = "All" }, + new Platform { Id = 3, DisplayName = "Picarto" }, + new Platform { Id = 4, DisplayName = "Piczel" }, + new Platform { Id = 6, DisplayName = "Twitch" }, + new Platform { Id = 7, DisplayName = "YouTube" }, + new Platform { Id = 10, DisplayName = "Trovo" }, + new Platform { Id = 13, DisplayName = "DLive" } + ); + // Configure RoleConfiguration table modelBuilder.Entity().ToTable("RoleConfigurations"); diff --git a/src/CB.Data/Entities/Filter.cs b/src/CB.Data/Entities/Filter.cs index 1869079..06609fb 100644 --- a/src/CB.Data/Entities/Filter.cs +++ b/src/CB.Data/Entities/Filter.cs @@ -4,11 +4,11 @@ public class Filter { public int Id { get; set; } public string Text { get; set; } - public int PlatformId { get; set; } + public int? PlatformId { get; set; } public int FilterTypeId { get; set; } public string GuildId { get; set; } - public Platform Platform { get; set; } + public Platform? Platform { get; set; } public FilterType FilterType { get; set; } public Guild Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Data/Migrations/20250717225501_7172025-554p.Designer.cs b/src/CB.Data/Migrations/20250717225501_7172025-554p.Designer.cs new file mode 100644 index 0000000..977440c --- /dev/null +++ b/src/CB.Data/Migrations/20250717225501_7172025-554p.Designer.cs @@ -0,0 +1,898 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250717225501_7172025-554p")] + partial class _7172025554p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250717225501_7172025-554p.cs b/src/CB.Data/Migrations/20250717225501_7172025-554p.cs new file mode 100644 index 0000000..bdd7a51 --- /dev/null +++ b/src/CB.Data/Migrations/20250717225501_7172025-554p.cs @@ -0,0 +1,337 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025554p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ClipEmbeds", + columns: table => new + { + GuildId = table.Column(type: "text", nullable: false), + Header = table.Column(type: "text", nullable: true), + Description = table.Column(type: "text", nullable: true), + Footer = table.Column(type: "text", nullable: true), + WatchButton = table.Column(type: "text", nullable: true), + MoreButton = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ClipEmbeds", x => x.GuildId); + table.ForeignKey( + name: "FK_ClipEmbeds_Guilds_GuildId", + column: x => x.GuildId, + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DiscordLiveConfigurations", + columns: table => new + { + GuildId = table.Column(type: "text", nullable: false), + Message = table.Column(type: "text", nullable: true), + Header = table.Column(type: "text", nullable: true), + Description = table.Column(type: "text", nullable: true), + Footer = table.Column(type: "text", nullable: true), + MentionRoleId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DiscordLiveConfigurations", x => x.GuildId); + table.ForeignKey( + name: "FK_DiscordLiveConfigurations_Guilds_GuildId", + column: x => x.GuildId, + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FilterType", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DisplayName = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterType", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "LiveEmbeds", + columns: table => new + { + GuildId = table.Column(type: "text", nullable: false), + Header = table.Column(type: "text", nullable: true), + Description = table.Column(type: "text", nullable: true), + LastStreamed = table.Column(type: "text", nullable: true), + AverageStream = table.Column(type: "text", nullable: true), + DescriptionLabel = table.Column(type: "text", nullable: true), + StreamDescription = table.Column(type: "text", nullable: true), + FooterStart = table.Column(type: "text", nullable: true), + FooterStopped = table.Column(type: "text", nullable: true), + ChannelButton = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_LiveEmbeds", x => x.GuildId); + table.ForeignKey( + name: "FK_LiveEmbeds_Guilds_GuildId", + column: x => x.GuildId, + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Platform", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DisplayName = table.Column(type: "text", nullable: true), + SiteUrl = table.Column(type: "text", nullable: true), + LogoUrl = table.Column(type: "text", nullable: true), + Enabled = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Platform", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VodEmbeds", + columns: table => new + { + GuildId = table.Column(type: "text", nullable: false), + Header = table.Column(type: "text", nullable: true), + DescriptionLabel = table.Column(type: "text", nullable: true), + Description = table.Column(type: "text", nullable: true), + Footer = table.Column(type: "text", nullable: true), + ChannelButton = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VodEmbeds", x => x.GuildId); + table.ForeignKey( + name: "FK_VodEmbeds_Guilds_GuildId", + column: x => x.GuildId, + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Filters", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Text = table.Column(type: "text", nullable: true), + PlatformId = table.Column(type: "integer", nullable: false), + FilterTypeId = table.Column(type: "integer", nullable: false), + GuildId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Filters", x => x.Id); + table.ForeignKey( + name: "FK_Filters_FilterType_FilterTypeId", + column: x => x.FilterTypeId, + principalTable: "FilterType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Filters_Guilds_GuildId", + column: x => x.GuildId, + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Filters_Platform_PlatformId", + column: x => x.PlatformId, + principalTable: "Platform", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Games", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DisplayName = table.Column(type: "text", nullable: true), + CreatedDate = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedDate = table.Column(type: "timestamp without time zone", nullable: false), + PlatformId = table.Column(type: "integer", nullable: false), + GameId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Games", x => x.Id); + table.ForeignKey( + name: "FK_Games_Platform_PlatformId", + column: x => x.PlatformId, + principalTable: "Platform", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Team", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DisplayName = table.Column(type: "text", nullable: true), + CreatedDate = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedDate = table.Column(type: "timestamp without time zone", nullable: false), + PlatformId = table.Column(type: "integer", nullable: false), + TeamId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Team", x => x.Id); + table.ForeignKey( + name: "FK_Team_Platform_PlatformId", + column: x => x.PlatformId, + principalTable: "Platform", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GameChannels", + columns: table => new + { + GameId = table.Column(type: "integer", nullable: false), + ChannelId = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameChannels", x => new { x.GameId, x.ChannelId }); + table.ForeignKey( + name: "FK_GameChannels_Channels_ChannelId", + column: x => x.ChannelId, + principalTable: "Channels", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GameChannels_Games_GameId", + column: x => x.GameId, + principalTable: "Games", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TeamChannels", + columns: table => new + { + TeamId = table.Column(type: "integer", nullable: false), + ChannelId = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TeamChannels", x => new { x.TeamId, x.ChannelId }); + table.ForeignKey( + name: "FK_TeamChannels_Channels_ChannelId", + column: x => x.ChannelId, + principalTable: "Channels", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TeamChannels_Team_TeamId", + column: x => x.TeamId, + principalTable: "Team", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Filters_FilterTypeId", + table: "Filters", + column: "FilterTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_Filters_GuildId", + table: "Filters", + column: "GuildId"); + + migrationBuilder.CreateIndex( + name: "IX_Filters_PlatformId", + table: "Filters", + column: "PlatformId"); + + migrationBuilder.CreateIndex( + name: "IX_GameChannels_ChannelId", + table: "GameChannels", + column: "ChannelId"); + + migrationBuilder.CreateIndex( + name: "IX_Games_PlatformId", + table: "Games", + column: "PlatformId"); + + migrationBuilder.CreateIndex( + name: "IX_Team_PlatformId", + table: "Team", + column: "PlatformId"); + + migrationBuilder.CreateIndex( + name: "IX_TeamChannels_ChannelId", + table: "TeamChannels", + column: "ChannelId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ClipEmbeds"); + + migrationBuilder.DropTable( + name: "DiscordLiveConfigurations"); + + migrationBuilder.DropTable( + name: "Filters"); + + migrationBuilder.DropTable( + name: "GameChannels"); + + migrationBuilder.DropTable( + name: "LiveEmbeds"); + + migrationBuilder.DropTable( + name: "TeamChannels"); + + migrationBuilder.DropTable( + name: "VodEmbeds"); + + migrationBuilder.DropTable( + name: "FilterType"); + + migrationBuilder.DropTable( + name: "Games"); + + migrationBuilder.DropTable( + name: "Team"); + + migrationBuilder.DropTable( + name: "Platform"); + } + } +} diff --git a/src/CB.Data/Migrations/20250717225700_7172025-556p.Designer.cs b/src/CB.Data/Migrations/20250717225700_7172025-556p.Designer.cs new file mode 100644 index 0000000..b949336 --- /dev/null +++ b/src/CB.Data/Migrations/20250717225700_7172025-556p.Designer.cs @@ -0,0 +1,898 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250717225700_7172025-556p")] + partial class _7172025556p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250717225700_7172025-556p.cs b/src/CB.Data/Migrations/20250717225700_7172025-556p.cs new file mode 100644 index 0000000..372083f --- /dev/null +++ b/src/CB.Data/Migrations/20250717225700_7172025-556p.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025556p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/CB.Data/Migrations/20250717225843_7172025-558p.Designer.cs b/src/CB.Data/Migrations/20250717225843_7172025-558p.Designer.cs new file mode 100644 index 0000000..aefc358 --- /dev/null +++ b/src/CB.Data/Migrations/20250717225843_7172025-558p.Designer.cs @@ -0,0 +1,898 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250717225843_7172025-558p")] + partial class _7172025558p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250717225843_7172025-558p.cs b/src/CB.Data/Migrations/20250717225843_7172025-558p.cs new file mode 100644 index 0000000..3a9f7f8 --- /dev/null +++ b/src/CB.Data/Migrations/20250717225843_7172025-558p.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025558p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ModifiedDate", + table: "Team", + type: "timestamp with time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp without time zone"); + + migrationBuilder.AlterColumn( + name: "CreatedDate", + table: "Team", + type: "timestamp with time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp without time zone"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "ModifiedDate", + table: "Team", + type: "timestamp without time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone"); + + migrationBuilder.AlterColumn( + name: "CreatedDate", + table: "Team", + type: "timestamp without time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone"); + } + } +} diff --git a/src/CB.Data/Migrations/20250718013457_7172025-834p.Designer.cs b/src/CB.Data/Migrations/20250718013457_7172025-834p.Designer.cs new file mode 100644 index 0000000..3445fd6 --- /dev/null +++ b/src/CB.Data/Migrations/20250718013457_7172025-834p.Designer.cs @@ -0,0 +1,910 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250718013457_7172025-834p")] + partial class _7172025834p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + + b.HasData( + new + { + Id = 1, + DisplayName = "Game" + }, + new + { + Id = 2, + DisplayName = "Title" + }); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250718013457_7172025-834p.cs b/src/CB.Data/Migrations/20250718013457_7172025-834p.cs new file mode 100644 index 0000000..c87aa75 --- /dev/null +++ b/src/CB.Data/Migrations/20250718013457_7172025-834p.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025834p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "FilterType", + columns: new[] { "Id", "DisplayName" }, + values: new object[,] + { + { 1, "Game" }, + { 2, "Title" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "FilterType", + keyColumn: "Id", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "FilterType", + keyColumn: "Id", + keyValue: 2); + } + } +} diff --git a/src/CB.Data/Migrations/20250718014125_7172025-841p.Designer.cs b/src/CB.Data/Migrations/20250718014125_7172025-841p.Designer.cs new file mode 100644 index 0000000..66fd6cd --- /dev/null +++ b/src/CB.Data/Migrations/20250718014125_7172025-841p.Designer.cs @@ -0,0 +1,948 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250718014125_7172025-841p")] + partial class _7172025841p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + + b.HasData( + new + { + Id = 1, + DisplayName = "Game" + }, + new + { + Id = 2, + DisplayName = "Title" + }); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + + b.HasData( + new + { + Id = 3, + DisplayName = "Picarto", + Enabled = false + }, + new + { + Id = 4, + DisplayName = "Piczel", + Enabled = false + }, + new + { + Id = 6, + DisplayName = "Twitch", + Enabled = false + }, + new + { + Id = 7, + DisplayName = "YouTube", + Enabled = false + }, + new + { + Id = 10, + DisplayName = "Trovo", + Enabled = false + }, + new + { + Id = 13, + DisplayName = "DLive", + Enabled = false + }); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250718014125_7172025-841p.cs b/src/CB.Data/Migrations/20250718014125_7172025-841p.cs new file mode 100644 index 0000000..df52259 --- /dev/null +++ b/src/CB.Data/Migrations/20250718014125_7172025-841p.cs @@ -0,0 +1,63 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025841p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Platform", + columns: new[] { "Id", "DisplayName", "Enabled", "LogoUrl", "SiteUrl" }, + values: new object[,] + { + { 3, "Picarto", false, null, null }, + { 4, "Piczel", false, null, null }, + { 6, "Twitch", false, null, null }, + { 7, "YouTube", false, null, null }, + { 10, "Trovo", false, null, null }, + { 13, "DLive", false, null, null } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 4); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 6); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 7); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 10); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 13); + } + } +} diff --git a/src/CB.Data/Migrations/20250718015544_7172025-855p.Designer.cs b/src/CB.Data/Migrations/20250718015544_7172025-855p.Designer.cs new file mode 100644 index 0000000..eb3cc3e --- /dev/null +++ b/src/CB.Data/Migrations/20250718015544_7172025-855p.Designer.cs @@ -0,0 +1,952 @@ +// +using System; +using CB.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + [DbContext(typeof(CbContext))] + [Migration("20250718015544_7172025-855p")] + partial class _7172025855p + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AllowCrosspost") + .HasColumnType("boolean"); + + b.Property("AllowDiscordLive") + .HasColumnType("boolean"); + + b.Property("AllowFfa") + .HasColumnType("boolean"); + + b.Property("AllowGoodbyes") + .HasColumnType("boolean"); + + b.Property("AllowGreetings") + .HasColumnType("boolean"); + + b.Property("AllowLive") + .HasColumnType("boolean"); + + b.Property("AllowLiveDiscovery") + .HasColumnType("boolean"); + + b.Property("AllowPublished") + .HasColumnType("boolean"); + + b.Property("AllowStreamVod") + .HasColumnType("boolean"); + + b.Property("AllowThumbnails") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("AllowConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId"); + + b.ToTable("Channels", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscordLiveChannelId") + .HasColumnType("text"); + + b.Property("GoodbyeChannelId") + .HasColumnType("text"); + + b.Property("GreetingChannelId") + .HasColumnType("text"); + + b.Property("LiveChannelId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.HasIndex("DiscordLiveChannelId"); + + b.HasIndex("GoodbyeChannelId"); + + b.HasIndex("GreetingChannelId"); + + b.HasIndex("LiveChannelId"); + + b.ToTable("ChannelConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("IsLive") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Creators", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.Property("CreatorId") + .HasColumnType("bigint"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.Property("ChannelTypeId") + .HasColumnType("integer"); + + b.Property("CustomMessage") + .HasColumnType("text"); + + b.HasKey("CreatorId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DropdownType") + .HasColumnType("text"); + + b.Property("OriginalMessageId") + .HasColumnType("text"); + + b.Property("Payload") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DropdownPayloads"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + + b.HasData( + new + { + Id = 1, + DisplayName = "Game" + }, + new + { + Id = 2, + DisplayName = "Title" + }); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("OwnerId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Guilds", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DeleteOffline") + .HasColumnType("boolean"); + + b.Property("TextAnnouncements") + .HasColumnType("boolean"); + + b.HasKey("GuildId"); + + b.ToTable("GuildConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("GoodbyeMessage") + .HasColumnType("text"); + + b.Property("GreetingMessage") + .HasColumnType("text"); + + b.Property("LiveMessage") + .HasColumnType("text"); + + b.Property("PublishedMessage") + .HasColumnType("text"); + + b.Property("StreamOfflineMessage") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("MessageConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + + b.HasData( + new + { + Id = 1, + DisplayName = "All", + Enabled = false + }, + new + { + Id = 3, + DisplayName = "Picarto", + Enabled = false + }, + new + { + Id = 4, + DisplayName = "Piczel", + Enabled = false + }, + new + { + Id = 6, + DisplayName = "Twitch", + Enabled = false + }, + new + { + Id = 7, + DisplayName = "YouTube", + Enabled = false + }, + new + { + Id = 10, + DisplayName = "Trovo", + Enabled = false + }, + new + { + Id = 13, + DisplayName = "DLive", + Enabled = false + }); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("DiscoveryRoleId") + .HasColumnType("text"); + + b.Property("JoinRoleId") + .HasColumnType("text"); + + b.Property("LiveDiscoveryRoleId") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("RoleConfigurations", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("AllowConfiguration") + .HasForeignKey("CB.Data.Entities.AllowConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Channels") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.ChannelConfiguration", b => + { + b.HasOne("CB.Data.Entities.Channel", "DiscordLiveChannel") + .WithMany() + .HasForeignKey("DiscordLiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GoodbyeChannel") + .WithMany() + .HasForeignKey("GoodbyeChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Channel", "GreetingChannel") + .WithMany() + .HasForeignKey("GreetingChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ChannelConfiguration") + .HasForeignKey("CB.Data.Entities.ChannelConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Channel", "LiveChannel") + .WithMany() + .HasForeignKey("LiveChannelId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("DiscordLiveChannel"); + + b.Navigation("GoodbyeChannel"); + + b.Navigation("GreetingChannel"); + + b.Navigation("Guild"); + + b.Navigation("LiveChannel"); + }); + + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.HasOne("CB.Data.Entities.User", "User") + .WithMany("Creators") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CB.Data.Entities.CreatorChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("CreatorChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Creator", "Creator") + .WithMany("CreatorChannels") + .HasForeignKey("CreatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId"); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.HasOne("CB.Data.Entities.User", "Owner") + .WithMany("Guilds") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("CB.Data.Entities.GuildConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("GuildConfiguration") + .HasForeignKey("CB.Data.Entities.GuildConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("MessageConfiguration") + .HasForeignKey("CB.Data.Entities.MessageConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("RoleConfiguration") + .HasForeignKey("CB.Data.Entities.RoleConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("LiveEmbed"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.User", b => + { + b.Navigation("Creators"); + + b.Navigation("Guilds"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CB.Data/Migrations/20250718015544_7172025-855p.cs b/src/CB.Data/Migrations/20250718015544_7172025-855p.cs new file mode 100644 index 0000000..630081a --- /dev/null +++ b/src/CB.Data/Migrations/20250718015544_7172025-855p.cs @@ -0,0 +1,69 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CB.Data.Migrations +{ + /// + public partial class _7172025855p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Filters_Platform_PlatformId", + table: "Filters"); + + migrationBuilder.AlterColumn( + name: "PlatformId", + table: "Filters", + type: "integer", + nullable: true, + oldClrType: typeof(int), + oldType: "integer"); + + migrationBuilder.InsertData( + table: "Platform", + columns: new[] { "Id", "DisplayName", "Enabled", "LogoUrl", "SiteUrl" }, + values: new object[] { 1, "All", false, null, null }); + + migrationBuilder.AddForeignKey( + name: "FK_Filters_Platform_PlatformId", + table: "Filters", + column: "PlatformId", + principalTable: "Platform", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Filters_Platform_PlatformId", + table: "Filters"); + + migrationBuilder.DeleteData( + table: "Platform", + keyColumn: "Id", + keyValue: 1); + + migrationBuilder.AlterColumn( + name: "PlatformId", + table: "Filters", + type: "integer", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "integer", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_Filters_Platform_PlatformId", + table: "Filters", + column: "PlatformId", + principalTable: "Platform", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/src/CB.Data/Migrations/CbContextModelSnapshot.cs b/src/CB.Data/Migrations/CbContextModelSnapshot.cs index 3047471..5d6a58e 100644 --- a/src/CB.Data/Migrations/CbContextModelSnapshot.cs +++ b/src/CB.Data/Migrations/CbContextModelSnapshot.cs @@ -116,6 +116,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ChannelConfigurations", (string)null); }); + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MoreButton") + .HasColumnType("text"); + + b.Property("WatchButton") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("ClipEmbeds"); + }); + modelBuilder.Entity("CB.Data.Entities.Creator", b => { b.Property("Id") @@ -173,6 +198,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("CreatorChannels"); }); + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("MentionRoleId") + .HasColumnType("text"); + + b.Property("Message") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("DiscordLiveConfigurations"); + }); + modelBuilder.Entity("CB.Data.Entities.DropdownPayload", b => { b.Property("Id") @@ -195,6 +245,110 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("DropdownPayloads"); }); + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FilterTypeId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FilterTypeId"); + + b.HasIndex("GuildId"); + + b.HasIndex("PlatformId"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("CB.Data.Entities.FilterType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FilterType"); + + b.HasData( + new + { + Id = 1, + DisplayName = "Game" + }, + new + { + Id = 2, + DisplayName = "Title" + }); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("GameId") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Games", (string)null); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.Property("GameId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("GameId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("GameChannels"); + }); + modelBuilder.Entity("CB.Data.Entities.Guild", b => { b.Property("Id") @@ -235,6 +389,43 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("GuildConfigurations", (string)null); }); + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("AverageStream") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("FooterStart") + .HasColumnType("text"); + + b.Property("FooterStopped") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.Property("LastStreamed") + .HasColumnType("text"); + + b.Property("StreamDescription") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("LiveEmbeds"); + }); + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => { b.Property("GuildId") @@ -260,6 +451,75 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("MessageConfigurations", (string)null); }); + modelBuilder.Entity("CB.Data.Entities.Platform", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("LogoUrl") + .HasColumnType("text"); + + b.Property("SiteUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Platform"); + + b.HasData( + new + { + Id = 1, + DisplayName = "All", + Enabled = false + }, + new + { + Id = 3, + DisplayName = "Picarto", + Enabled = false + }, + new + { + Id = 4, + DisplayName = "Piczel", + Enabled = false + }, + new + { + Id = 6, + DisplayName = "Twitch", + Enabled = false + }, + new + { + Id = 7, + DisplayName = "YouTube", + Enabled = false + }, + new + { + Id = 10, + DisplayName = "Trovo", + Enabled = false + }, + new + { + Id = 13, + DisplayName = "DLive", + Enabled = false + }); + }); + modelBuilder.Entity("CB.Data.Entities.RoleConfiguration", b => { b.Property("GuildId") @@ -279,6 +539,51 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("RoleConfigurations", (string)null); }); + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PlatformId") + .HasColumnType("integer"); + + b.Property("TeamId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("PlatformId"); + + b.ToTable("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.Property("TeamId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("text"); + + b.HasKey("TeamId", "ChannelId"); + + b.HasIndex("ChannelId"); + + b.ToTable("TeamChannels"); + }); + modelBuilder.Entity("CB.Data.Entities.User", b => { b.Property("Id") @@ -298,6 +603,31 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Users", (string)null); }); + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.Property("GuildId") + .HasColumnType("text"); + + b.Property("ChannelButton") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("DescriptionLabel") + .HasColumnType("text"); + + b.Property("Footer") + .HasColumnType("text"); + + b.Property("Header") + .HasColumnType("text"); + + b.HasKey("GuildId"); + + b.ToTable("VodEmbeds"); + }); + modelBuilder.Entity("CB.Data.Entities.AllowConfiguration", b => { b.HasOne("CB.Data.Entities.Guild", "Guild") @@ -358,6 +688,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("LiveChannel"); }); + modelBuilder.Entity("CB.Data.Entities.ClipEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("ClipEmbed") + .HasForeignKey("CB.Data.Entities.ClipEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + modelBuilder.Entity("CB.Data.Entities.Creator", b => { b.HasOne("CB.Data.Entities.User", "User") @@ -387,6 +728,71 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Creator"); }); + modelBuilder.Entity("CB.Data.Entities.DiscordLiveConfiguration", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("DiscordLiveConfiguration") + .HasForeignKey("CB.Data.Entities.DiscordLiveConfiguration", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + + modelBuilder.Entity("CB.Data.Entities.Filter", b => + { + b.HasOne("CB.Data.Entities.FilterType", "FilterType") + .WithMany() + .HasForeignKey("FilterTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithMany("Filters") + .HasForeignKey("GuildId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId"); + + b.Navigation("FilterType"); + + b.Navigation("Guild"); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.GameChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("GameChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Game", "Game") + .WithMany("GameChannels") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Game"); + }); + modelBuilder.Entity("CB.Data.Entities.Guild", b => { b.HasOne("CB.Data.Entities.User", "Owner") @@ -408,6 +814,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Guild"); }); + modelBuilder.Entity("CB.Data.Entities.LiveEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("LiveEmbed") + .HasForeignKey("CB.Data.Entities.LiveEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + modelBuilder.Entity("CB.Data.Entities.MessageConfiguration", b => { b.HasOne("CB.Data.Entities.Guild", "Guild") @@ -430,9 +847,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Guild"); }); + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.HasOne("CB.Data.Entities.Platform", "Platform") + .WithMany() + .HasForeignKey("PlatformId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Platform"); + }); + + modelBuilder.Entity("CB.Data.Entities.TeamChannel", b => + { + b.HasOne("CB.Data.Entities.Channel", "Channel") + .WithMany("TeamChannels") + .HasForeignKey("ChannelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CB.Data.Entities.Team", "Team") + .WithMany("TeamChannels") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Channel"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("CB.Data.Entities.VodEmbed", b => + { + b.HasOne("CB.Data.Entities.Guild", "Guild") + .WithOne("VodEmbed") + .HasForeignKey("CB.Data.Entities.VodEmbed", "GuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Guild"); + }); + modelBuilder.Entity("CB.Data.Entities.Channel", b => { b.Navigation("CreatorChannels"); + + b.Navigation("GameChannels"); + + b.Navigation("TeamChannels"); }); modelBuilder.Entity("CB.Data.Entities.Creator", b => @@ -440,6 +902,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("CreatorChannels"); }); + modelBuilder.Entity("CB.Data.Entities.Game", b => + { + b.Navigation("GameChannels"); + }); + modelBuilder.Entity("CB.Data.Entities.Guild", b => { b.Navigation("AllowConfiguration"); @@ -448,11 +915,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Channels"); + b.Navigation("ClipEmbed"); + + b.Navigation("DiscordLiveConfiguration"); + + b.Navigation("Filters"); + b.Navigation("GuildConfiguration"); + b.Navigation("LiveEmbed"); + b.Navigation("MessageConfiguration"); b.Navigation("RoleConfiguration"); + + b.Navigation("VodEmbed"); + }); + + modelBuilder.Entity("CB.Data.Entities.Team", b => + { + b.Navigation("TeamChannels"); }); modelBuilder.Entity("CB.Data.Entities.User", b => diff --git a/src/CB.Engines/Implementations/CreatorEngine.cs b/src/CB.Engines/Implementations/CreatorEngine.cs index a1331a8..f93a095 100644 --- a/src/CB.Engines/Implementations/CreatorEngine.cs +++ b/src/CB.Engines/Implementations/CreatorEngine.cs @@ -37,7 +37,7 @@ await creatorAccessor.GetByChannelIdAndPlatformAsync(validChannel.ChannelId, if (creator == null || creator.PlatformId != (int)platform) { - creator = await creatorAccessor.CreateAsync(new Creator + creator = await creatorAccessor.CreateAsync(new Data.Entities.Creator { ChannelId = validChannel.ChannelId, DisplayName = validChannel.DisplayName ?? "", @@ -47,48 +47,49 @@ await creatorAccessor.GetByChannelIdAndPlatformAsync(validChannel.ChannelId, }); } - var channel = guild.Channels.FirstOrDefault(c => c.Id.Equals(announcementChannel.Id.ToString())) ?? await channelAccessor.CreateAsync(new Channel - { - Id = announcementChannel.Id.ToString(), - CreatedDate = DateTime.UtcNow, - DisplayName = announcementChannel.Name, - GuildId = guild.Id, - ModifiedDate = DateTime.UtcNow - }); - - if (await RemoveCreator( - creatorName, - announcementChannel, - channelType, - customMessage, - channel, - creator, - platform, - socketInteraction, - authorName)) - { - return; - } - - if (await UpdateCreatorMessage( - creatorName, - channelType, - customMessage, - channel, - creator, - socketInteraction, - authorName)) - { - return; - } - - await creatorChannelAccessor.CreateAsync(new CreatorChannel - { - ChannelId = channel.Id, - CreatorId = creator.Id, - ChannelTypeId = (int)channelType, - CustomMessage = customMessage - }); + // TODO Temporary. Figuring out navigational property depth and weirdness. + //var channel = guild.Channels.FirstOrDefault(c => c.Id.Equals(announcementChannel.Id.ToString())) ?? await channelAccessor.CreateAsync(new Channel + //{ + // Id = announcementChannel.Id.ToString(), + // CreatedDate = DateTime.UtcNow, + // DisplayName = announcementChannel.Name, + // GuildId = guild.Id, + // ModifiedDate = DateTime.UtcNow + //}); + + //if (await RemoveCreator( + // creatorName, + // announcementChannel, + // channelType, + // customMessage, + // channel, + // creator, + // platform, + // socketInteraction, + // authorName)) + //{ + // return; + //} + + //if (await UpdateCreatorMessage( + // creatorName, + // channelType, + // customMessage, + // channel, + // creator, + // socketInteraction, + // authorName)) + //{ + // return; + //} + + //await creatorChannelAccessor.CreateAsync(new CreatorChannel + //{ + // ChannelId = channel.Id, + // CreatorId = creator.Id, + // ChannelTypeId = (int)channelType, + // CustomMessage = customMessage + //}); await socketInteraction.FollowupAsync( $"{Format.Sanitize(creatorName)} will now announce in {announcementChannel.Name}.", diff --git a/src/CB.Shared/Dtos/AllowConfigurationDto.cs b/src/CB.Shared/Dtos/AllowConfigurationDto.cs index cfe83ec..77a7429 100644 --- a/src/CB.Shared/Dtos/AllowConfigurationDto.cs +++ b/src/CB.Shared/Dtos/AllowConfigurationDto.cs @@ -15,5 +15,5 @@ public class AllowConfigurationDto public bool AllowCrosspost { get; set; } public bool AllowDiscordLive { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/CbProfile.cs b/src/CB.Shared/Dtos/CbProfile.cs index cbc7319..8a7e9dd 100644 --- a/src/CB.Shared/Dtos/CbProfile.cs +++ b/src/CB.Shared/Dtos/CbProfile.cs @@ -10,6 +10,7 @@ public CbProfile() CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); @@ -20,6 +21,7 @@ public CbProfile() CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/src/CB.Shared/Dtos/ChannelConfiguration.cs b/src/CB.Shared/Dtos/ChannelConfigurationDto.cs similarity index 51% rename from src/CB.Shared/Dtos/ChannelConfiguration.cs rename to src/CB.Shared/Dtos/ChannelConfigurationDto.cs index 3a50c1f..3737ef7 100644 --- a/src/CB.Shared/Dtos/ChannelConfiguration.cs +++ b/src/CB.Shared/Dtos/ChannelConfigurationDto.cs @@ -9,9 +9,9 @@ public class ChannelConfigurationDto public string? LiveChannelId { get; set; } public string? DiscordLiveChannelId { get; set; } - public virtual GuildDto Guild { get; set; } - public virtual ChannelDto GreetingChannel { get; set; } - public virtual ChannelDto GoodbyeChannel { get; set; } - public virtual ChannelDto LiveChannel { get; set; } - public virtual ChannelDto DiscordLiveChannel { get; set; } + //public virtual GuildDto Guild { get; set; } + //public virtual ChannelDto GreetingChannel { get; set; } + //public virtual ChannelDto GoodbyeChannel { get; set; } + //public virtual ChannelDto LiveChannel { get; set; } + //public virtual ChannelDto DiscordLiveChannel { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/ChannelConfigurationSummaryDto.cs b/src/CB.Shared/Dtos/ChannelConfigurationSummaryDto.cs new file mode 100644 index 0000000..5f1dd57 --- /dev/null +++ b/src/CB.Shared/Dtos/ChannelConfigurationSummaryDto.cs @@ -0,0 +1,17 @@ +namespace CB.Shared.Dtos; + +public class ChannelConfigurationSummaryDto +{ + public string Id { get; set; } + +public string DisplayName { get; set; } + public string GuildId { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime ModifiedDate { get; set; } + + //public virtual GuildDto Guild { get; set; } + + //public virtual ICollection CreatorChannels { get; set; } = new List(); + //public virtual ICollection GameChannels { get; set; } = new List(); + //public virtual ICollection TeamChannels { get; set; } = new List(); +} \ No newline at end of file diff --git a/src/CB.Shared/Dtos/ChannelDto.cs b/src/CB.Shared/Dtos/ChannelDto.cs index 848b885..c91cb13 100644 --- a/src/CB.Shared/Dtos/ChannelDto.cs +++ b/src/CB.Shared/Dtos/ChannelDto.cs @@ -14,5 +14,4 @@ public class ChannelDto public virtual ICollection CreatorChannels { get; set; } = new List(); public virtual ICollection GameChannels { get; set; } = new List(); public virtual ICollection TeamChannels { get; set; } = new List(); - } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/ClipEmbedDto.cs b/src/CB.Shared/Dtos/ClipEmbedDto.cs index c04cde8..a57687c 100644 --- a/src/CB.Shared/Dtos/ClipEmbedDto.cs +++ b/src/CB.Shared/Dtos/ClipEmbedDto.cs @@ -14,5 +14,5 @@ public class ClipEmbedDto public string MoreButton { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/DiscordLiveConfigurationDto.cs b/src/CB.Shared/Dtos/DiscordLiveConfigurationDto.cs index 061b382..40fef32 100644 --- a/src/CB.Shared/Dtos/DiscordLiveConfigurationDto.cs +++ b/src/CB.Shared/Dtos/DiscordLiveConfigurationDto.cs @@ -10,5 +10,5 @@ public class DiscordLiveConfigurationDto public string Footer { get; set; } public string MentionRoleId { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/FilterDto.cs b/src/CB.Shared/Dtos/FilterDto.cs index f495317..dbb5142 100644 --- a/src/CB.Shared/Dtos/FilterDto.cs +++ b/src/CB.Shared/Dtos/FilterDto.cs @@ -4,11 +4,11 @@ public class FilterDto { public int Id { get; set; } public string Text { get; set; } - public int PlatformId { get; set; } + public int? PlatformId { get; set; } public int FilterTypeId { get; set; } - public int GuildId { get; set; } + public string GuildId { get; set; } - public PlatformDto Platform { get; set; } + public PlatformDto? Platform { get; set; } public FilterTypeDto FilterType { get; set; } public GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/GuildConfiguration.cs b/src/CB.Shared/Dtos/GuildConfigurationDto.cs similarity index 79% rename from src/CB.Shared/Dtos/GuildConfiguration.cs rename to src/CB.Shared/Dtos/GuildConfigurationDto.cs index 310eebf..a44ff90 100644 --- a/src/CB.Shared/Dtos/GuildConfiguration.cs +++ b/src/CB.Shared/Dtos/GuildConfigurationDto.cs @@ -7,5 +7,5 @@ public class GuildConfigurationDto public bool TextAnnouncements { get; set; } public bool DeleteOffline { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/GuildConfigurationSummaryDto.cs b/src/CB.Shared/Dtos/GuildConfigurationSummaryDto.cs new file mode 100644 index 0000000..da4c185 --- /dev/null +++ b/src/CB.Shared/Dtos/GuildConfigurationSummaryDto.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; + +namespace CB.Shared.Dtos; + +public class GuildConfigurationSummaryDto +{ + public string Id { get; set; } + + public string DisplayName { get; set; } + + public string OwnerId { get; set; } + + public DateTime CreatedDate { get; set; } + + public DateTime ModifiedDate { get; set; } + + //public virtual UserDto Owner { get; set; } + //public virtual ICollection Channels { get; set; } + public virtual AllowConfigurationDto AllowConfiguration { get; set; } + public virtual ChannelConfigurationDto ChannelConfiguration { get; set; } + public virtual GuildConfigurationDto GuildConfiguration { get; set; } + public virtual MessageConfigurationDto MessageConfiguration { get; set; } + public virtual RoleConfigurationDto RoleConfiguration { get; set; } + //public virtual ClipEmbedDto ClipEmbed { get; set; } + //public virtual LiveEmbedDto LiveEmbed { get; set; } + //public virtual VodEmbedDto VodEmbed { get; set; } + //public virtual DiscordLiveConfigurationDto DiscordLiveConfiguration { get; set; } +} \ No newline at end of file diff --git a/src/CB.Shared/Dtos/LiveEmbedDto.cs b/src/CB.Shared/Dtos/LiveEmbedDto.cs index 6a789b9..1e4c076 100644 --- a/src/CB.Shared/Dtos/LiveEmbedDto.cs +++ b/src/CB.Shared/Dtos/LiveEmbedDto.cs @@ -22,5 +22,5 @@ public class LiveEmbedDto public string ChannelButton { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/MessageConfigurationDto.cs b/src/CB.Shared/Dtos/MessageConfigurationDto.cs index 78c194b..ff3d6f8 100644 --- a/src/CB.Shared/Dtos/MessageConfigurationDto.cs +++ b/src/CB.Shared/Dtos/MessageConfigurationDto.cs @@ -10,5 +10,5 @@ public class MessageConfigurationDto public string PublishedMessage { get; set; } public string StreamOfflineMessage { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/RoleConfigurationDto.cs b/src/CB.Shared/Dtos/RoleConfigurationDto.cs index 8750e34..c39e8b8 100644 --- a/src/CB.Shared/Dtos/RoleConfigurationDto.cs +++ b/src/CB.Shared/Dtos/RoleConfigurationDto.cs @@ -8,5 +8,5 @@ public class RoleConfigurationDto public string DiscoveryRoleId { get; set; } public string LiveDiscoveryRoleId { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/VodEmbedDto.cs b/src/CB.Shared/Dtos/VodEmbedDto.cs index d948fae..576cc1f 100644 --- a/src/CB.Shared/Dtos/VodEmbedDto.cs +++ b/src/CB.Shared/Dtos/VodEmbedDto.cs @@ -14,5 +14,5 @@ public class VodEmbedDto public string ChannelButton { get; set; } - public virtual GuildDto Guild { get; set; } + //public virtual GuildDto Guild { get; set; } } \ No newline at end of file diff --git a/src/CB.Shared/Enums/Platform.cs b/src/CB.Shared/Enums/Platform.cs index fa3cfc6..42f3321 100644 --- a/src/CB.Shared/Enums/Platform.cs +++ b/src/CB.Shared/Enums/Platform.cs @@ -1,12 +1,12 @@ namespace CB.Shared.Enums; public enum Platform -{ +{ + All = 1, Picarto = 3, Piczel = 4, Twitch = 6, YouTube = 7, Trovo = 10, - DLive = 13, - All + DLive = 13 } \ No newline at end of file diff --git a/src/CB.Shared/Models/Twitch/TwitchGameChannel.cs b/src/CB.Shared/Models/Twitch/TwitchGameChannel.cs index 9f45519..e67a4be 100644 --- a/src/CB.Shared/Models/Twitch/TwitchGameChannel.cs +++ b/src/CB.Shared/Models/Twitch/TwitchGameChannel.cs @@ -4,6 +4,6 @@ public class TwitchGameChannel { public string GameId { get; set; } public string GameName { get; set; } - public int ChannelId { get; set; } - public int GuildId { get; set; } + public string ChannelId { get; set; } + public string GuildId { get; set; } } \ No newline at end of file