From b346b3c1efda87c8b53a68c44b00f8473ba0ee98 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sat, 16 May 2026 01:15:29 +0330 Subject: [PATCH] Refactor xApi from Side Affect Changes ... --- Base/XIBaseV1Controller.cs | 33 -------- Base/XIBaseV1EntityController.cs | 122 ----------------------------- Base/XIBaseV1ProviderController.cs | 29 ------- Controllers/AccountController.cs | 2 +- Controllers/TestIdentity.cs | 2 +- Startup.cs | 9 --- 6 files changed, 2 insertions(+), 195 deletions(-) delete mode 100644 Base/XIBaseV1Controller.cs delete mode 100644 Base/XIBaseV1EntityController.cs delete mode 100644 Base/XIBaseV1ProviderController.cs diff --git a/Base/XIBaseV1Controller.cs b/Base/XIBaseV1Controller.cs deleted file mode 100644 index d51ce43..0000000 --- a/Base/XIBaseV1Controller.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using xCommons.Attributes; -using xCommons.Configurations; -using xCommons.Providers; -using xIdentityService.Controllers; -using xIdentityService.Interfaces; - -namespace xApi.Base -{ - [ApiController] - [ApiVersion("1.0")] - [RequireXPowered(true)] - [Route("api/v{version:apiVersion}/[controller]")] - public abstract class XIBaseV1Controller : XIBaseController - { - // - #region Constructor ... - protected XIBaseV1Controller( - ILogger logger, - XAppConfiguration appConfiguration, - IXIdentityProvider identityProvider, - XValidationProvider validationProvider - ) : base( - logger, - appConfiguration, - identityProvider, - validationProvider - ) - { } - #endregion - } -} diff --git a/Base/XIBaseV1EntityController.cs b/Base/XIBaseV1EntityController.cs deleted file mode 100644 index 617718a..0000000 --- a/Base/XIBaseV1EntityController.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.Logging; -using xCommons.Attributes; -using xCommons.Configurations; -using xCommons.Extensions; -using xCommons.Providers; -using xDataService.Interfaces; -using xIdentityService.Controllers; -using xIdentityService.Interfaces; -using xModels.Base; -using xPushService.Base; -using xPushService.Constants; - -namespace xApi.Base -{ - // - // TODO: Fix this ... - // [ApiController] - // [ApiVersion("1.0")] - // [RequireXPowered(true)] - // [Route("api/v{version:apiVersion}/entities/[controller]")] - // public abstract class XIBaseV1EntityController : XIBaseEntityController - // where TEntity : XBaseEntity - // { - // // - // #region Constructor ... - // protected XIBaseV1EntityController( - // ILogger> logger, - // XAppConfiguration appConfiguration, - // IXIdentityProvider identityProvider, - // XValidationProvider validationProvider, - // IXBaseRepository repository - // ) : base( - // logger, - // appConfiguration, - // identityProvider, - // validationProvider, - // repository - // ) - // { } - // #endregion - // } - - // public abstract class XIBaseV1EntityHubController : XIBaseV1EntityController - // where TEntity : XBaseEntity - // { - // // - // #region Props ... - // public IHubContext> Hub { get; } - // #endregion - - // // - // #region Constructor ... - // protected XIBaseV1EntityHubController( - // ILogger> logger, - // XAppConfiguration appConfiguration, - // IXIdentityProvider identityProvider, - // XValidationProvider validationProvider, - // IXBaseRepository repository, - // IHubContext> hub = null - // ) : base( - // logger, - // appConfiguration, - // identityProvider, - // validationProvider, - // repository - // ) - // { - // Hub = hub; - // } - // #endregion - - // // - // #region Hub ... - // [NonAction] - // public async Task SendPush( - // string action, - // string payLoad - // ) - // { - // // - // var actions = new List - // { - // XBaseEntityHubAction.Add.GetStringValue(), - // XBaseEntityHubAction.Update.GetStringValue(), - // XBaseEntityHubAction.Delete.GetStringValue(), - // XBaseEntityHubAction.AddMany.GetStringValue(), - // XBaseEntityHubAction.DeleteMany.GetStringValue(), - // XBaseEntityHubAction.UpdateMany.GetStringValue(), - // XBaseEntityHubAction.AddOrUpdate.GetStringValue(), - // }; - - // // - // // Validate ... - // var isValid = - // !Hub.IsNull() && - // !action.IsNullOrEmpty() && - // !payLoad.IsNullOrEmpty() && - // actions.Contains(action); - // if (!isValid) - // { - // return; - // } - - // // - // // Retrieve Connection Id ... - // var connectionId = GetConnectionId(); - // var clients = Hub.Clients.All; - // if (!connectionId.IsNullOrEmpty()) - // { - // clients = Hub.Clients.AllExcept(connectionId); - // } - - // // - // await clients.SendAsync(action, payLoad, connectionId); - // } - // #endregion - // } -} \ No newline at end of file diff --git a/Base/XIBaseV1ProviderController.cs b/Base/XIBaseV1ProviderController.cs deleted file mode 100644 index 726744f..0000000 --- a/Base/XIBaseV1ProviderController.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Logging; -using xCommons.Configurations; -using xCommons.Providers; -using xIdentityService.Controllers; -using xIdentityService.Interfaces; - -namespace xApi.Base -{ - [Route("api/v{version:apiVersion}/services/[controller]")] - public abstract class XIBaseV1ProviderController : XIBaseProviderController - { - // - #region Constructor ... - protected XIBaseV1ProviderController( - ILogger logger, - XAppConfiguration appConfiguration, - IXIdentityProvider identityProvider, - XValidationProvider validationProvider - ) : base( - logger, - appConfiguration, - identityProvider, - validationProvider - ) - { } - #endregion - } -} \ No newline at end of file diff --git a/Controllers/AccountController.cs b/Controllers/AccountController.cs index 2378ac5..01a29a2 100644 --- a/Controllers/AccountController.cs +++ b/Controllers/AccountController.cs @@ -13,7 +13,7 @@ namespace xApi.Controllers /// [AllowAnonymous] [RequireXPowered(true)] - public partial class AccountController : XIBaseController + public partial class AccountController : XBaseIdentityController { // #region Props ... diff --git a/Controllers/TestIdentity.cs b/Controllers/TestIdentity.cs index 9e912e6..f8dca86 100644 --- a/Controllers/TestIdentity.cs +++ b/Controllers/TestIdentity.cs @@ -14,7 +14,7 @@ namespace xApi.Controllers { /// Test all Authentication Policies ... /// [RequireXPowered (false)] - public class TestIdentity : XIBaseController { + public class TestIdentity : XBaseIdentityController { public TestIdentity ( ILogger logger, XAppConfiguration appConfiguration, diff --git a/Startup.cs b/Startup.cs index 15cabbc..669ce3d 100644 --- a/Startup.cs +++ b/Startup.cs @@ -154,15 +154,6 @@ namespace xApi endpoints.MapControllers(); }); - // - #region XPushService ... - // // - // var helper = new XPushServiceHelper(); - - // // - // app.UseXPushService(helper); - #endregion - // // Use xDataService Middleware ... app.UseXServices(