Skip to content

Commit df7d570

Browse files
buildbuild
authored andcommitted
Restructure database
1 parent 3159bd3 commit df7d570

35 files changed

Lines changed: 134 additions & 91 deletions

BaroBot/Bot.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
using BaroBot;
99
using BaroBot.API;
10-
using BaroBot.Database;
1110
using BaroBot.Events;
1211
using BaroBot.Services;
1312
using Discord;
@@ -40,8 +39,8 @@ void ConfigureServices(IServiceCollection serviceCollection)
4039
serviceCollection.AddSingleton(client)
4140
.AddSingleton(new InteractionService(client))
4241
.AddSingleton<EnvironmentConfig>()
43-
.AddSingleton<Database>()
4442
.AddSingleton<IEventDispatcher, EventDispatcher>()
43+
.AddHostedService<DatabaseService>()
4544
.AddHostedService<MessageLoggingService>()
4645
.AddHostedService<RentGeneratorService>()
4746
.AddHostedService<SlashCommandService>()

BaroBot/Commands/CategoryCommands/ArchiveCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database.Domain;
10+
using Services.Domain;
1111
using Discord;
1212
using Discord.Interactions;
1313
using Discord.WebSocket;

BaroBot/Commands/CategoryCommands/CategoryCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database;
11-
using BaroBot.Database.Domain;
10+
using Services;
11+
using Services.Domain;
1212
using BaroBot.Events;
1313
using Discord;
1414
using Discord.Interactions;
@@ -21,17 +21,17 @@ namespace BaroBot.Commands.CategoryCommands;
2121
[Group("category", "Commands related to managing categories")]
2222
public partial class CategoryCommand : InteractionModuleBase<SocketInteractionContext>
2323
{
24-
private readonly Database _database;
24+
private readonly DatabaseService _database;
2525
private readonly DiscordSocketClient _client;
2626
private readonly IEventDispatcher _dispatcher;
2727

2828
/// <summary>
2929
/// Initializes a new instance of the <see cref="CategoryCommand"/> class.
3030
/// </summary>
31-
/// <param name="database">An instance of the <see cref="Database"/> class.</param>
31+
/// <param name="database">An instance of the <see cref="DatabaseService"/> class.</param>
3232
/// <param name="client">An instance of the <see cref="DiscordSocketClient"/> class.</param>
3333
/// <param name="eventDispatcher">An instance of the <see cref="IEventDispatcher"/>.</param>
34-
public CategoryCommand(Database database, DiscordSocketClient client, IEventDispatcher eventDispatcher)
34+
public CategoryCommand(DatabaseService database, DiscordSocketClient client, IEventDispatcher eventDispatcher)
3535
{
3636
_database = database;
3737
_client = client;

BaroBot/Commands/CategoryCommands/CreateCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database.Domain;
10+
using Services.Domain;
1111
using BaroBot.Events.Events;
1212
using Discord;
1313
using Discord.Interactions;

BaroBot/Commands/CategoryCommands/ImportCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database.Domain;
10+
using Services.Domain;
1111
using Discord;
1212
using Discord.Interactions;
1313
using Discord.WebSocket;

BaroBot/Commands/CategoryCommands/IpCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace BaroBot.Commands.CategoryCommands;
1010
using System.Net;
1111
using System.Net.Sockets;
1212
using System.Text.RegularExpressions;
13-
using BaroBot.Database.Domain;
13+
using Services.Domain;
1414
using Discord.Interactions;
1515
using Discord.WebSocket;
1616

BaroBot/Commands/CategoryCommands/RemoveCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database.Domain;
10+
using Services.Domain;
1111
using Discord.Interactions;
1212
using Discord.WebSocket;
1313

BaroBot/Commands/CategoryCommands/SteamIdCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BaroBot.Commands.CategoryCommands;
99

10-
using BaroBot.Database.Domain;
10+
using Services.Domain;
1111
using Discord.Interactions;
1212
using Discord.WebSocket;
1313

BaroBot/Commands/IpCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace BaroBot.Commands;
99

10-
using BaroBot.Database;
11-
using BaroBot.Database.Domain;
10+
using Services;
11+
using Services.Domain;
1212
using Discord.Interactions;
1313
using Discord.WebSocket;
1414

@@ -17,13 +17,13 @@ namespace BaroBot.Commands;
1717
/// </summary>
1818
public class IpCommand : InteractionModuleBase<SocketInteractionContext>
1919
{
20-
private readonly Database _database;
20+
private readonly DatabaseService _database;
2121

2222
/// <summary>
2323
/// Initializes a new instance of the <see cref="IpCommand"/> class.
2424
/// </summary>
25-
/// <param name="database">An instance of the <see cref="Database"/> class.</param>
26-
public IpCommand(Database database)
25+
/// <param name="database">An instance of the <see cref="DatabaseService"/> class.</param>
26+
public IpCommand(DatabaseService database)
2727
{
2828
_database = database;
2929
}

BaroBot/Commands/RentGeneratorCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace BaroBot.Commands;
99

10-
using BaroBot.Database;
11-
using BaroBot.Database.Domain;
10+
using Services;
11+
using Services.Domain;
1212
using Discord.Interactions;
1313
using Discord.Rest;
1414

@@ -17,13 +17,13 @@ namespace BaroBot.Commands;
1717
/// </summary>
1818
public class RentGeneratorCommand : InteractionModuleBase<SocketInteractionContext>
1919
{
20-
private readonly Database _database;
20+
private readonly DatabaseService _database;
2121

2222
/// <summary>
2323
/// Initializes a new instance of the <see cref="RentGeneratorCommand"/> class.
2424
/// </summary>
25-
/// <param name="database">An instance of the <see cref="Database"/> class.</param>
26-
public RentGeneratorCommand(Database database)
25+
/// <param name="database">An instance of the <see cref="DatabaseService"/> class.</param>
26+
public RentGeneratorCommand(DatabaseService database)
2727
{
2828
_database = database;
2929
}

0 commit comments

Comments
 (0)