Enhance API endpoints with response type annotations
CI / Backend (build + test) (push) Successful in 1m15s
CI / Frontend (lint + typecheck + build) (push) Successful in 30s

- Updated various API endpoints to include response type annotations using .Produces<T>() for better documentation and type safety.
- Enhanced activation, admin, user, config, and other endpoints to specify response types, improving clarity for frontend integration.
- Added new DTOs for structured responses in authentication and Telegram-related endpoints.
- Improved overall API schema generation to reflect these changes, ensuring consistency between backend and frontend types.
This commit is contained in:
Leonid Pershin
2026-07-02 12:56:03 +03:00
parent 8067be3c35
commit 8b92204733
15 changed files with 493 additions and 143 deletions
@@ -1,6 +1,7 @@
using PnvPanel.Api.Common;
using PnvPanel.Application.Admin.Roles;
using PnvPanel.Application.Admin.Users;
using PnvPanel.Application.Common.Interfaces;
using PnvPanel.Application.Common.Messaging;
using PnvPanel.Infrastructure.Identity;
@@ -14,11 +15,11 @@ public static class RoleEndpoints
.WithTags("Admin.Roles")
.RequireAuthorization(policy => policy.RequireRole(RoleNames.Admin));
admin.MapGet("/roles", ListRoles);
admin.MapPost("/roles", CreateRole);
admin.MapPut("/roles/{id:guid}", UpdateRole);
admin.MapDelete("/roles/{id:guid}", DeleteRole);
admin.MapPatch("/users/{id:guid}/role", ChangeUserRole);
admin.MapGet("/roles", ListRoles).Produces<IReadOnlyList<RoleDto>>();
admin.MapPost("/roles", CreateRole).Produces<RoleDto>();
admin.MapPut("/roles/{id:guid}", UpdateRole).Produces<RoleDto>();
admin.MapDelete("/roles/{id:guid}", DeleteRole).Produces(StatusCodes.Status204NoContent);
admin.MapPatch("/users/{id:guid}/role", ChangeUserRole).Produces(StatusCodes.Status204NoContent);
return app;
}