diff --git a/CannedNet/Models/Account.cs b/CannedNet/Models/AccountData/Account.cs similarity index 100% rename from CannedNet/Models/Account.cs rename to CannedNet/Models/AccountData/Account.cs diff --git a/CannedNet/Models/AvatarItem.cs b/CannedNet/Models/AccountData/AvatarItem.cs similarity index 100% rename from CannedNet/Models/AvatarItem.cs rename to CannedNet/Models/AccountData/AvatarItem.cs diff --git a/CannedNet/Models/CachedAccount.cs b/CannedNet/Models/AccountData/CachedAccount.cs similarity index 100% rename from CannedNet/Models/CachedAccount.cs rename to CannedNet/Models/AccountData/CachedAccount.cs diff --git a/CannedNet/Models/JuniorState.cs b/CannedNet/Models/AccountData/JuniorState.cs similarity index 100% rename from CannedNet/Models/JuniorState.cs rename to CannedNet/Models/AccountData/JuniorState.cs diff --git a/CannedNet/Models/PlatformType.cs b/CannedNet/Models/AccountData/PlatformType.cs similarity index 100% rename from CannedNet/Models/PlatformType.cs rename to CannedNet/Models/AccountData/PlatformType.cs diff --git a/CannedNet/Models/PlayerAvatar.cs b/CannedNet/Models/AccountData/PlayerAvatar.cs similarity index 100% rename from CannedNet/Models/PlayerAvatar.cs rename to CannedNet/Models/AccountData/PlayerAvatar.cs diff --git a/CannedNet/Models/PlayerBio.cs b/CannedNet/Models/AccountData/PlayerBio.cs similarity index 100% rename from CannedNet/Models/PlayerBio.cs rename to CannedNet/Models/AccountData/PlayerBio.cs diff --git a/CannedNet/Models/PlayerProgression.cs b/CannedNet/Models/AccountData/PlayerProgression.cs similarity index 100% rename from CannedNet/Models/PlayerProgression.cs rename to CannedNet/Models/AccountData/PlayerProgression.cs diff --git a/CannedNet/Models/PlayerSetting.cs b/CannedNet/Models/AccountData/PlayerSetting.cs similarity index 100% rename from CannedNet/Models/PlayerSetting.cs rename to CannedNet/Models/AccountData/PlayerSetting.cs diff --git a/CannedNet/Models/RelationshipType.cs b/CannedNet/Models/AccountData/RelationshipType.cs similarity index 100% rename from CannedNet/Models/RelationshipType.cs rename to CannedNet/Models/AccountData/RelationshipType.cs diff --git a/CannedNet/Models/SavedOutfit.cs b/CannedNet/Models/AccountData/SavedOutfit.cs similarity index 100% rename from CannedNet/Models/SavedOutfit.cs rename to CannedNet/Models/AccountData/SavedOutfit.cs diff --git a/CannedNet/Models/SelfAccount.cs b/CannedNet/Models/AccountData/SelfAccount.cs similarity index 100% rename from CannedNet/Models/SelfAccount.cs rename to CannedNet/Models/AccountData/SelfAccount.cs diff --git a/CannedNet/Models/SettingPayload.cs b/CannedNet/Models/AccountData/SettingPayload.cs similarity index 100% rename from CannedNet/Models/SettingPayload.cs rename to CannedNet/Models/AccountData/SettingPayload.cs diff --git a/CannedNet/Models/SubscriptionList.cs b/CannedNet/Models/AccountData/SubscriptionList.cs similarity index 100% rename from CannedNet/Models/SubscriptionList.cs rename to CannedNet/Models/AccountData/SubscriptionList.cs diff --git a/CannedNet/Models/TokenBalance.cs b/CannedNet/Models/AccountData/TokenBalance.cs similarity index 100% rename from CannedNet/Models/TokenBalance.cs rename to CannedNet/Models/AccountData/TokenBalance.cs diff --git a/CannedNet/Models/BuyItemRequest.cs b/CannedNet/Models/Economy/BuyItemRequest.cs similarity index 100% rename from CannedNet/Models/BuyItemRequest.cs rename to CannedNet/Models/Economy/BuyItemRequest.cs diff --git a/CannedNet/Models/BuyItemResponse.cs b/CannedNet/Models/Economy/BuyItemResponse.cs similarity index 100% rename from CannedNet/Models/BuyItemResponse.cs rename to CannedNet/Models/Economy/BuyItemResponse.cs diff --git a/CannedNet/Models/ConsumableItem.cs b/CannedNet/Models/Economy/ConsumableItem.cs similarity index 100% rename from CannedNet/Models/ConsumableItem.cs rename to CannedNet/Models/Economy/ConsumableItem.cs diff --git a/CannedNet/Models/ConsumableType.cs b/CannedNet/Models/Economy/ConsumableType.cs similarity index 100% rename from CannedNet/Models/ConsumableType.cs rename to CannedNet/Models/Economy/ConsumableType.cs diff --git a/CannedNet/Models/EarnableReward.cs b/CannedNet/Models/Economy/EarnableReward.cs similarity index 100% rename from CannedNet/Models/EarnableReward.cs rename to CannedNet/Models/Economy/EarnableReward.cs diff --git a/CannedNet/Models/Storefront.cs b/CannedNet/Models/Economy/Storefront.cs similarity index 100% rename from CannedNet/Models/Storefront.cs rename to CannedNet/Models/Economy/Storefront.cs diff --git a/CannedNet/Models/StorefrontItem.cs b/CannedNet/Models/Economy/StorefrontItem.cs similarity index 100% rename from CannedNet/Models/StorefrontItem.cs rename to CannedNet/Models/Economy/StorefrontItem.cs diff --git a/CannedNet/Models/StorefrontPrice.cs b/CannedNet/Models/Economy/StorefrontPrice.cs similarity index 100% rename from CannedNet/Models/StorefrontPrice.cs rename to CannedNet/Models/Economy/StorefrontPrice.cs diff --git a/CannedNet/Models/ConsumeGiftRequest.cs b/CannedNet/Models/Gifts/ConsumeGiftRequest.cs similarity index 100% rename from CannedNet/Models/ConsumeGiftRequest.cs rename to CannedNet/Models/Gifts/ConsumeGiftRequest.cs diff --git a/CannedNet/Models/GiftContext.cs b/CannedNet/Models/Gifts/GiftContext.cs similarity index 100% rename from CannedNet/Models/GiftContext.cs rename to CannedNet/Models/Gifts/GiftContext.cs diff --git a/CannedNet/Models/GiftDrop.cs b/CannedNet/Models/Gifts/GiftDrop.cs similarity index 100% rename from CannedNet/Models/GiftDrop.cs rename to CannedNet/Models/Gifts/GiftDrop.cs diff --git a/CannedNet/Models/ReceivedGift.cs b/CannedNet/Models/Gifts/ReceivedGift.cs similarity index 100% rename from CannedNet/Models/ReceivedGift.cs rename to CannedNet/Models/Gifts/ReceivedGift.cs diff --git a/CannedNet/Models/JoinMode.cs b/CannedNet/Models/Matchmaking/JoinMode.cs similarity index 100% rename from CannedNet/Models/JoinMode.cs rename to CannedNet/Models/Matchmaking/JoinMode.cs diff --git a/CannedNet/Models/NotificationModels.cs b/CannedNet/Models/Notifications/NotificationModels.cs similarity index 100% rename from CannedNet/Models/NotificationModels.cs rename to CannedNet/Models/Notifications/NotificationModels.cs diff --git a/CannedNet/Models/NotificationTypes.cs b/CannedNet/Models/Notifications/NotificationTypes.cs similarity index 100% rename from CannedNet/Models/NotificationTypes.cs rename to CannedNet/Models/Notifications/NotificationTypes.cs diff --git a/CannedNet/Models/Room.cs b/CannedNet/Models/Rooms/Room.cs similarity index 100% rename from CannedNet/Models/Room.cs rename to CannedNet/Models/Rooms/Room.cs diff --git a/CannedNet/Models/RoomInstance.cs b/CannedNet/Models/Rooms/RoomInstance.cs similarity index 100% rename from CannedNet/Models/RoomInstance.cs rename to CannedNet/Models/Rooms/RoomInstance.cs diff --git a/CannedNet/Models/RoomStats.cs b/CannedNet/Models/Rooms/RoomStats.cs similarity index 100% rename from CannedNet/Models/RoomStats.cs rename to CannedNet/Models/Rooms/RoomStats.cs diff --git a/CannedNet/Program.cs b/CannedNet/Program.cs index 5767802..8fb2a9e 100644 --- a/CannedNet/Program.cs +++ b/CannedNet/Program.cs @@ -1,5 +1,6 @@ using CannedNet; using CannedNet.Services; +using CannedNet.Services.Infrastructure; using Microsoft.EntityFrameworkCore; var apps = new List<(WebApplication App, ServiceRegistry Service)>(); diff --git a/CannedNet/Services/APIService.cs b/CannedNet/Services/Controllers/APIController.cs similarity index 99% rename from CannedNet/Services/APIService.cs rename to CannedNet/Services/Controllers/APIController.cs index 961573e..9bfaadc 100644 --- a/CannedNet/Services/APIService.cs +++ b/CannedNet/Services/Controllers/APIController.cs @@ -6,10 +6,12 @@ using System.Text.Json.Serialization; using CannedNet.Hubs; using CannedNet.Models; using Microsoft.AspNetCore.SignalR; +using CannedNet.Services; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class APIService +public class APIController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/AccountsService.cs b/CannedNet/Services/Controllers/AccountsController.cs similarity index 98% rename from CannedNet/Services/AccountsService.cs rename to CannedNet/Services/Controllers/AccountsController.cs index e85a97a..bdf5b3e 100644 --- a/CannedNet/Services/AccountsService.cs +++ b/CannedNet/Services/Controllers/AccountsController.cs @@ -1,9 +1,11 @@ using CannedNet.Data; using Microsoft.EntityFrameworkCore; +using CannedNet.Services; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class AccountsService +public class AccountsController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/AuthService.cs b/CannedNet/Services/Controllers/AuthController.cs similarity index 96% rename from CannedNet/Services/AuthService.cs rename to CannedNet/Services/Controllers/AuthController.cs index 12a7909..b831e86 100644 --- a/CannedNet/Services/AuthService.cs +++ b/CannedNet/Services/Controllers/AuthController.cs @@ -1,10 +1,12 @@ using CannedNet; using CannedNet.Data; using Microsoft.EntityFrameworkCore; +using CannedNet.Services; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class AuthService +public class AuthController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/CDNService.cs b/CannedNet/Services/Controllers/CDNController.cs similarity index 78% rename from CannedNet/Services/CDNService.cs rename to CannedNet/Services/Controllers/CDNController.cs index 9aa814e..5dd6179 100644 --- a/CannedNet/Services/CDNService.cs +++ b/CannedNet/Services/Controllers/CDNController.cs @@ -1,6 +1,8 @@ -namespace CannedNet.Services; +using CannedNet.Services.Infrastructure; -public class CDNService +namespace CannedNet.Services.Controllers; + +public class CDNController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/ChatService.cs b/CannedNet/Services/Controllers/ChatController.cs similarity index 70% rename from CannedNet/Services/ChatService.cs rename to CannedNet/Services/Controllers/ChatController.cs index 009bc0e..348548c 100644 --- a/CannedNet/Services/ChatService.cs +++ b/CannedNet/Services/Controllers/ChatController.cs @@ -1,6 +1,8 @@ -namespace CannedNet.Services; +using CannedNet.Services.Infrastructure; -public class ChatService +namespace CannedNet.Services.Controllers; + +public class ChatController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/ClubsService.cs b/CannedNet/Services/Controllers/ClubsController.cs similarity index 71% rename from CannedNet/Services/ClubsService.cs rename to CannedNet/Services/Controllers/ClubsController.cs index b54b244..8338ce5 100644 --- a/CannedNet/Services/ClubsService.cs +++ b/CannedNet/Services/Controllers/ClubsController.cs @@ -1,6 +1,8 @@ -namespace CannedNet.Services; +using CannedNet.Services.Infrastructure; -public class ClubsService +namespace CannedNet.Services.Controllers; + +public class ClubsController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/CommerceService.cs b/CannedNet/Services/Controllers/CommerceController.cs similarity index 72% rename from CannedNet/Services/CommerceService.cs rename to CannedNet/Services/Controllers/CommerceController.cs index 66fe2e2..f5b13ce 100644 --- a/CannedNet/Services/CommerceService.cs +++ b/CannedNet/Services/Controllers/CommerceController.cs @@ -1,6 +1,8 @@ -namespace CannedNet.Services; +using CannedNet.Services.Infrastructure; -public class CommerceService +namespace CannedNet.Services.Controllers; + +public class CommerceController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/ImageService.cs b/CannedNet/Services/Controllers/ImageController.cs similarity index 92% rename from CannedNet/Services/ImageService.cs rename to CannedNet/Services/Controllers/ImageController.cs index 660cffa..afbbea2 100644 --- a/CannedNet/Services/ImageService.cs +++ b/CannedNet/Services/Controllers/ImageController.cs @@ -1,6 +1,8 @@ -namespace CannedNet.Services; +using CannedNet.Services.Infrastructure; -public class ImageService +namespace CannedNet.Services.Controllers; + +public class ImageController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/MatchmakingService.cs b/CannedNet/Services/Controllers/MatchmakingController.cs similarity index 99% rename from CannedNet/Services/MatchmakingService.cs rename to CannedNet/Services/Controllers/MatchmakingController.cs index c42ae10..f5724e4 100644 --- a/CannedNet/Services/MatchmakingService.cs +++ b/CannedNet/Services/Controllers/MatchmakingController.cs @@ -2,10 +2,12 @@ using System.Text.Json; using System.Text.Json.Serialization; using CannedNet.Data; using Microsoft.EntityFrameworkCore; +using CannedNet.Services; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class MatchmakingService +public class MatchmakingController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/NSService.cs b/CannedNet/Services/Controllers/NSController.cs similarity index 84% rename from CannedNet/Services/NSService.cs rename to CannedNet/Services/Controllers/NSController.cs index 0fd0f77..1a95928 100644 --- a/CannedNet/Services/NSService.cs +++ b/CannedNet/Services/Controllers/NSController.cs @@ -1,8 +1,9 @@ using CannedNet.Hubs; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class NSService +public class NSController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/NotifiyService.cs b/CannedNet/Services/Controllers/NotifyController.cs similarity index 69% rename from CannedNet/Services/NotifiyService.cs rename to CannedNet/Services/Controllers/NotifyController.cs index 5097609..a6c2a41 100644 --- a/CannedNet/Services/NotifiyService.cs +++ b/CannedNet/Services/Controllers/NotifyController.cs @@ -1,8 +1,9 @@ using CannedNet.Hubs; +using CannedNet.Services.Infrastructure; -namespace CannedNet.Services; +namespace CannedNet.Services.Controllers; -public class NotifyService +public class NotifyController { public WebApplicationBuilder Initialize(string[]? args = null) => ServiceExtensions.CreateRecNetBuilder(args); diff --git a/CannedNet/Services/RequestLoggingMiddleware.cs b/CannedNet/Services/Infrastructure/RequestLoggingMiddleware.cs similarity index 98% rename from CannedNet/Services/RequestLoggingMiddleware.cs rename to CannedNet/Services/Infrastructure/RequestLoggingMiddleware.cs index 432f1f3..70eb9df 100644 --- a/CannedNet/Services/RequestLoggingMiddleware.cs +++ b/CannedNet/Services/Infrastructure/RequestLoggingMiddleware.cs @@ -1,6 +1,6 @@ using System.Text; -namespace CannedNet.Services; +namespace CannedNet.Services.Infrastructure; public class RequestLoggingMiddleware { diff --git a/CannedNet/Services/ServiceExtensions.cs b/CannedNet/Services/Infrastructure/ServiceExtensions.cs similarity index 96% rename from CannedNet/Services/ServiceExtensions.cs rename to CannedNet/Services/Infrastructure/ServiceExtensions.cs index 20639ae..20f56bf 100644 --- a/CannedNet/Services/ServiceExtensions.cs +++ b/CannedNet/Services/Infrastructure/ServiceExtensions.cs @@ -1,7 +1,7 @@ using CannedNet.Data; using Microsoft.EntityFrameworkCore; -namespace CannedNet.Services; +namespace CannedNet.Services.Infrastructure; public static class ServiceExtensions { diff --git a/CannedNet/Services/Infrastructure/ServiceRegistry.cs b/CannedNet/Services/Infrastructure/ServiceRegistry.cs new file mode 100644 index 0000000..049e90d --- /dev/null +++ b/CannedNet/Services/Infrastructure/ServiceRegistry.cs @@ -0,0 +1,31 @@ +using System.Net.Mime; +using CannedNet.Services.Controllers; + +namespace CannedNet.Services.Infrastructure; + +public class ServiceRegistry +{ + public required string Name { get; init; } + public required int Port { get; init; } + public required Type ServiceType { get; init; } + public required Action ConfigureBuilder { get; init; } + public required Action MapEndpoints { get; init; } +} + +public static class Services +{ + public static readonly List All = + [ + new() { Name = "NS", Port = 5001, ServiceType = typeof(NSController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new NSController().MapEndpoints(app) }, + new() { Name = "API", Port = 5000, ServiceType = typeof(APIController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new APIController().MapEndpoints(app) }, + new() { Name = "Auth", Port = 5002, ServiceType = typeof(AuthController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, jwt) => new AuthController().MapEndpoints(app) }, + new() { Name = "Chat", Port = 5003, ServiceType = typeof(ChatController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ChatController().MapEndpoints(app) }, + new() { Name = "Match", Port = 5004, ServiceType = typeof(MatchmakingController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new MatchmakingController().MapEndpoints(app) }, + new() { Name = "Accounts", Port = 5005, ServiceType = typeof(AccountsController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, jwt) => new AccountsController().MapEndpoints(app, jwt) }, + new() { Name = "Notify", Port = 5006, ServiceType = typeof(NotifyController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new NotifyController().MapEndpoints(app) }, + new() { Name = "CDN", Port = 5007, ServiceType = typeof(CDNController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new CDNController().MapEndpoints(app) }, + new() { Name = "Image", Port = 5008, ServiceType = typeof(ImageController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ImageController().MapEndpoints(app) }, + new() { Name = "Clubs", Port = 5009, ServiceType = typeof(ClubsController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ClubsController().MapEndpoints(app) }, + new() { Name = "Commerce", Port = 5010, ServiceType = typeof(CommerceController), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new CommerceController().MapEndpoints(app) } + ]; +} diff --git a/CannedNet/Services/ServiceRegistry.cs b/CannedNet/Services/ServiceRegistry.cs deleted file mode 100644 index f5e6968..0000000 --- a/CannedNet/Services/ServiceRegistry.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Net.Mime; - -namespace CannedNet.Services; - -public class ServiceRegistry -{ - public required string Name { get; init; } - public required int Port { get; init; } - public required Type ServiceType { get; init; } - public required Action ConfigureBuilder { get; init; } - public required Action MapEndpoints { get; init; } -} - -public static class Services -{ - public static readonly List All = - [ - new() { Name = "NS", Port = 5001, ServiceType = typeof(NSService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new NSService().MapEndpoints(app) }, - new() { Name = "API", Port = 5000, ServiceType = typeof(APIService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new APIService().MapEndpoints(app) }, - new() { Name = "Auth", Port = 5002, ServiceType = typeof(AuthService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, jwt) => new AuthService().MapEndpoints(app) }, - new() { Name = "Chat", Port = 5003, ServiceType = typeof(ChatService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ChatService().MapEndpoints(app) }, - new() { Name = "Match", Port = 5004, ServiceType = typeof(MatchmakingService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new MatchmakingService().MapEndpoints(app) }, - new() { Name = "Accounts", Port = 5005, ServiceType = typeof(AccountsService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, jwt) => new AccountsService().MapEndpoints(app, jwt) }, - new() { Name = "Notify", Port = 5006, ServiceType = typeof(NotifyService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new NotifyService().MapEndpoints(app) }, - new() { Name = "CDN", Port = 5007, ServiceType = typeof(CDNService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new CDNService().MapEndpoints(app) }, - new() { Name = "Image", Port = 5008, ServiceType = typeof(ImageService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ImageService().MapEndpoints(app) }, - new() { Name = "Clubs", Port = 5009, ServiceType = typeof(ClubsService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new ClubsService().MapEndpoints(app) }, - new() { Name = "Commerce", Port = 5010, ServiceType = typeof(CommerceService), ConfigureBuilder = b => b.ConfigureRecNetServices(), MapEndpoints = (app, _) => new CommerceService().MapEndpoints(app) } - ]; -}