Исправления сваггер
This commit is contained in:
@@ -16,13 +16,17 @@ public static class IdentityEndpoints
|
||||
{
|
||||
var result = await sender.Send(command);
|
||||
return Results.Ok(result);
|
||||
});
|
||||
})
|
||||
.WithName("Register")
|
||||
.WithOpenApi(operation => new(operation) { Summary = "Регистрация пользователя", Description = "Регистрирует нового пользователя по номеру телефона и паролю." });
|
||||
|
||||
authGroup.MapPost("/login", async (LoginCommand command, ISender sender) =>
|
||||
{
|
||||
var token = await sender.Send(command);
|
||||
return Results.Ok(new { Token = token });
|
||||
});
|
||||
return Results.Ok(new LoginResponse(token));
|
||||
})
|
||||
.WithName("Login")
|
||||
.WithOpenApi(operation => new(operation) { Summary = "Вход в систему", Description = "Аутентификация пользователя и получение JWT токена." });
|
||||
|
||||
var profileGroup = app.MapGroup("/api/profile").WithTags("Profile").RequireAuthorization();
|
||||
|
||||
@@ -30,6 +34,14 @@ public static class IdentityEndpoints
|
||||
{
|
||||
await sender.Send(new BecomePerformerCommand());
|
||||
return Results.Ok();
|
||||
});
|
||||
})
|
||||
.WithName("BecomePerformer")
|
||||
.WithOpenApi(operation => new(operation) { Summary = "Стать исполнителем", Description = "Присваивает текущему пользователю роль исполнителя." });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ответ на успешный вход в систему.
|
||||
/// </summary>
|
||||
/// <param name="Token">JWT токен доступа.</param>
|
||||
public record LoginResponse(string Token);
|
||||
|
||||
@@ -13,4 +13,7 @@
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user