Enhance role management by adding pricing fields and updating related logic
CI / Backend (build + test) (push) Successful in 1m22s
CI / Frontend (lint + typecheck + build) (push) Successful in 32s

- 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:
Leonid Pershin
2026-07-18 19:02:12 +03:00
parent 68781ef183
commit 285d8180c8
29 changed files with 2638 additions and 30 deletions
@@ -53,7 +53,13 @@ public static class RoleEndpoints
)
{
var result = await sender.Send(
new UpdateRoleCommand(id, body.MaxConfigs, body.MaxIpLimit),
new UpdateRoleCommand(
id,
body.MaxConfigs,
body.MaxIpLimit,
body.PricePerConfigPerQuarter,
body.PricePerConfigPerYear
),
cancellationToken
);
return result.ToHttpResult();
@@ -84,6 +90,11 @@ public static class RoleEndpoints
}
}
public sealed record UpdateRoleBody(int MaxConfigs, int MaxIpLimit);
public sealed record UpdateRoleBody(
int MaxConfigs,
int MaxIpLimit,
int? PricePerConfigPerQuarter,
int? PricePerConfigPerYear
);
public sealed record ChangeUserRoleBody(Guid RoleId);
@@ -22,7 +22,7 @@ public static class SupportEndpoints
{
var group = app.MapGroup("/api/support").WithTags("Support").RequireAuthorization();
group.MapGet("/roles", ListSelectableRoles).Produces<IReadOnlyList<RoleDto>>();
group.MapGet("/roles", ListSelectableRoles).Produces<IReadOnlyList<SelectableRoleDto>>();
group
.MapPost("/tickets/bug-reports", CreateBugReport)
.DisableAntiforgery()