Add utoipa and Scalar for API documentation
- Add utoipa and utoipa-scalar dependencies - Add ToSchema derives to all models - Add OpenAPI path annotations to auth, users, and health handlers - Create openapi.rs module with API documentation - Serve Scalar UI at /docs endpoint - Include JWT bearer auth security scheme Co-Authored-By: Warp <agent@warp.dev>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::FromRow;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
/// Team player positions
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, ToSchema)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum PlayerPosition {
|
||||
Captain,
|
||||
@@ -32,7 +33,7 @@ impl PlayerPosition {
|
||||
}
|
||||
|
||||
/// Team player status
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, ToSchema)]
|
||||
pub enum TeamPlayerStatus {
|
||||
Pending = 0,
|
||||
Active = 1,
|
||||
@@ -48,7 +49,7 @@ impl From<i32> for TeamPlayerStatus {
|
||||
}
|
||||
|
||||
/// Team player model representing the team_players table
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, FromRow, ToSchema)]
|
||||
pub struct TeamPlayer {
|
||||
pub id: i32,
|
||||
pub date_created: DateTime<Utc>,
|
||||
@@ -59,13 +60,13 @@ pub struct TeamPlayer {
|
||||
}
|
||||
|
||||
/// Join team request
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, ToSchema)]
|
||||
pub struct JoinTeamRequest {
|
||||
pub team_id: i32,
|
||||
}
|
||||
|
||||
/// Change position request
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, ToSchema)]
|
||||
pub struct ChangePositionRequest {
|
||||
pub position: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user