From 5658a19fb43ca4f9b7b45c8a8a7b0f616fbab41e Mon Sep 17 00:00:00 2001 From: kubapoke Date: Mon, 14 Apr 2025 14:46:36 +0200 Subject: [PATCH 1/2] changed endpoint names --- .../Categories/Controllers/CategoryController.cs | 5 ++--- TickAPI/TickAPI/Events/Controllers/EventController.cs | 10 +++++----- .../Organizers/Controllers/OrganizerController.cs | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs b/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs index e7d7469..7ec4ea6 100644 --- a/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs +++ b/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs @@ -10,7 +10,6 @@ namespace TickAPI.Categories.Controllers; [ApiController] [Route("api/[controller]")] - public class CategoryController : Controller { private readonly ICategoryService _categoryService; @@ -21,7 +20,7 @@ public CategoryController(ICategoryService categoryService) } [AuthorizeWithPolicy(AuthPolicies.VerifiedUserPolicy)] - [HttpGet("get-categories")] + [HttpGet("categories")] public async Task>> GetCategories([FromQuery] int pageSize, [FromQuery] int page) { var res = await _categoryService.GetCategoriesResponsesAsync(pageSize, page); @@ -33,7 +32,7 @@ public async Task>> GetCatego } // TODO: Add appropriate policy verification (admin, maybe also organizer?) - [HttpPost("create-category")] + [HttpPost("category")] public async Task CreateCategory([FromBody] CreateCategoryDto request) { var newCategoryResult = await _categoryService.CreateNewCategoryAsync(request.Name); diff --git a/TickAPI/TickAPI/Events/Controllers/EventController.cs b/TickAPI/TickAPI/Events/Controllers/EventController.cs index 5ea6f4e..09b2e65 100644 --- a/TickAPI/TickAPI/Events/Controllers/EventController.cs +++ b/TickAPI/TickAPI/Events/Controllers/EventController.cs @@ -28,7 +28,7 @@ public EventController(IEventService eventService, IClaimsService claimsService, } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpPost("create-event")] + [HttpPost("event")] public async Task> CreateEvent([FromBody] CreateEventDto request) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -47,7 +47,7 @@ public async Task> CreateEvent([FromBody] C } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpGet("get-organizer-events")] + [HttpGet("organizer-events")] public async Task>> GetOrganizerEvents([FromQuery] int pageSize, [FromQuery] int page) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -74,7 +74,7 @@ public async Task>> GetOrganizer } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpGet("get-organizer-events-pagination-details")] + [HttpGet("organizer-events-pagination-details")] public async Task> GetOrganizerEventsPaginationDetails([FromQuery] int pageSize) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -101,7 +101,7 @@ public async Task> GetOrganizerEventsPaginationD } [AuthorizeWithPolicy(AuthPolicies.CustomerPolicy)] - [HttpGet("get-events")] + [HttpGet("events")] public async Task>> GetEvents([FromQuery] int pageSize, [FromQuery] int page) { var paginatedDataResult = await _eventService.GetEventsAsync(page, pageSize); @@ -113,7 +113,7 @@ public async Task>> GetEvents([F } [AuthorizeWithPolicy(AuthPolicies.CustomerPolicy)] - [HttpGet("get-events-pagination-details")] + [HttpGet("events-pagination-details")] public async Task> GetEventsPaginationDetails([FromQuery] int pageSize) { var paginationDetailsResult = await _eventService.GetEventsPaginationDetailsAsync(pageSize); diff --git a/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs b/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs index 4643556..a4644d6 100644 --- a/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs +++ b/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs @@ -62,7 +62,7 @@ public async Task> GoogleLogin([Fr } [AuthorizeWithPolicy(AuthPolicies.NewOrganizerPolicy)] - [HttpPost("create-organizer")] + [HttpPost("organizer")] public async Task> CreateOrganizer([FromBody] CreateOrganizerDto request) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); From 02723bbf92648568c7ba73a10bbecc9d5595b48c Mon Sep 17 00:00:00 2001 From: kubapoke Date: Sat, 19 Apr 2025 01:08:27 +0200 Subject: [PATCH 2/2] updated controller/endpoint names --- ...rTests.cs => CategoriesControllerTests.cs} | 6 ++--- ...erTests.cs => CustomersControllerTests.cs} | 10 +++---- ...ollerTests.cs => EventsControllerTests.cs} | 26 +++++++++---------- ...rTests.cs => OrganizersControllerTests.cs} | 20 +++++++------- ...AdminController.cs => AdminsController.cs} | 2 +- ...yController.cs => CategoriesController.cs} | 8 +++--- ...erController.cs => CustomersController.cs} | 4 +-- ...EventController.cs => EventsController.cs} | 14 +++++----- ...rController.cs => OrganizersController.cs} | 8 +++--- ...cketController.cs => TicketsController.cs} | 2 +- 10 files changed, 50 insertions(+), 50 deletions(-) rename TickAPI/TickAPI.Tests/Categories/Controllers/{CategoryControllerTests.cs => CategoriesControllerTests.cs} (92%) rename TickAPI/TickAPI.Tests/Customers/Controllers/{CustomerControllerTests.cs => CustomersControllerTests.cs} (97%) rename TickAPI/TickAPI.Tests/Events/Controllers/{EventControllerTests.cs => EventsControllerTests.cs} (93%) rename TickAPI/TickAPI.Tests/Organizers/Controllers/{OrganizerControllerTests.cs => OrganizersControllerTests.cs} (97%) rename TickAPI/TickAPI/Admins/Controllers/{AdminController.cs => AdminsController.cs} (72%) rename TickAPI/TickAPI/Categories/Controllers/{CategoryController.cs => CategoriesController.cs} (89%) rename TickAPI/TickAPI/Customers/Controllers/{CustomerController.cs => CustomersController.cs} (93%) rename TickAPI/TickAPI/Events/Controllers/{EventController.cs => EventsController.cs} (93%) rename TickAPI/TickAPI/Organizers/Controllers/{OrganizerController.cs => OrganizersController.cs} (96%) rename TickAPI/TickAPI/Tickets/Controllers/{TicketController.cs => TicketsController.cs} (72%) diff --git a/TickAPI/TickAPI.Tests/Categories/Controllers/CategoryControllerTests.cs b/TickAPI/TickAPI.Tests/Categories/Controllers/CategoriesControllerTests.cs similarity index 92% rename from TickAPI/TickAPI.Tests/Categories/Controllers/CategoryControllerTests.cs rename to TickAPI/TickAPI.Tests/Categories/Controllers/CategoriesControllerTests.cs index 7a0c8f0..271fd24 100644 --- a/TickAPI/TickAPI.Tests/Categories/Controllers/CategoryControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Categories/Controllers/CategoriesControllerTests.cs @@ -12,7 +12,7 @@ namespace TickAPI.Tests.Categories.Controllers; -public class CategoryControllerTests +public class CategoriesControllerTests { [Fact] public async Task GetCategories_WhenDataIsValid_ShouldReturnOk() @@ -25,7 +25,7 @@ public async Task GetCategories_WhenDataIsValid_ShouldReturnOk() Result>.Success(new PaginatedData(new List(), pageNumber, pageSize, true, true, new PaginationDetails(0, 0)))); - var sut = new CategoryController(categoryServiceMock.Object); + var sut = new CategoriesController(categoryServiceMock.Object); // Act var res = await sut.GetCategories(pageSize, pageNumber); @@ -49,7 +49,7 @@ public async Task CreateCategory_WhenDataIsValid_ShouldReturnSuccess() .Setup(m => m.CreateNewCategoryAsync(categoryName)) .ReturnsAsync(Result.Success(new Category())); - var sut = new CategoryController(categoryServiceMock.Object); + var sut = new CategoriesController(categoryServiceMock.Object); // Act var res = await sut.CreateCategory(createCategoryDto); diff --git a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs similarity index 97% rename from TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs rename to TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs index 8e9eadd..e7ce3a2 100644 --- a/TickAPI/TickAPI.Tests/Customers/Controllers/CustomerControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Customers/Controllers/CustomersControllerTests.cs @@ -14,7 +14,7 @@ namespace TickAPI.Tests.Customers.Controllers; -public class CustomerControllerTests +public class CustomersControllerTests { [Fact] public async Task GoogleLogin_WhenAuthSuccessAndCustomerExists_ShouldReturnToken() @@ -38,7 +38,7 @@ public async Task GoogleLogin_WhenAuthSuccessAndCustomerExists_ShouldReturnToken var claimsServiceMock = new Mock(); - var sut = new CustomerController( + var sut = new CustomersController( googleAuthServiceMock.Object, jwtServiceMock.Object, customerServiceMock.Object, @@ -83,7 +83,7 @@ public async Task GoogleLogin_WhenAuthSuccessAndCustomerDoesNotExist_ShouldCreat var claimsServiceMock = new Mock(); - var sut = new CustomerController( + var sut = new CustomersController( googleAuthServiceMock.Object, jwtServiceMock.Object, customerServiceMock.Object, @@ -137,7 +137,7 @@ public async Task AboutMe_WithValidEmailClaim_ShouldReturnCustomerDetails() var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(controllerContext.HttpContext.User.Claims)).Returns(Result.Success(email)); - var sut = new CustomerController( + var sut = new CustomersController( googleAuthServiceMock.Object, jwtServiceMock.Object, customerServiceMock.Object, @@ -168,7 +168,7 @@ public async Task AboutMe_WithMissingEmailClaim_ShouldReturnBadRequest() claimsServiceMock.Setup(m => m.GetEmailFromClaims(It.IsAny>())).Returns(Result.Failure(StatusCodes.Status400BadRequest, "missing email claim")); - var sut = new CustomerController( + var sut = new CustomersController( googleAuthServiceMock.Object, jwtServiceMock.Object, customerServiceMock.Object, diff --git a/TickAPI/TickAPI.Tests/Events/Controllers/EventControllerTests.cs b/TickAPI/TickAPI.Tests/Events/Controllers/EventsControllerTests.cs similarity index 93% rename from TickAPI/TickAPI.Tests/Events/Controllers/EventControllerTests.cs rename to TickAPI/TickAPI.Tests/Events/Controllers/EventsControllerTests.cs index 8c788b1..23c3511 100644 --- a/TickAPI/TickAPI.Tests/Events/Controllers/EventControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Events/Controllers/EventsControllerTests.cs @@ -16,7 +16,7 @@ namespace TickAPI.Tests.Events.Controllers; -public class EventControllerTests +public class EventsControllerTests { [Fact] public async Task CreateEvent_WhenDataIsValid_ShouldReturnSuccess() @@ -55,7 +55,7 @@ public async Task CreateEvent_WhenDataIsValid_ShouldReturnSuccess() var organizerServiceMock = new Mock(); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; @@ -87,7 +87,7 @@ public async Task CreateEvent_WhenMissingEmailClaims_ShouldReturnBadRequest() var organizerServiceMock = new Mock(); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = new ControllerContext { @@ -158,7 +158,7 @@ public async Task GetOrganizerEvents_WhenAllOperationsSucceed_ShouldReturnOkWith .Setup(m => m.GetOrganizerEventsAsync(organizer, page, pageSize)) .ReturnsAsync(Result>.Success(paginatedData)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; // Act @@ -195,7 +195,7 @@ public async Task GetOrganizerEvents_WhenEmailClaimIsMissing_ShouldReturnBadRequ var eventServiceMock = new Mock(); var organizerServiceMock = new Mock(); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext @@ -248,7 +248,7 @@ public async Task GetOrganizerEvents_WhenOrganizerIsNotFound_ShouldReturnNotFoun var eventServiceMock = new Mock(); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; // Act @@ -300,7 +300,7 @@ public async Task GetOrganizerEvents_WhenPaginationFails_ShouldReturnBadRequest( .Setup(m => m.GetOrganizerEventsAsync(organizer, page, pageSize)) .ReturnsAsync(Result>.Failure(StatusCodes.Status400BadRequest, errorMessage)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; // Act @@ -352,7 +352,7 @@ public async Task GetOrganizerEventsPaginationDetails_WhenAllOperationsSucceed_S .Setup(m => m.GetOrganizerEventsPaginationDetailsAsync(organizer, pageSize)) .ReturnsAsync(Result.Success(paginationDetails)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; // Act @@ -406,7 +406,7 @@ public async Task GetOrganizerEventsPaginationDetails_WhenPaginationDetailsFails .Setup(m => m.GetOrganizerEventsPaginationDetailsAsync(organizer, pageSize)) .ReturnsAsync(Result.Failure(StatusCodes.Status400BadRequest, errorMessage)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); sut.ControllerContext = controllerContext; // Act @@ -447,7 +447,7 @@ public async Task GetEvents_WhenAllOperationsSucceed_ShouldReturnOkWithPaginated .Setup(m => m.GetEventsAsync(page, pageSize)) .ReturnsAsync(Result>.Success(paginatedData)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); // Act var response = await sut.GetEvents(pageSize, page); @@ -484,7 +484,7 @@ public async Task GetEvents_WhenOperationFails_ShouldReturnErrorWithCorrectStatu .Setup(m => m.GetEventsAsync(page, pageSize)) .ReturnsAsync(Result>.Failure(statusCode, errorMessage)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); // Act var response = await sut.GetEvents(pageSize, page); @@ -512,7 +512,7 @@ public async Task GetEventsPaginationDetails_WhenAllOperationsSucceed_ShouldRetu .Setup(m => m.GetEventsPaginationDetailsAsync(pageSize)) .ReturnsAsync(Result.Success(paginationDetails)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); // Act var response = await sut.GetEventsPaginationDetails(pageSize); @@ -543,7 +543,7 @@ public async Task GetEventsPaginationDetails_WhenOperationFails_ShouldReturnErro .Setup(m => m.GetEventsPaginationDetailsAsync(pageSize)) .ReturnsAsync(Result.Failure(statusCode, errorMessage)); - var sut = new EventController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); + var sut = new EventsController(eventServiceMock.Object, claimsServiceMock.Object, organizerServiceMock.Object); // Act var response = await sut.GetEventsPaginationDetails(pageSize); diff --git a/TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizerControllerTests.cs b/TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizersControllerTests.cs similarity index 97% rename from TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizerControllerTests.cs rename to TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizersControllerTests.cs index 5e26e85..164b26c 100644 --- a/TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizerControllerTests.cs +++ b/TickAPI/TickAPI.Tests/Organizers/Controllers/OrganizersControllerTests.cs @@ -17,7 +17,7 @@ namespace TickAPI.Tests.Organizers.Controllers; -public class OrganizerControllerTests +public class OrganizersControllerTests { [Fact] public async Task GoogleLogin_WhenAuthSuccessAndVerifiedOrganizerExists_ShouldReturnValidVerifiedLoginDto() @@ -44,7 +44,7 @@ public async Task GoogleLogin_WhenAuthSuccessAndVerifiedOrganizerExists_ShouldRe var claimsServiceMock = new Mock(); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -85,7 +85,7 @@ public async Task GoogleLogin_WhenAuthSuccessAndUnverifiedOrganizerExists_Should var claimsServiceMock = new Mock(); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -127,7 +127,7 @@ public async Task var claimsServiceMock = new Mock(); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -189,7 +189,7 @@ public async Task CreateOrganizer_WhenCreatingAccountIsSuccessful_ShouldReturnTo var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(controllerContext.HttpContext.User.Claims)).Returns(Result.Success(email)); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -218,7 +218,7 @@ public async Task CreateOrganizer_WhenMissingEmailClaim_ShouldReturnBadRequest() var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(It.IsAny>())).Returns(Result.Failure(StatusCodes.Status400BadRequest, "missing email claim")); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -258,7 +258,7 @@ public async Task VerifyOrganizer_WhenVerificationSuccessful_ShouldReturnOk() var claimsServiceMock = new Mock(); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -318,7 +318,7 @@ public async Task AboutMe_WithValidEmailClaim_ShouldReturnOrganizerDetails() var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(controllerContext.HttpContext.User.Claims)).Returns(Result.Success(email)); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -351,7 +351,7 @@ public async Task AboutMe_WithMissingEmailClaim_ShouldReturnBadRequest() var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(It.IsAny>())).Returns(Result.Failure(StatusCodes.Status400BadRequest, "missing email claim")); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, @@ -404,7 +404,7 @@ public async Task AboutMe_WhenOrganizerNotFound_ShouldReturnInternalServerError( var claimsServiceMock = new Mock(); claimsServiceMock.Setup(m => m.GetEmailFromClaims(controllerContext.HttpContext.User.Claims)).Returns(Result.Success(email)); - var sut = new OrganizerController( + var sut = new OrganizersController( googleAuthServiceMock.Object, jwtServiceMock.Object, organizerServiceMock.Object, diff --git a/TickAPI/TickAPI/Admins/Controllers/AdminController.cs b/TickAPI/TickAPI/Admins/Controllers/AdminsController.cs similarity index 72% rename from TickAPI/TickAPI/Admins/Controllers/AdminController.cs rename to TickAPI/TickAPI/Admins/Controllers/AdminsController.cs index 63e23b2..cbc77bb 100644 --- a/TickAPI/TickAPI/Admins/Controllers/AdminController.cs +++ b/TickAPI/TickAPI/Admins/Controllers/AdminsController.cs @@ -4,7 +4,7 @@ namespace TickAPI.Admins.Controllers; [ApiController] [Route("api/[controller]")] -public class AdminController : ControllerBase +public class AdminsController : ControllerBase { } \ No newline at end of file diff --git a/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs b/TickAPI/TickAPI/Categories/Controllers/CategoriesController.cs similarity index 89% rename from TickAPI/TickAPI/Categories/Controllers/CategoryController.cs rename to TickAPI/TickAPI/Categories/Controllers/CategoriesController.cs index 7ec4ea6..684f0bc 100644 --- a/TickAPI/TickAPI/Categories/Controllers/CategoryController.cs +++ b/TickAPI/TickAPI/Categories/Controllers/CategoriesController.cs @@ -10,17 +10,17 @@ namespace TickAPI.Categories.Controllers; [ApiController] [Route("api/[controller]")] -public class CategoryController : Controller +public class CategoriesController : Controller { private readonly ICategoryService _categoryService; - public CategoryController(ICategoryService categoryService) + public CategoriesController(ICategoryService categoryService) { _categoryService = categoryService; } [AuthorizeWithPolicy(AuthPolicies.VerifiedUserPolicy)] - [HttpGet("categories")] + [HttpGet] public async Task>> GetCategories([FromQuery] int pageSize, [FromQuery] int page) { var res = await _categoryService.GetCategoriesResponsesAsync(pageSize, page); @@ -32,7 +32,7 @@ public async Task>> GetCatego } // TODO: Add appropriate policy verification (admin, maybe also organizer?) - [HttpPost("category")] + [HttpPost] public async Task CreateCategory([FromBody] CreateCategoryDto request) { var newCategoryResult = await _categoryService.CreateNewCategoryAsync(request.Name); diff --git a/TickAPI/TickAPI/Customers/Controllers/CustomerController.cs b/TickAPI/TickAPI/Customers/Controllers/CustomersController.cs similarity index 93% rename from TickAPI/TickAPI/Customers/Controllers/CustomerController.cs rename to TickAPI/TickAPI/Customers/Controllers/CustomersController.cs index 6b5caaf..4ec0730 100644 --- a/TickAPI/TickAPI/Customers/Controllers/CustomerController.cs +++ b/TickAPI/TickAPI/Customers/Controllers/CustomersController.cs @@ -11,14 +11,14 @@ namespace TickAPI.Customers.Controllers; [ApiController] [Route("api/[controller]")] -public class CustomerController : ControllerBase +public class CustomersController : ControllerBase { private readonly IGoogleAuthService _googleAuthService; private readonly IJwtService _jwtService; private readonly ICustomerService _customerService; private readonly IClaimsService _claimsService; - public CustomerController(IGoogleAuthService googleAuthService, IJwtService jwtService, ICustomerService customerService, IClaimsService claimsService) + public CustomersController(IGoogleAuthService googleAuthService, IJwtService jwtService, ICustomerService customerService, IClaimsService claimsService) { _googleAuthService = googleAuthService; _jwtService = jwtService; diff --git a/TickAPI/TickAPI/Events/Controllers/EventController.cs b/TickAPI/TickAPI/Events/Controllers/EventsController.cs similarity index 93% rename from TickAPI/TickAPI/Events/Controllers/EventController.cs rename to TickAPI/TickAPI/Events/Controllers/EventsController.cs index 09b2e65..1c50747 100644 --- a/TickAPI/TickAPI/Events/Controllers/EventController.cs +++ b/TickAPI/TickAPI/Events/Controllers/EventsController.cs @@ -14,13 +14,13 @@ namespace TickAPI.Events.Controllers; [Route("api/[controller]")] // TODO: Add lists of categories and tickettypes -public class EventController : ControllerBase +public class EventsController : ControllerBase { private readonly IEventService _eventService; private readonly IClaimsService _claimsService; private readonly IOrganizerService _organizerService; - public EventController(IEventService eventService, IClaimsService claimsService, IOrganizerService organizerService) + public EventsController(IEventService eventService, IClaimsService claimsService, IOrganizerService organizerService) { _eventService = eventService; _claimsService = claimsService; @@ -28,7 +28,7 @@ public EventController(IEventService eventService, IClaimsService claimsService, } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpPost("event")] + [HttpPost] public async Task> CreateEvent([FromBody] CreateEventDto request) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -47,7 +47,7 @@ public async Task> CreateEvent([FromBody] C } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpGet("organizer-events")] + [HttpGet("organizer")] public async Task>> GetOrganizerEvents([FromQuery] int pageSize, [FromQuery] int page) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -74,7 +74,7 @@ public async Task>> GetOrganizer } [AuthorizeWithPolicy(AuthPolicies.VerifiedOrganizerPolicy)] - [HttpGet("organizer-events-pagination-details")] + [HttpGet("organizer-pagination-details")] public async Task> GetOrganizerEventsPaginationDetails([FromQuery] int pageSize) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -101,7 +101,7 @@ public async Task> GetOrganizerEventsPaginationD } [AuthorizeWithPolicy(AuthPolicies.CustomerPolicy)] - [HttpGet("events")] + [HttpGet] public async Task>> GetEvents([FromQuery] int pageSize, [FromQuery] int page) { var paginatedDataResult = await _eventService.GetEventsAsync(page, pageSize); @@ -113,7 +113,7 @@ public async Task>> GetEvents([F } [AuthorizeWithPolicy(AuthPolicies.CustomerPolicy)] - [HttpGet("events-pagination-details")] + [HttpGet("pagination-details")] public async Task> GetEventsPaginationDetails([FromQuery] int pageSize) { var paginationDetailsResult = await _eventService.GetEventsPaginationDetailsAsync(pageSize); diff --git a/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs b/TickAPI/TickAPI/Organizers/Controllers/OrganizersController.cs similarity index 96% rename from TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs rename to TickAPI/TickAPI/Organizers/Controllers/OrganizersController.cs index a4644d6..cb405e3 100644 --- a/TickAPI/TickAPI/Organizers/Controllers/OrganizerController.cs +++ b/TickAPI/TickAPI/Organizers/Controllers/OrganizersController.cs @@ -12,14 +12,14 @@ namespace TickAPI.Organizers.Controllers; [ApiController] [Route("api/[controller]")] -public class OrganizerController : ControllerBase +public class OrganizersController : ControllerBase { private readonly IGoogleAuthService _googleAuthService; private readonly IJwtService _jwtService; private readonly IOrganizerService _organizerService; private readonly IClaimsService _claimsService; - public OrganizerController(IGoogleAuthService googleAuthService, IJwtService jwtService, + public OrganizersController(IGoogleAuthService googleAuthService, IJwtService jwtService, IOrganizerService organizerService, IClaimsService claimsService) { _googleAuthService = googleAuthService; @@ -62,7 +62,7 @@ public async Task> GoogleLogin([Fr } [AuthorizeWithPolicy(AuthPolicies.NewOrganizerPolicy)] - [HttpPost("organizer")] + [HttpPost] public async Task> CreateOrganizer([FromBody] CreateOrganizerDto request) { var emailResult = _claimsService.GetEmailFromClaims(User.Claims); @@ -84,7 +84,7 @@ public async Task> CreateOrganizer([Fro } // TODO: Add authorization with admin policy here - [HttpPost("verify-organizer")] + [HttpPost("verify")] public async Task VerifyOrganizer([FromBody] VerifyOrganizerDto request) { var verifyOrganizerResult = await _organizerService.VerifyOrganizerByEmailAsync(request.Email); diff --git a/TickAPI/TickAPI/Tickets/Controllers/TicketController.cs b/TickAPI/TickAPI/Tickets/Controllers/TicketsController.cs similarity index 72% rename from TickAPI/TickAPI/Tickets/Controllers/TicketController.cs rename to TickAPI/TickAPI/Tickets/Controllers/TicketsController.cs index fa02f1f..fcf4467 100644 --- a/TickAPI/TickAPI/Tickets/Controllers/TicketController.cs +++ b/TickAPI/TickAPI/Tickets/Controllers/TicketsController.cs @@ -4,7 +4,7 @@ namespace TickAPI.Tickets.Controllers; [ApiController] [Route("api/[controller]")] -public class TicketController : ControllerBase +public class TicketsController : ControllerBase { } \ No newline at end of file