diff --git a/src/Huppy/Huppy.Core/Models/CommandLog.cs b/src/Huppy/Huppy.Core/Models/CommandLog.cs index 21bd96c..0792b2e 100644 --- a/src/Huppy/Huppy.Core/Models/CommandLog.cs +++ b/src/Huppy/Huppy.Core/Models/CommandLog.cs @@ -1,9 +1,10 @@ -using Huppy.Kernel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Huppy.Kernel; namespace Huppy.Core.Models { + [Obsolete] public class CommandLog : DbModel { [Key] diff --git a/src/Huppy/Huppy.Core/Models/Reminder.cs b/src/Huppy/Huppy.Core/Models/Reminder.cs index 7c7d2bd..c2f871b 100644 --- a/src/Huppy/Huppy.Core/Models/Reminder.cs +++ b/src/Huppy/Huppy.Core/Models/Reminder.cs @@ -1,8 +1,9 @@ -using Huppy.Kernel; using System.ComponentModel.DataAnnotations.Schema; +using Huppy.Kernel; namespace Huppy.Core.Models { + [Obsolete] public class Reminder : DbModel { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/src/Huppy/Huppy.Core/Models/Server.cs b/src/Huppy/Huppy.Core/Models/Server.cs index 5f6f6fa..28c7f4e 100644 --- a/src/Huppy/Huppy.Core/Models/Server.cs +++ b/src/Huppy/Huppy.Core/Models/Server.cs @@ -1,9 +1,10 @@ -using Huppy.Kernel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Huppy.Kernel; namespace Huppy.Core.Models { + [Obsolete] public class Server : DbModel { [Key] diff --git a/src/Huppy/Huppy.Core/Models/ServerRooms.cs b/src/Huppy/Huppy.Core/Models/ServerRooms.cs index 326d89c..61ac71f 100644 --- a/src/Huppy/Huppy.Core/Models/ServerRooms.cs +++ b/src/Huppy/Huppy.Core/Models/ServerRooms.cs @@ -4,6 +4,7 @@ namespace Huppy.Core.Models { + [Obsolete] public class ServerRooms : DbModel { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/src/Huppy/Huppy.Core/Models/Ticket.cs b/src/Huppy/Huppy.Core/Models/Ticket.cs index 1c30af1..bed58ba 100644 --- a/src/Huppy/Huppy.Core/Models/Ticket.cs +++ b/src/Huppy/Huppy.Core/Models/Ticket.cs @@ -1,9 +1,10 @@ -using Huppy.Kernel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Huppy.Kernel; namespace Huppy.Core.Models { + [Obsolete] public class Ticket : DbModel { [Key] diff --git a/src/Huppy/Huppy.Infrastructure/HuppyDbContext.cs b/src/Huppy/Huppy.Infrastructure/HuppyDbContext.cs index 941b70c..84eae0b 100644 --- a/src/Huppy/Huppy.Infrastructure/HuppyDbContext.cs +++ b/src/Huppy/Huppy.Infrastructure/HuppyDbContext.cs @@ -13,17 +13,17 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { protected override void OnModelCreating(ModelBuilder builder) { - builder.Entity() - .HasOne(e => e.Rooms) - .WithOne(e => e.Server) - .HasForeignKey(k => k.Id) - .OnDelete(DeleteBehavior.Cascade); + // builder.Entity() + // .HasOne(e => e.Rooms) + // .WithOne(e => e.Server) + // .HasForeignKey(k => k.Id) + // .OnDelete(DeleteBehavior.Cascade); } public DbSet Users { get; set; } - public DbSet CommandLogs { get; set; } - public DbSet Servers { get; set; } - public DbSet Reminders { get; set; } - public DbSet Tickets { get; set; } + // public DbSet CommandLogs { get; set; } + // public DbSet Servers { get; set; } + // public DbSet Reminders { get; set; } + // public DbSet Tickets { get; set; } } } \ No newline at end of file diff --git a/src/Huppy/Huppy.Infrastructure/Repositories/CommandLogRepository.cs b/src/Huppy/Huppy.Infrastructure/Repositories/CommandLogRepository.cs deleted file mode 100644 index 3f34664..0000000 --- a/src/Huppy/Huppy.Infrastructure/Repositories/CommandLogRepository.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Huppy.Core.Entities; -using Huppy.Core.Interfaces.IRepositories; -using Huppy.Core.Models; -using Huppy.Kernel.Abstraction; -using Microsoft.EntityFrameworkCore; - -namespace Huppy.Infrastructure.Repositories -{ - [Obsolete] - public class CommandLogRepository : BaseRepository, ICommandLogRepository - { - public CommandLogRepository(HuppyDbContext context) : base(context) { } - - public async Task GetCount() => await _context.CommandLogs.CountAsync(); - - public async Task> GetAiUsage() - { - Dictionary result = new(); - - var commandLogs = await _context.CommandLogs?.Include(e => e.User) - .ToListAsync()!; - - var uniqueUsers = commandLogs.GroupBy(e => e.UserId) - .Select(e => e.First()) - .ToList(); - - foreach (var user in uniqueUsers) - { - result.TryAdd(user.UserId, new AiUser - { - Username = user.User!.Username, - Count = commandLogs.Where(x => x.UserId == user.UserId) - .Count() - }); - } - - return result; - } - } -} \ No newline at end of file diff --git a/src/Huppy/Huppy.Infrastructure/Repositories/ReminderRepository.cs b/src/Huppy/Huppy.Infrastructure/Repositories/ReminderRepository.cs deleted file mode 100644 index 4a860b8..0000000 --- a/src/Huppy/Huppy.Infrastructure/Repositories/ReminderRepository.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Huppy.Core.Interfaces.IRepositories; -using Huppy.Core.Models; -using Huppy.Kernel.Abstraction; -using Microsoft.EntityFrameworkCore; - -namespace Huppy.Infrastructure.Repositories -{ - public class ReminderRepository : BaseRepository, IReminderRepository - { - public ReminderRepository(HuppyDbContext context) : base(context) { } - - public async Task GetAsync(ulong userId, int id) - { - return await _context.Reminders.FirstOrDefaultAsync(e => e.Id == id && e.UserId == userId); - } - - public async Task RemoveRangeAsync(ICollection reminderIds) - { - if (reminderIds is null) return; - - var reminders = await _context.Reminders - .Where(reminder => reminderIds.Contains(reminder.Id)) - .ToListAsync(); - - _context.Reminders.RemoveRange(reminders); - await _context.SaveChangesAsync(); - } - } -} \ No newline at end of file diff --git a/src/Huppy/Huppy.Infrastructure/Repositories/ServerRepository.cs b/src/Huppy/Huppy.Infrastructure/Repositories/ServerRepository.cs deleted file mode 100644 index 0decb46..0000000 --- a/src/Huppy/Huppy.Infrastructure/Repositories/ServerRepository.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Discord.Interactions; -using Huppy.Core.Interfaces.IRepositories; -using Huppy.Core.Models; -using Huppy.Kernel.Abstraction; -using Microsoft.EntityFrameworkCore; - -namespace Huppy.Infrastructure.Repositories -{ - public class ServerRepository : BaseRepository, IServerRepository - { - public ServerRepository(HuppyDbContext context) : base(context) { } - - public override async Task GetAsync(ulong id) - { - return await _context.Servers.Include(e => e.Rooms).FirstOrDefaultAsync(entry => entry.Id == id); - } - - public async Task GetOrCreateAsync(ShardedInteractionContext DiscordContext) - { - var server = await GetAsync(DiscordContext.Guild.Id); - - if (server is not null) - { - if (server.Rooms is null) - { - server.Rooms = new() - { - OutputRoom = DiscordContext.Guild.DefaultChannel.Id, - GreetingRoom = default - }; - - await base.UpdateAsync(server); - await base.SaveChangesAsync(); - } - - return server; - } - - server = new() - { - Id = DiscordContext.Guild.Id, - GreetMessage = "Welcome {username}!", - Rooms = new() - { - OutputRoom = DiscordContext.Guild.DefaultChannel.Id, - GreetingRoom = 0 - }, - ServerName = DiscordContext.Guild.Name, - RoleID = 0, - UseGreet = false, - }; - - await base.AddAsync(server); - await base.SaveChangesAsync(); - - return server; - } - } -} \ No newline at end of file diff --git a/src/Huppy/Huppy.Infrastructure/Repositories/TicketRepository.cs b/src/Huppy/Huppy.Infrastructure/Repositories/TicketRepository.cs deleted file mode 100644 index a516e0d..0000000 --- a/src/Huppy/Huppy.Infrastructure/Repositories/TicketRepository.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Huppy.Core.Interfaces.IRepositories; -using Huppy.Core.Models; -using Huppy.Kernel.Abstraction; - -namespace Huppy.Infrastructure.Repositories -{ - public class TicketRepository : BaseRepository, ITicketRepository - { - public TicketRepository(HuppyDbContext context) : base(context) { } - } -} \ No newline at end of file diff --git a/src/Huppy/Huppy.Kernel/Abstraction/BaseRepository.cs b/src/Huppy/Huppy.Kernel/Abstraction/BaseRepository.cs index 8fa3db4..7d42f77 100644 --- a/src/Huppy/Huppy.Kernel/Abstraction/BaseRepository.cs +++ b/src/Huppy/Huppy.Kernel/Abstraction/BaseRepository.cs @@ -2,6 +2,7 @@ namespace Huppy.Kernel.Abstraction; +[Obsolete] public class BaseRepository : IRepository where TKeyType : IConvertible where TEntity : DbModel, new() diff --git a/src/Huppy/Huppy.Kernel/Abstraction/DbModel.cs b/src/Huppy/Huppy.Kernel/Abstraction/DbModel.cs index e313344..c503b1f 100644 --- a/src/Huppy/Huppy.Kernel/Abstraction/DbModel.cs +++ b/src/Huppy/Huppy.Kernel/Abstraction/DbModel.cs @@ -2,7 +2,7 @@ namespace Huppy.Kernel { - + [Obsolete] public class DbModel where TKey : IConvertible { public virtual TKey Id { get; set; } diff --git a/src/Huppy/Huppy.Kernel/Abstraction/IRepository.cs b/src/Huppy/Huppy.Kernel/Abstraction/IRepository.cs index ec7663a..4100c0c 100644 --- a/src/Huppy/Huppy.Kernel/Abstraction/IRepository.cs +++ b/src/Huppy/Huppy.Kernel/Abstraction/IRepository.cs @@ -1,5 +1,6 @@ namespace Huppy.Kernel { + [Obsolete] public interface IRepository where Tkey : IConvertible where TEntity : DbModel { Task GetAsync(Tkey id); diff --git a/src/Huppy/Huppy.Kernel/Constants/GPTEndpoints.cs b/src/Huppy/Huppy.Kernel/Constants/GPTEndpoints.cs index 9167b46..e0c15c8 100644 --- a/src/Huppy/Huppy.Kernel/Constants/GPTEndpoints.cs +++ b/src/Huppy/Huppy.Kernel/Constants/GPTEndpoints.cs @@ -1,5 +1,6 @@ namespace Huppy.Kernel.Constants { + [Obsolete] public class GPTEndpoints { public const string TextDavinciCompletions = "text-davinci-001/completions"; diff --git a/src/Main.sln b/src/Main.sln index cf1345e..0adc191 100644 --- a/src/Main.sln +++ b/src/Main.sln @@ -15,6 +15,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HuppyService.Infrastructure EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HuppyService.Core", "HuppyService\HuppyService.Core\HuppyService.Core.csproj", "{E376D7A3-F2FE-4ABD-9FAD-9024E606AC29}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetherNetAuth", "NetherNetAuth", "{703B8FE3-39E4-43E9-9F90-71F966D77365}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetherNet.Api", "NetherNetAuth\NetherNet.Api\NetherNet.Api.csproj", "{AB5A3C60-4FEB-4D4C-82D5-78132A41B597}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetherNet.Core", "NetherNetAuth\NetherNet.Core\NetherNet.Core.csproj", "{43FF5A94-F856-490E-B34F-2A6BCEC1096B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetherNet.Infrastructure", "NetherNetAuth\NetherNet.Infrastructure\NetherNet.Infrastructure.csproj", "{3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +45,18 @@ Global {E376D7A3-F2FE-4ABD-9FAD-9024E606AC29}.Debug|Any CPU.Build.0 = Debug|Any CPU {E376D7A3-F2FE-4ABD-9FAD-9024E606AC29}.Release|Any CPU.ActiveCfg = Release|Any CPU {E376D7A3-F2FE-4ABD-9FAD-9024E606AC29}.Release|Any CPU.Build.0 = Release|Any CPU + {AB5A3C60-4FEB-4D4C-82D5-78132A41B597}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB5A3C60-4FEB-4D4C-82D5-78132A41B597}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB5A3C60-4FEB-4D4C-82D5-78132A41B597}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB5A3C60-4FEB-4D4C-82D5-78132A41B597}.Release|Any CPU.Build.0 = Release|Any CPU + {43FF5A94-F856-490E-B34F-2A6BCEC1096B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43FF5A94-F856-490E-B34F-2A6BCEC1096B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43FF5A94-F856-490E-B34F-2A6BCEC1096B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43FF5A94-F856-490E-B34F-2A6BCEC1096B}.Release|Any CPU.Build.0 = Release|Any CPU + {3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -46,6 +66,9 @@ Global {0E63AA9F-116E-40DB-AC1F-21B51B322F94} = {478F934F-E2B9-4A07-A6AD-C482F174E80A} {E330C21B-3443-4DD0-8313-34777CD4BD11} = {478F934F-E2B9-4A07-A6AD-C482F174E80A} {E376D7A3-F2FE-4ABD-9FAD-9024E606AC29} = {478F934F-E2B9-4A07-A6AD-C482F174E80A} + {AB5A3C60-4FEB-4D4C-82D5-78132A41B597} = {703B8FE3-39E4-43E9-9F90-71F966D77365} + {43FF5A94-F856-490E-B34F-2A6BCEC1096B} = {703B8FE3-39E4-43E9-9F90-71F966D77365} + {3ABB0FD3-00A7-4CB7-B63E-F79533E4BBC8} = {703B8FE3-39E4-43E9-9F90-71F966D77365} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2FDA4D15-FE50-4802-8176-9F2101A52F15}