User profile service #2

Merged
Jiri merged 16 commits from 250809_UserProfile into main 2025-08-11 20:10:50 +00:00
Owner
No description provided.
Jiri added 16 commits 2025-08-11 20:10:36 +00:00
Adds functionality to allow administrators to modify the admin status of other users.

Introduces an endpoint for changing user admin status, accessible only to existing administrators.
This change includes necessary services and request models to handle the logic.
Moves the ChangeUserAdminStatusRequest to the ApiModels folder.
Updates the admin controller route to "admin" and the admin status
endpoint to "adminStatus".
Makes the ChangeUserAdminStatus method asynchronous.
Uses NotFoundException instead of KeyNotFoundException.
Adds an authorization policy to restrict access to admin-only endpoints.
Creates an `AdminOnlyRequirement` and `AdminOnlyHandler` to check if a user has admin privileges.
Applies the "AdminOnly" policy to the AdminController to secure admin functionalities.
Modifies the endpoint for changing user admin status to include the user ID in the route.
# Conflicts:
#	DrinkRateAPI/Services/UserProfileService.cs
Relocates the endpoint for updating user admin status from the dedicated AdminController to the UserProfileController.

This consolidates user profile management under a single controller
and leverages existing authorization policies.
Implement global exception handling to provide consistent error responses.
Registes custom exceptions with corresponding HTTP status codes and descriptions.
Changes from throwing an exception when a user profile is not found to returning null.

This prevents the application from crashing when a user profile is not found, allowing for more graceful error handling.
Jiri merged commit de8d07ee02 into main 2025-08-11 20:10:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: chilldev/drinkrate#2
No description provided.