Enhance role management by adding pricing fields and updating related logic
- Updated `CreateRoleCommand` and `UpdateRoleCommand` to include optional pricing fields: `PricePerConfigPerQuarter` and `PricePerConfigPerYear`. - Modified `RoleEndpoints` to handle the new pricing parameters during role creation and updates. - Enhanced validation logic in `CreateRoleCommandValidator` and `UpdateRoleCommandValidator` to ensure pricing fields are non-negative when provided. - Updated `RoleDto` and `SelectableRoleDto` to include pricing information, ensuring proper data handling in API responses. - Adjusted frontend components to support new pricing fields in role forms and display total costs based on configurations. - Updated API documentation to reflect changes in role management endpoints and pricing structure.
This commit is contained in:
+4
-2
@@ -27,7 +27,7 @@ public class ApproveRoleRequestCommandHandlerTests
|
||||
|
||||
var newRoleId = Guid.NewGuid();
|
||||
_roleService
|
||||
.CreateRoleAsync("premium", 10, 5, Arg.Any<CancellationToken>())
|
||||
.CreateRoleAsync("premium", 10, 5, null, null, Arg.Any<CancellationToken>())
|
||||
.Returns(Result.Success(new RoleDto(newRoleId, "premium", 10, 5, false)));
|
||||
_roleService
|
||||
.ChangeUserRoleAsync(userId, newRoleId, Arg.Any<CancellationToken>())
|
||||
@@ -51,7 +51,7 @@ public class ApproveRoleRequestCommandHandlerTests
|
||||
Assert.Equal(TicketStatus.Resolved, ticket.Status);
|
||||
await _roleService
|
||||
.Received(1)
|
||||
.CreateRoleAsync("premium", 10, 5, Arg.Any<CancellationToken>());
|
||||
.CreateRoleAsync("premium", 10, 5, null, null, Arg.Any<CancellationToken>());
|
||||
await _roleService
|
||||
.Received(1)
|
||||
.ChangeUserRoleAsync(userId, newRoleId, Arg.Any<CancellationToken>());
|
||||
@@ -100,6 +100,8 @@ public class ApproveRoleRequestCommandHandlerTests
|
||||
Arg.Any<string>(),
|
||||
Arg.Any<int>(),
|
||||
Arg.Any<int>(),
|
||||
Arg.Any<int?>(),
|
||||
Arg.Any<int?>(),
|
||||
Arg.Any<CancellationToken>()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user