From 6fa00321c045126c8aed832d51caf281bdf9e1b5 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 28 Jun 2019 15:48:59 +0800 Subject: [PATCH 1/2] Fix inconsistent REST API urls. --- .../Volo/Abp/Identity/IdentityRoleController.cs | 2 +- .../Volo/Abp/Identity/IdentityUserController.cs | 2 +- .../Abp/Identity/IdentityUserLookupController.cs | 2 +- .../Volo/Abp/Identity/ProfileController.cs | 6 ++++++ .../Volo/Abp/TenantManagement/TenantController.cs | 15 +++++++++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs index d0e39030bd..ca11d75f48 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("Role")] - [Route("api/identity/role")] + [Route("api/identity/roles")] public class IdentityRoleController : AbpController, IIdentityRoleAppService { private readonly IIdentityRoleAppService _roleAppService; diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs index 18fd43e1fe..02e8176a1e 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("User")] - [Route("api/identity/user")] + [Route("api/identity/users")] public class IdentityUserController : AbpController, IIdentityUserAppService { private readonly IIdentityUserAppService _userAppService; diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs index ba663858fb..8663227c1e 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("UserLookup")] - [Route("api/identity/user-lookup")] + [Route("api/identity/user-lookups")] public class IdentityUserLookupController : AbpController, IIdentityUserLookupAppService { protected IIdentityUserLookupAppService LookupAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs index 4547bbdc1c..4cea0303f2 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs @@ -7,6 +7,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("Profile")] + [Route("/api/identity/profiles")] public class ProfileController : AbpController, IProfileAppService { private readonly IProfileAppService _profileAppService; @@ -15,16 +16,21 @@ namespace Volo.Abp.Identity { _profileAppService = profileAppService; } + + [HttpGet] public Task GetAsync() { return _profileAppService.GetAsync(); } + [HttpPut] public Task UpdateAsync(UpdateProfileDto input) { return _profileAppService.UpdateAsync(input); } + [HttpPost] + [Route("ChangePassword")] public Task ChangePasswordAsync(string currentPassword, string newPassword) { return _profileAppService.ChangePasswordAsync(currentPassword, newPassword); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs index e8df39d2fa..2e036699c8 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs @@ -9,6 +9,7 @@ namespace Volo.Abp.TenantManagement [Controller] [RemoteService] [Area("multi-tenancy")] + [Route("api/multi-tenancy/tenants")] public class TenantController : AbpController, ITenantAppService //TODO: Throws exception on validation if we inherit from Controller { private readonly ITenantAppService _service; @@ -18,41 +19,55 @@ namespace Volo.Abp.TenantManagement _service = service; } + [HttpGet] + [Route("{id}")] public virtual Task GetAsync(Guid id) { return _service.GetAsync(id); } + [HttpGet] public virtual Task> GetListAsync(GetTenantsInput input) { return _service.GetListAsync(input); } + [HttpPost] public virtual Task CreateAsync(TenantCreateDto input) { return _service.CreateAsync(input); } + [HttpPut] + [Route("{id}")] public virtual Task UpdateAsync(Guid id, TenantUpdateDto input) { return _service.UpdateAsync(id, input); } + [HttpDelete] + [Route("{id}")] public virtual Task DeleteAsync(Guid id) { return _service.DeleteAsync(id); } + [HttpGet] + [Route("{id}/DefaultConnectionString")] public Task GetDefaultConnectionStringAsync(Guid id) { return _service.GetDefaultConnectionStringAsync(id); } + [HttpPut] + [Route("{id}/DefaultConnectionString")] public Task UpdateDefaultConnectionStringAsync(Guid id, string defaultConnectionString) { return _service.UpdateDefaultConnectionStringAsync(id, defaultConnectionString); } + [HttpDelete] + [Route("{id}/DefaultConnectionString")] public Task DeleteDefaultConnectionStringAsync(Guid id) { return _service.DeleteDefaultConnectionStringAsync(id); From ec233e98610624d4deae7e0064f7ef5e295b0d4f Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 28 Jun 2019 16:24:34 +0800 Subject: [PATCH 2/2] Update api url format. --- .../Volo/Abp/Identity/IdentityUserLookupController.cs | 2 +- .../Volo/Abp/Identity/ProfileController.cs | 4 ++-- .../Volo/Abp/TenantManagement/TenantController.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs index 8663227c1e..0c29f36ceb 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("UserLookup")] - [Route("api/identity/user-lookups")] + [Route("api/identity/users/lookup")] public class IdentityUserLookupController : AbpController, IIdentityUserLookupAppService { protected IIdentityUserLookupAppService LookupAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs index 4cea0303f2..de05b9bdea 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.Identity [RemoteService] [Area("identity")] [ControllerName("Profile")] - [Route("/api/identity/profiles")] + [Route("/api/identity/my-profile")] public class ProfileController : AbpController, IProfileAppService { private readonly IProfileAppService _profileAppService; @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity } [HttpPost] - [Route("ChangePassword")] + [Route("change-password")] public Task ChangePasswordAsync(string currentPassword, string newPassword) { return _profileAppService.ChangePasswordAsync(currentPassword, newPassword); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs index 2e036699c8..2aabf871de 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs @@ -53,21 +53,21 @@ namespace Volo.Abp.TenantManagement } [HttpGet] - [Route("{id}/DefaultConnectionString")] + [Route("{id}/default-connection-string")] public Task GetDefaultConnectionStringAsync(Guid id) { return _service.GetDefaultConnectionStringAsync(id); } [HttpPut] - [Route("{id}/DefaultConnectionString")] + [Route("{id}/default-connection-string")] public Task UpdateDefaultConnectionStringAsync(Guid id, string defaultConnectionString) { return _service.UpdateDefaultConnectionStringAsync(id, defaultConnectionString); } [HttpDelete] - [Route("{id}/DefaultConnectionString")] + [Route("{id}/default-connection-string")] public Task DeleteDefaultConnectionStringAsync(Guid id) { return _service.DeleteDefaultConnectionStringAsync(id);