Files
pos-system/services/iam-service-net/src/IamService.API/Application/Commands/Roles/AssignRoleToUserCommand.cs
Ho Ngoc Hai eb5cb28d9f feat(exceptions): Introduce custom exceptions for better error handling and validation
- Added custom exceptions: DuplicateResourceException, EntityNotFoundException, AuthenticationFailedException, and BusinessRuleException to improve error handling in the application.
- Updated Program.cs to map these exceptions to appropriate HTTP status codes and problem details for better client feedback.
- Refactored RegisterUserCommandHandler to throw DuplicateResourceException when a user with the same email already exists.
- Enhanced testing setup in CustomWebApplicationFactory to ensure proper handling of these exceptions during functional tests.
2026-01-12 20:04:38 +07:00

14 lines
415 B
C#

using MediatR;
namespace IamService.API.Application.Commands.Roles;
/// <summary>
/// EN: Command to assign a role to a user.
/// VI: Command để gán role cho user.
/// </summary>
/// <param name="UserId">User ID / ID của user</param>
/// <param name="RoleName">Role name to assign / Tên role cần gán</param>
public record AssignRoleToUserCommand(
Guid UserId,
string RoleName) : IRequest<bool>;