Fix Interface names, controller error handling, and RESTful API endpoints#53
Fix Interface names, controller error handling, and RESTful API endpoints#53Copilot wants to merge 11 commits into
Conversation
…rect Controller -> Service -> Repository pattern Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/5d4506c8-b4da-4254-b0bc-e8a75055aa27 Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/5d4506c8-b4da-4254-b0bc-e8a75055aa27 Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
|
@copilot the code inside the controllers must be in a try catch block |
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/49c1b577-d8d3-4786-bb8e-894144edc624 Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
|
@copilot throw the actual errors, not just add the throw keyword |
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/6cc743ed-eba7-499f-a8ab-a307baf6814f Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
|
@copilot for the controllers, they should return the corresponding HTTP status code based on the success or failure of the operation, adjust them accordingly, especially the Authentication related ones |
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/819eb3ba-a9c0-4cf6-9ae4-16f89e1be086 Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
Done in a5eebdf. All controllers now catch specific exceptions and return the corresponding HTTP status codes:
|
|
@copilot You didn't understand, I meant I want auth-related exceptions for the auth controller only, for the others i do not want the following in them, because they are not related to authentication at all: catch (InvalidCredentialsException ex)
{
return Unauthorized(ex.Message);
}
catch (UserAlreadyExistsException ex)
{
return Conflict(ex.Message);
}
catch (EmptyFieldsException ex)
{
return BadRequest(ex.Message);
}Now review what the services do and the current custom exceptions and try to add new custom exceptions to the services/repositories if you find any use for them |
…ontrollers, add domain-specific exceptions Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/273899e2-0cf5-481f-a08e-d530b942064c Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
…ace collision Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/273899e2-0cf5-481f-a08e-d530b942064c Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
Changes made:
|
|
@copilot okay cool, now I want you to remove all tests related to the only the controllers, leave the rest |
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/7b0acfc6-5e93-476c-9284-36e0cffd6c1e Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
Done in f73081d. Removed all 5 controller test files (AuthControllerTest, InterviewControllerTest, InterviewSessionControllerTest, UserControllerTest, ProfilePictureControllerTest). The remaining 109 service/repository tests all pass. |
|
@copilot adjsut the endpoints to follow the best practices for RESTful APIs |
Agent-Logs-Url: https://github.com/P1l3T0/prepAIred/sessions/dc4bf92c-fc8e-4afe-ab4e-90db3e3cd33d Co-authored-by: P1l3T0 <95146724+P1l3T0@users.noreply.github.com>
Done in c1622fd. All endpoints now follow RESTful best practices:
|
Swap Repository/Service interface and class names to correct layering pattern, add proper error handling to controllers, and adjust all endpoints to follow RESTful API best practices.
Changes Made
api/users,api/interviews,api/interview-sessions,api/profile-pictures)GET api/users/meinstead ofGET api/User/get-current-user)api/interviews/hr,api/interviews/technical,api/interview-sessions/statistics)