diff --git a/src/CB.Accessors/Contracts/IClipEmbedAccessor.cs b/src/CB.Accessors/Contracts/IClipEmbedAccessor.cs new file mode 100644 index 0000000..382b044 --- /dev/null +++ b/src/CB.Accessors/Contracts/IClipEmbedAccessor.cs @@ -0,0 +1,10 @@ +using CB.Shared.Dtos; + +namespace CB.Accessors.Contracts; + +public interface IClipEmbedAccessor +{ + Task GetByIdAsync(string guildId); + + Task UpdateAsync(ClipEmbedDto entity); +} \ No newline at end of file diff --git a/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs b/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs index 9dd9de0..06770bd 100644 --- a/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs +++ b/src/CB.Accessors/Contracts/ICreatorChannelAccessor.cs @@ -1,6 +1,6 @@ using CB.Data.Entities; using CB.Shared.Dtos; -using CB.Shared.Enums; + // ReSharper disable UnusedMember.Global namespace CB.Accessors.Contracts; diff --git a/src/CB.Accessors/Contracts/ILiveEmbedAccessor.cs b/src/CB.Accessors/Contracts/ILiveEmbedAccessor.cs new file mode 100644 index 0000000..58a506f --- /dev/null +++ b/src/CB.Accessors/Contracts/ILiveEmbedAccessor.cs @@ -0,0 +1,10 @@ +using CB.Shared.Dtos; + +namespace CB.Accessors.Contracts; + +public interface ILiveEmbedAccessor +{ + Task GetByIdAsync(string guildId); + + Task UpdateAsync(LiveEmbedDto entity); +} \ No newline at end of file diff --git a/src/CB.Accessors/Contracts/IVodEmbedAccessor.cs b/src/CB.Accessors/Contracts/IVodEmbedAccessor.cs new file mode 100644 index 0000000..3c331a9 --- /dev/null +++ b/src/CB.Accessors/Contracts/IVodEmbedAccessor.cs @@ -0,0 +1,10 @@ +using CB.Shared.Dtos; + +namespace CB.Accessors.Contracts; + +public interface IVodEmbedAccessor +{ + Task GetByIdAsync(string guildId); + + Task UpdateAsync(VodEmbedDto entity); +} \ No newline at end of file diff --git a/src/CB.Accessors/Implementations/ClipEmbedAccessor.cs b/src/CB.Accessors/Implementations/ClipEmbedAccessor.cs new file mode 100644 index 0000000..67b12e7 --- /dev/null +++ b/src/CB.Accessors/Implementations/ClipEmbedAccessor.cs @@ -0,0 +1,65 @@ +using AutoMapper; +using CB.Accessors.Contracts; +using CB.Data; +using CB.Shared.Dtos; +using Microsoft.EntityFrameworkCore; + +namespace CB.Accessors.Implementations; + +public class ClipEmbedAccessor(CbContext context, + IMapper mapper) + : IClipEmbedAccessor +{ + public async Task GetByIdAsync(string guildId) + { + var entity = await context + .ClipEmbeds + .FirstOrDefaultAsync(x => x.GuildId == guildId); + + if (entity == null) + { + entity = new() + { + GuildId = guildId, + Header = "New Clip @ %CHANNEL%", + Description = "%DESCRIPTION%", + Footer = "Powered by 100% Couch • Created by %CHANNEL%", + WatchButton = "Watch this Clip!", + MoreButton = "And More!", + }; + + await context + .ClipEmbeds + .AddAsync(entity); + await context + .SaveChangesAsync(); + } + + return mapper.Map(entity); + } + + public async Task UpdateAsync(ClipEmbedDto entity) + { + var embed = await context + .ClipEmbeds + .FirstOrDefaultAsync(x => x.GuildId == entity.GuildId) + .ConfigureAwait(false); + + if (embed == null) + { + return null; + } + + embed.Description = entity.Description; + embed.Footer = entity.Description; + embed.Header = entity.Description; + embed.MoreButton = entity.Description; + embed.WatchButton = entity.WatchButton; + + await context + .SaveChangesAsync() + .ConfigureAwait(false); + + return mapper.Map(embed); + } +} \ No newline at end of file diff --git a/src/CB.Accessors/Implementations/LiveEmbedAccessor.cs b/src/CB.Accessors/Implementations/LiveEmbedAccessor.cs new file mode 100644 index 0000000..e924304 --- /dev/null +++ b/src/CB.Accessors/Implementations/LiveEmbedAccessor.cs @@ -0,0 +1,73 @@ +using AutoMapper; +using CB.Accessors.Contracts; +using CB.Data; +using CB.Shared.Dtos; +using Microsoft.EntityFrameworkCore; + +namespace CB.Accessors.Implementations; + +public class LiveEmbedAccessor(CbContext context, + IMapper mapper) + : ILiveEmbedAccessor +{ + public async Task GetByIdAsync(string guildId) + { + var entity = await context + .LiveEmbeds + .FirstOrDefaultAsync(x => x.GuildId == guildId); + + if (entity == null) + { + entity = new() + { + GuildId = guildId, + Header = "%CHANNEL% is now streaming!", + DescriptionLabel = "Stream Description", + Description = "%CHANNEL% is currently playing %GAME%", + LastStreamed = "Last Streamed", + AverageStream = "Average Stream", + StreamDescription = "%DESCRIPTION%", + FooterStopped = "Powered by 100% Couch • Stopped streaming", + FooterStart = "Powered by 100% Couch • Started streaming", + ChannelButton = "Creator Channel", + }; + + await context + .LiveEmbeds + .AddAsync(entity); + await context + .SaveChangesAsync(); + } + + return mapper.Map(entity); + } + + public async Task UpdateAsync(LiveEmbedDto entity) + { + var embed = await context + .LiveEmbeds + .FirstOrDefaultAsync(x => x.GuildId == entity.GuildId) + .ConfigureAwait(false); + + if (embed == null) + { + return null; + } + + embed.AverageStream = entity.AverageStream; + embed.ChannelButton = entity.ChannelButton; + embed.Description = entity.Description; + embed.DescriptionLabel = entity.DescriptionLabel; + embed.FooterStart = entity.FooterStart; + embed.FooterStopped = entity.FooterStopped; + embed.Header = entity.Header; + embed.LastStreamed = entity.LastStreamed; + embed.StreamDescription = entity.StreamDescription; + + await context + .SaveChangesAsync() + .ConfigureAwait(false); + + return mapper.Map(embed); + } +} \ No newline at end of file diff --git a/src/CB.Accessors/Implementations/VodEmbedAccessor.cs b/src/CB.Accessors/Implementations/VodEmbedAccessor.cs new file mode 100644 index 0000000..7a505bb --- /dev/null +++ b/src/CB.Accessors/Implementations/VodEmbedAccessor.cs @@ -0,0 +1,65 @@ +using AutoMapper; +using CB.Accessors.Contracts; +using CB.Data; +using CB.Shared.Dtos; +using Microsoft.EntityFrameworkCore; + +namespace CB.Accessors.Implementations; + +public class VodEmbedAccessor(CbContext context, + IMapper mapper) + : IVodEmbedAccessor +{ + public async Task GetByIdAsync(string guildId) + { + var entity = await context + .VodEmbeds + .FirstOrDefaultAsync(x => x.GuildId == guildId); + + if (entity == null) + { + entity = new() + { + GuildId = guildId, + Header = "%CHANNEL% has published a new video!", + Description = "%DESCRIPTION%", + DescriptionLabel = "Video Description", + Footer = "Powered by 100% Couch", + ChannelButton = "Creator Channel!", + }; + + await context + .VodEmbeds + .AddAsync(entity); + await context + .SaveChangesAsync(); + } + + return mapper.Map(entity); + } + + public async Task UpdateAsync(VodEmbedDto entity) + { + var embed = await context + .VodEmbeds + .FirstOrDefaultAsync(x => x.GuildId == entity.GuildId) + .ConfigureAwait(false); + + if (embed == null) + { + return null; + } + + embed.Header = entity.Header; + embed.ChannelButton = entity.ChannelButton; + embed.Description = entity.Description; + embed.DescriptionLabel = entity.DescriptionLabel; + embed.Footer = entity.Footer; + + await context + .SaveChangesAsync() + .ConfigureAwait(false); + + return mapper.Map(embed); + } +} \ No newline at end of file diff --git a/src/CB.Bot/CB.Bot.csproj b/src/CB.Bot/CB.Bot.csproj index 4844deb..eb0e897 100644 --- a/src/CB.Bot/CB.Bot.csproj +++ b/src/CB.Bot/CB.Bot.csproj @@ -21,8 +21,4 @@ - - - - diff --git a/src/CB.Bot/Commands/Application/CustomizationCommands.cs b/src/CB.Bot/Commands/Application/CustomizationCommands.cs new file mode 100644 index 0000000..f2161ed --- /dev/null +++ b/src/CB.Bot/Commands/Application/CustomizationCommands.cs @@ -0,0 +1,93 @@ +using CB.Accessors.Contracts; +using Discord; +using Discord.Interactions; + +namespace CB.Bot.Commands.Application; + +public enum CustomizeType +{ +Clips, +Vod, +Live1, +Live2, +} + +// TODO this is WIP +public class CustomizationCommands(IGuildAccessor guildAccessor, + IClipEmbedAccessor clipEmbedAccessor, + ILiveEmbedAccessor liveEmbedAccessor, + IVodEmbedAccessor vodEmbedAccessor) : BaseSlashCommands +{ + //private readonly IGuildAccessor _guildAccessor; + //private readonly IClipEmbedAccessor _clipEmbedAccessor; + //private readonly ILiveEmbedAccessor _liveEmbedAccessor; + //private readonly IVodEmbedAccessor _vodEmbedAccessor; + + //public CustomizationCommands(IGuildAccessor guildAccessor, + // IServiceScopeFactory serviceScopeFactory) + //{ + // _guildAccessor = guildAccessor; + + // var scope = serviceScopeFactory.CreateScope(); + // _clipEmbedAccessor = scope.ServiceProvider.GetRequiredService(); + // _liveEmbedAccessor = scope.ServiceProvider.GetRequiredService(); + // _vodEmbedAccessor = scope.ServiceProvider.GetRequiredService(); + //} + + [SlashCommand("customize", "Announcement customization")] + public async Task CustomizeAsync(CustomizeType type) + { + await DeferAsync(true); + if (Context.User.Id != 93015586698727424) + { + return; + } + + switch (type) + { + case CustomizeType.Clips: + var clipEmbed = await clipEmbedAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); + await Context.Interaction.RespondWithModalAsync(new ModalBuilder() + .WithTitle("Customize Your Clips Embed!") + .WithCustomId($"clips_{Context.Guild.Id}_{Guid.NewGuid().ToString().Replace("-", "")}") + .AddTextInput("Header", "Header", placeholder: "New Clip @ %CHANNEL%", required: false, value: clipEmbed.Header) + .AddTextInput("Description", "Description", placeholder: "%DESCRIPTION%", required: false, value: clipEmbed.Description) + .AddTextInput("Footer", "Footer", placeholder: "Powered by 100% Couch • Created by %CHANNEL%", required: false, value: clipEmbed.Footer) + .AddTextInput("Watch Button", "WatchButton", placeholder: "Watch this Clip!", required: false, value: clipEmbed.WatchButton) + .AddTextInput("More Button", "MoreButton", placeholder: "And More!", required: false, value: clipEmbed.MoreButton).Build()); + break; + case CustomizeType.Vod: + var vodEmbed = await vodEmbedAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); + await Context.Interaction.RespondWithModalAsync(new ModalBuilder() + .WithTitle("Customize Your VOD Embed!") + .WithCustomId($"vod_{Context.Guild.Id}_{Guid.NewGuid().ToString().Replace("-", "")}") + .AddTextInput("Header", "Header", placeholder: "%CHANNEL% has published a new video!", required: false, value: vodEmbed.Header) + .AddTextInput("Description Label", "DescriptionLabel", placeholder: "Video Description", required: false, value: vodEmbed.DescriptionLabel) + .AddTextInput("Description", "Description", placeholder: "%DESCRIPTION%", required: false, value: vodEmbed.Description) + .AddTextInput("Footer", "Footer", placeholder: "Powered by 100% Couch", required: false, value: vodEmbed.Footer) + .AddTextInput("Channel Button", "ChannelButton", placeholder: "Creator Channel!", required: false, value: vodEmbed.ChannelButton).Build()); + break; + case CustomizeType.Live1: + var liveEmbed1 = await liveEmbedAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); + await Context.Interaction.RespondWithModalAsync(new ModalBuilder() + .WithTitle("Customize Your Live Embed (1/2)!") + .WithCustomId($"live_{Context.Guild.Id}_{Guid.NewGuid().ToString().Replace("-", "")}") + .AddTextInput("Header", "Header", placeholder: "%CHANNEL% is now streaming!", required: false, value: liveEmbed1.Header) + .AddTextInput("Description", "Description", placeholder: "%CHANNEL% is currently playing %GAME%", required: false, value: liveEmbed1.Description) + .AddTextInput("Last Streamed Label", "LastStreamed", placeholder: "Last Streamed", required: false, value: liveEmbed1.LastStreamed) + .AddTextInput("Average Stream Label", "AverageStream", placeholder: "Average Stream", required: false, value: liveEmbed1.AverageStream).Build()); + break; + case CustomizeType.Live2: + var liveEmbed2 = await liveEmbedAccessor.GetByIdAsync(SocketInteraction.GuildId.ToString()); + await Context.Interaction.RespondWithModalAsync(new ModalBuilder() + .WithTitle("Customize Your Live Embed (2/2)!") + .WithCustomId($"live_{Context.Guild.Id}_{Guid.NewGuid().ToString().Replace("-", "")}") + .AddTextInput("Description Label", "DescriptionLabel", placeholder: "Stream Description", required: false, value: liveEmbed2.DescriptionLabel) + .AddTextInput("Stream Description", "StreamDescription", placeholder: "%DESCRIPTION%", required: false, value: liveEmbed2.StreamDescription) + .AddTextInput("Footer Start", "FooterStart", placeholder: "Powered by 100% Couch • Started streaming", required: false, value: liveEmbed2.FooterStart) + .AddTextInput("Footer Stopped", "FooterStopped", placeholder: "Powered by 100% Couch • Stopped streaming", required: false, value: liveEmbed2.FooterStopped) + .AddTextInput("Channel Button", "ChannelButton", placeholder: "Creator Channel", required: false, value: liveEmbed2.ChannelButton).Build()); + break; + } + } +} \ No newline at end of file diff --git a/src/CB.Bot/Program.cs b/src/CB.Bot/Program.cs index 697607f..826290d 100644 --- a/src/CB.Bot/Program.cs +++ b/src/CB.Bot/Program.cs @@ -2,6 +2,8 @@ using CB.Accessors.Implementations; using CB.Bot.Services; using CB.Data; +using CB.Engines.Contracts; +using CB.Engines.Implementations; using CB.Shared.Dtos; using Discord; using Discord.Commands; @@ -42,12 +44,14 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddDbContext(options => options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"))); builder.Services.AddAutoMapper(cfg => { }, typeof(CbProfile)); builder.Services.AddHostedService(); - +builder.Services.AddHttpClient(); var host = builder.Build(); host.Run(); diff --git a/src/CB.Bot/Services/MessageInteractionService.cs b/src/CB.Bot/Services/MessageInteractionService.cs index d1174ab..1d65f4c 100644 --- a/src/CB.Bot/Services/MessageInteractionService.cs +++ b/src/CB.Bot/Services/MessageInteractionService.cs @@ -1,6 +1,5 @@ using System.Text; using CB.Accessors.Contracts; -using CB.Accessors.Implementations; using CB.Engines.Contracts; using CB.Shared; using CB.Shared.Enums; @@ -14,16 +13,26 @@ namespace CB.Bot.Services; -public class MessageInteractionService(DropdownPayloadAccessor dropdownPayloadAccessor, - DiscordSocketClient discordSocketClient, - IAllowConfigurationAccessor allowConfigurationAccessor, - IGuildAccessor guildAccessor, - IGuildConfigurationAccessor guildConfigurationAccessor, - IYouTubeAccessor youTubeAccessor, - ICreatorEngine creatorEngine) +public class MessageInteractionService(DiscordSocketClient discordSocketClient, + IServiceScopeFactory serviceScopeFactory) { + private IAllowConfigurationAccessor _allowConfigurationAccessor; + private IDropdownPayloadAccessor _dropdownPayloadAccessor; + private IGuildAccessor _guildAccessor; + private IGuildConfigurationAccessor _guildConfigurationAccessor; + private IYouTubeAccessor _youTubeAccessor; + private ICreatorEngine _creatorEngine; + public void Init() { + var scope = serviceScopeFactory.CreateScope(); + _allowConfigurationAccessor = scope.ServiceProvider.GetRequiredService(); + _dropdownPayloadAccessor = scope.ServiceProvider.GetRequiredService(); + _guildAccessor = scope.ServiceProvider.GetRequiredService(); + _guildConfigurationAccessor = scope.ServiceProvider.GetRequiredService(); + _youTubeAccessor = scope.ServiceProvider.GetRequiredService(); + _creatorEngine = scope.ServiceProvider.GetRequiredService(); + discordSocketClient.SelectMenuExecuted += DiscordSelectMenuChanged; } @@ -31,10 +40,7 @@ private async Task DiscordSelectMenuChanged(SocketMessageComponent arg) { var guildChannel = (IGuildChannel)arg.Channel; - if (arg.Data.CustomId.StartsWith("YouTube")) - { - await arg.DeferAsync(); - } + await arg.DeferAsync(); var creatorId = ulong.Parse(arg.Data.CustomId.Split(".")[1]); @@ -46,7 +52,7 @@ private async Task DiscordSelectMenuChanged(SocketMessageComponent arg) var dropdownPayloadId = int.Parse(arg.Data.CustomId.Split(".")[2]); - var payload = await dropdownPayloadAccessor.GetByIdAsync(dropdownPayloadId); + var payload = await _dropdownPayloadAccessor.GetByIdAsync(dropdownPayloadId); switch (Enum.Parse(payload.DropdownType)) { @@ -73,7 +79,7 @@ private async Task ProcessAllowDropdownAsync(ISocketMessageChannel channel, IReadOnlyCollection options, SocketMessageComponent message) { - var guild = await guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); + var guild = await _guildAccessor.GetByIdAsync(discordGuild.Id.ToString()); if (guild == null) { return; @@ -177,14 +183,11 @@ private async Task ProcessAllowDropdownAsync(ISocketMessageChannel channel, } } - await allowConfigurationAccessor.UpdateAsync(guild.Id, guild.AllowConfiguration); - await guildConfigurationAccessor.UpdateAsync(guild.Id, guild.GuildConfiguration); + await _allowConfigurationAccessor.UpdateAsync(guild.Id, guild.AllowConfiguration); + await _guildConfigurationAccessor.UpdateAsync(guild.Id, guild.GuildConfiguration); - await message.UpdateAsync(x => - { - x.Content = response.ToString(); - x.Components = null; - }); + await message.FollowupAsync(response.ToString(), ephemeral: true); + await message.DeleteOriginalResponseAsync(); } private string GetStatusOutput(IGuild guild, bool oldValue, bool newValue, string setting) @@ -205,11 +208,11 @@ private async Task ProcessYouTubeCreatorDropdownAsync( { var guildChannel = (IGuildChannel)arg.Channel; var discordUser = (IGuildUser)arg.User; - var guild = await guildAccessor.GetByIdAsync(guildChannel.GuildId.ToString()); - var youTubeChannel = await youTubeAccessor.GetYouTubeChannelByIdAsync(comp.Data.Values.FirstOrDefault()); + var guild = await _guildAccessor.GetByIdAsync(guildChannel.GuildId.ToString()); + var youTubeChannel = await _youTubeAccessor.GetYouTubeChannelByIdAsync(comp.Data.Values.FirstOrDefault()); var discordGuildChannel = discordSocketClient.GetChannel(creatorPayload.ChannelId); - await creatorEngine.ToggleCreatorAsync( + await _creatorEngine.ToggleCreatorAsync( new ChannelValidityResponse { ChannelId = comp.Data.Values.FirstOrDefault(), diff --git a/src/CB.Data/CbContext.cs b/src/CB.Data/CbContext.cs index a611e30..1dd9536 100644 --- a/src/CB.Data/CbContext.cs +++ b/src/CB.Data/CbContext.cs @@ -8,12 +8,16 @@ public class CbContext(DbContextOptions options) : DbContext(options) public DbSet AllowConfigurations => Set(); public DbSet Channels => Set(); public DbSet ChannelConfigurations => Set(); + public DbSet ClipEmbeds => Set(); public DbSet Creators => Set(); public DbSet CreatorChannels => Set(); public DbSet DropdownPayloads => Set(); public DbSet Guilds => Set(); public DbSet GuildConfigurations => Set(); + public DbSet LiveEmbeds => Set(); public DbSet Users => Set(); + public DbSet VodEmbeds => Set(); + protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -138,6 +142,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasForeignKey(x => x.GuildId) .OnDelete(DeleteBehavior.Cascade); + modelBuilder.Entity() + .HasOne(x => x.ClipEmbed) + .WithOne(x => x.Guild) + .HasForeignKey(x => x.GuildId) + .OnDelete(DeleteBehavior.Cascade); + + modelBuilder.Entity() + .HasOne(x => x.LiveEmbed) + .WithOne(x => x.Guild) + .HasForeignKey(x => x.GuildId) + .OnDelete(DeleteBehavior.Cascade); + + modelBuilder.Entity() + .HasOne(x => x.VodEmbed) + .WithOne(x => x.Guild) + .HasForeignKey(x => x.GuildId) + .OnDelete(DeleteBehavior.Cascade); + modelBuilder.Entity() .HasOne(x => x.Owner) .WithMany(x => x.Guilds) diff --git a/src/CB.Data/Entities/ClipEmbed.cs b/src/CB.Data/Entities/ClipEmbed.cs new file mode 100644 index 0000000..de3d7bd --- /dev/null +++ b/src/CB.Data/Entities/ClipEmbed.cs @@ -0,0 +1,18 @@ +namespace CB.Data.Entities; + +public class ClipEmbed +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string Description { get; set; } + + public string Footer { get; set; } + + public string WatchButton { get; set; } + + public string MoreButton { get; set; } + + public virtual Guild Guild { get; set; } +} \ No newline at end of file diff --git a/src/CB.Data/Entities/Guild.cs b/src/CB.Data/Entities/Guild.cs index 71793f6..164e6f1 100644 --- a/src/CB.Data/Entities/Guild.cs +++ b/src/CB.Data/Entities/Guild.cs @@ -22,4 +22,7 @@ public class Guild public virtual GuildConfiguration GuildConfiguration { get; set; } public virtual MessageConfiguration MessageConfiguration { get; set; } public virtual RoleConfiguration RoleConfiguration { get; set; } + public virtual ClipEmbed ClipEmbed { get; set; } + public virtual LiveEmbed LiveEmbed { get; set; } + public virtual VodEmbed VodEmbed { get; set; } } \ No newline at end of file diff --git a/src/CB.Data/Entities/LiveEmbed.cs b/src/CB.Data/Entities/LiveEmbed.cs new file mode 100644 index 0000000..2d2ef1e --- /dev/null +++ b/src/CB.Data/Entities/LiveEmbed.cs @@ -0,0 +1,26 @@ +namespace CB.Data.Entities; + +public class LiveEmbed +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string Description { get; set; } + + public string LastStreamed { get; set; } + + public string AverageStream { get; set; } + + public string DescriptionLabel { get; set; } + + public string StreamDescription { get; set; } + + public string FooterStart { get; set; } + + public string FooterStopped { get; set; } + + public string ChannelButton { get; set; } + + public virtual Guild Guild { get; set; } +} \ No newline at end of file diff --git a/src/CB.Data/Entities/VodEmbed.cs b/src/CB.Data/Entities/VodEmbed.cs new file mode 100644 index 0000000..f490b97 --- /dev/null +++ b/src/CB.Data/Entities/VodEmbed.cs @@ -0,0 +1,18 @@ +namespace CB.Data.Entities; + +public class VodEmbed +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string DescriptionLabel { get; set; } + + public string Description { get; set; } + + public string Footer { get; set; } + + public string ChannelButton { get; set; } + + public virtual Guild Guild { get; set; } +} \ No newline at end of file diff --git a/src/CB.Data/Migrations/20250717022001_7162025-919p.Designer.cs b/src/CB.Data/Migrations/20250717022001_7162025-919p.Designer.cs new file mode 100644 index 0000000..23d73cb --- /dev/null +++ b/src/CB.Data/Migrations/20250717022001_7162025-919p.Designer.cs @@ -0,0 +1,470 @@ +// +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("20250717022001_7162025-919p")] + partial class _7162025919p + { + /// + 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.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.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.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.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.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.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.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.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.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.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.Channel", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Guild", b => + { + b.Navigation("AllowConfiguration"); + + b.Navigation("ChannelConfiguration"); + + b.Navigation("Channels"); + + b.Navigation("GuildConfiguration"); + + b.Navigation("MessageConfiguration"); + + b.Navigation("RoleConfiguration"); + }); + + 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/20250717022001_7162025-919p.cs b/src/CB.Data/Migrations/20250717022001_7162025-919p.cs new file mode 100644 index 0000000..adf2891 --- /dev/null +++ b/src/CB.Data/Migrations/20250717022001_7162025-919p.cs @@ -0,0 +1,121 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CB.Data.Migrations +{ + /// + public partial class _7162025919p : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AllowConfiguration_Guilds_GuildId", + table: "AllowConfiguration"); + + migrationBuilder.DropPrimaryKey( + name: "PK_AllowConfiguration", + table: "AllowConfiguration"); + + migrationBuilder.RenameTable( + name: "AllowConfiguration", + newName: "AllowConfigurations"); + + migrationBuilder.AddPrimaryKey( + name: "PK_AllowConfigurations", + table: "AllowConfigurations", + column: "GuildId"); + + migrationBuilder.CreateTable( + name: "CreatorChannels", + columns: table => new + { + CreatorId = table.Column(type: "bigint", nullable: false), + ChannelId = table.Column(type: "text", nullable: false), + ChannelTypeId = table.Column(type: "integer", nullable: false), + CustomMessage = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CreatorChannels", x => new { x.CreatorId, x.ChannelId }); + table.ForeignKey( + name: "FK_CreatorChannels_Channels_ChannelId", + column: x => x.ChannelId, + principalTable: "Channels", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CreatorChannels_Creators_CreatorId", + column: x => x.CreatorId, + principalTable: "Creators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DropdownPayloads", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Payload = table.Column(type: "text", nullable: true), + DropdownType = table.Column(type: "text", nullable: true), + OriginalMessageId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DropdownPayloads", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CreatorChannels_ChannelId", + table: "CreatorChannels", + column: "ChannelId"); + + migrationBuilder.AddForeignKey( + name: "FK_AllowConfigurations_Guilds_GuildId", + table: "AllowConfigurations", + column: "GuildId", + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AllowConfigurations_Guilds_GuildId", + table: "AllowConfigurations"); + + migrationBuilder.DropTable( + name: "CreatorChannels"); + + migrationBuilder.DropTable( + name: "DropdownPayloads"); + + migrationBuilder.DropPrimaryKey( + name: "PK_AllowConfigurations", + table: "AllowConfigurations"); + + migrationBuilder.RenameTable( + name: "AllowConfigurations", + newName: "AllowConfiguration"); + + migrationBuilder.AddPrimaryKey( + name: "PK_AllowConfiguration", + table: "AllowConfiguration", + column: "GuildId"); + + migrationBuilder.AddForeignKey( + name: "FK_AllowConfiguration_Guilds_GuildId", + table: "AllowConfiguration", + column: "GuildId", + principalTable: "Guilds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/src/CB.Data/Migrations/CbContextModelSnapshot.cs b/src/CB.Data/Migrations/CbContextModelSnapshot.cs index ce80fd1..3047471 100644 --- a/src/CB.Data/Migrations/CbContextModelSnapshot.cs +++ b/src/CB.Data/Migrations/CbContextModelSnapshot.cs @@ -59,7 +59,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("GuildId"); - b.ToTable("AllowConfiguration"); + b.ToTable("AllowConfigurations"); }); modelBuilder.Entity("CB.Data.Entities.Channel", b => @@ -152,6 +152,49 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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.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.Guild", b => { b.Property("Id") @@ -325,6 +368,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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.Guild", b => { b.HasOne("CB.Data.Entities.User", "Owner") @@ -368,6 +430,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Guild"); }); + modelBuilder.Entity("CB.Data.Entities.Channel", b => + { + b.Navigation("CreatorChannels"); + }); + + modelBuilder.Entity("CB.Data.Entities.Creator", b => + { + b.Navigation("CreatorChannels"); + }); + modelBuilder.Entity("CB.Data.Entities.Guild", b => { b.Navigation("AllowConfiguration"); diff --git a/src/CB.Shared/Dtos/AllowConfigurationDto.cs b/src/CB.Shared/Dtos/AllowConfigurationDto.cs index 313282b..cfe83ec 100644 --- a/src/CB.Shared/Dtos/AllowConfigurationDto.cs +++ b/src/CB.Shared/Dtos/AllowConfigurationDto.cs @@ -1,10 +1,7 @@ -using System.ComponentModel.DataAnnotations; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class AllowConfigurationDto { - [Key] public string GuildId { get; set; } public bool AllowLive { get; set; } diff --git a/src/CB.Shared/Dtos/CbProfile.cs b/src/CB.Shared/Dtos/CbProfile.cs index a40e987..12eee4f 100644 --- a/src/CB.Shared/Dtos/CbProfile.cs +++ b/src/CB.Shared/Dtos/CbProfile.cs @@ -10,13 +10,16 @@ public CbProfile() CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/ChannelConfiguration.cs b/src/CB.Shared/Dtos/ChannelConfiguration.cs index 36e639e..3a50c1f 100644 --- a/src/CB.Shared/Dtos/ChannelConfiguration.cs +++ b/src/CB.Shared/Dtos/ChannelConfiguration.cs @@ -1,10 +1,7 @@ -using System.ComponentModel.DataAnnotations; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class ChannelConfigurationDto { - [Key] public string GuildId { get; set; } public string? GreetingChannelId { get; set; } diff --git a/src/CB.Shared/Dtos/ChannelDto.cs b/src/CB.Shared/Dtos/ChannelDto.cs index e5e46ed..13ff205 100644 --- a/src/CB.Shared/Dtos/ChannelDto.cs +++ b/src/CB.Shared/Dtos/ChannelDto.cs @@ -1,11 +1,7 @@ -using System.ComponentModel.DataAnnotations; -using CB.Data.Entities; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class ChannelDto { - [Key] public string Id { get; set; } public string DisplayName { get; set; } diff --git a/src/CB.Shared/Dtos/ClipEmbedDto.cs b/src/CB.Shared/Dtos/ClipEmbedDto.cs new file mode 100644 index 0000000..c04cde8 --- /dev/null +++ b/src/CB.Shared/Dtos/ClipEmbedDto.cs @@ -0,0 +1,18 @@ +namespace CB.Shared.Dtos; + +public class ClipEmbedDto +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string Description { get; set; } + + public string Footer { get; set; } + + public string WatchButton { get; set; } + + public string MoreButton { get; set; } + + public virtual GuildDto Guild { get; set; } +} \ No newline at end of file diff --git a/src/CB.Shared/Dtos/GuildConfiguration.cs b/src/CB.Shared/Dtos/GuildConfiguration.cs index aceed0a..310eebf 100644 --- a/src/CB.Shared/Dtos/GuildConfiguration.cs +++ b/src/CB.Shared/Dtos/GuildConfiguration.cs @@ -1,11 +1,8 @@ -using System.ComponentModel.DataAnnotations; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class GuildConfigurationDto { - [Key] - public string GuildId { get; set; } +public string GuildId { get; set; } public bool TextAnnouncements { get; set; } public bool DeleteOffline { get; set; } diff --git a/src/CB.Shared/Dtos/GuildDto.cs b/src/CB.Shared/Dtos/GuildDto.cs index 7d67c9a..7294543 100644 --- a/src/CB.Shared/Dtos/GuildDto.cs +++ b/src/CB.Shared/Dtos/GuildDto.cs @@ -22,4 +22,7 @@ public class GuildDto 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; } } \ No newline at end of file diff --git a/src/CB.Shared/Dtos/LiveEmbedDto.cs b/src/CB.Shared/Dtos/LiveEmbedDto.cs new file mode 100644 index 0000000..6a789b9 --- /dev/null +++ b/src/CB.Shared/Dtos/LiveEmbedDto.cs @@ -0,0 +1,26 @@ +namespace CB.Shared.Dtos; + +public class LiveEmbedDto +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string Description { get; set; } + + public string LastStreamed { get; set; } + + public string AverageStream { get; set; } + + public string DescriptionLabel { get; set; } + + public string StreamDescription { get; set; } + + public string FooterStart { get; set; } + + public string FooterStopped { get; set; } + + public string ChannelButton { 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 76a95a3..78c194b 100644 --- a/src/CB.Shared/Dtos/MessageConfigurationDto.cs +++ b/src/CB.Shared/Dtos/MessageConfigurationDto.cs @@ -1,10 +1,7 @@ -using System.ComponentModel.DataAnnotations; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class MessageConfigurationDto { - [Key] public string GuildId { get; set; } public string GreetingMessage { get; set; } diff --git a/src/CB.Shared/Dtos/RoleConfigurationDto.cs b/src/CB.Shared/Dtos/RoleConfigurationDto.cs index 940b422..8750e34 100644 --- a/src/CB.Shared/Dtos/RoleConfigurationDto.cs +++ b/src/CB.Shared/Dtos/RoleConfigurationDto.cs @@ -1,10 +1,7 @@ -using System.ComponentModel.DataAnnotations; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class RoleConfigurationDto { - [Key] public string GuildId { get; set; } public string JoinRoleId { get; set; } diff --git a/src/CB.Shared/Dtos/UserDto.cs b/src/CB.Shared/Dtos/UserDto.cs index af60f32..1315e42 100644 --- a/src/CB.Shared/Dtos/UserDto.cs +++ b/src/CB.Shared/Dtos/UserDto.cs @@ -1,19 +1,13 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace CB.Shared.Dtos; +namespace CB.Shared.Dtos; public class UserDto { - [Key] - public string Id { get; set; } +public string Id { get; set; } public string DisplayName { get; set; } - [Column(TypeName = "timestamp without time zone")] public DateTime CreatedDate { get; set; } - [Column(TypeName = "timestamp without time zone")] public DateTime ModifiedDate { get; set; } public virtual ICollection Guilds { get; set; } diff --git a/src/CB.Shared/Dtos/VodEmbedDto.cs b/src/CB.Shared/Dtos/VodEmbedDto.cs new file mode 100644 index 0000000..d948fae --- /dev/null +++ b/src/CB.Shared/Dtos/VodEmbedDto.cs @@ -0,0 +1,18 @@ +namespace CB.Shared.Dtos; + +public class VodEmbedDto +{ + public string GuildId { get; set; } + + public string Header { get; set; } + + public string DescriptionLabel { get; set; } + + public string Description { get; set; } + + public string Footer { get; set; } + + public string ChannelButton { get; set; } + + public virtual GuildDto Guild { get; set; } +} \ No newline at end of file diff --git a/src/CB.Shared/Models/Twitch/TwitchUserResponse.cs b/src/CB.Shared/Models/Twitch/TwitchUserResponse.cs index cd5fa8e..478dc24 100644 --- a/src/CB.Shared/Models/Twitch/TwitchUserResponse.cs +++ b/src/CB.Shared/Models/Twitch/TwitchUserResponse.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; +using Newtonsoft.Json; namespace CouchBot.Domain.Models.Twitch; diff --git a/src/CB.Shared/Models/YouTube/LiveChatStatusResponse.cs b/src/CB.Shared/Models/YouTube/LiveChatStatusResponse.cs index 1bdb57d..3bb7518 100644 --- a/src/CB.Shared/Models/YouTube/LiveChatStatusResponse.cs +++ b/src/CB.Shared/Models/YouTube/LiveChatStatusResponse.cs @@ -1,6 +1,4 @@ -using Newtonsoft.Json; - -namespace CB.Shared.Models.YouTube; +namespace CB.Shared.Models.YouTube; public class LiveChatStatusResponse { diff --git a/src/CB.Shared/Models/YouTube/YouTubeVideoListResponse.cs b/src/CB.Shared/Models/YouTube/YouTubeVideoListResponse.cs index 850e93d..b70e7f2 100644 --- a/src/CB.Shared/Models/YouTube/YouTubeVideoListResponse.cs +++ b/src/CB.Shared/Models/YouTube/YouTubeVideoListResponse.cs @@ -1,6 +1,4 @@ -using Newtonsoft.Json; - -namespace CB.Shared.Models.YouTube; +namespace CB.Shared.Models.YouTube; public class YouTubeVideoListResponse {