aboutsummaryrefslogtreecommitdiff
path: root/src/routers/mod.rs
blob: f9ec049f114950ad959485ef2b894883a8c6f3be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod account;
mod queue;

use axum::extract::OriginalUri;
use utoipa::OpenApi;
use utoipa_axum::router::OpenApiRouter;

use crate::{AppOpenApi, AppState, ClientError, ErrorResponse};

pub async fn not_found(OriginalUri(path): OriginalUri) -> ErrorResponse {
    ClientError::NotFound {
        path: path.to_string(),
    }
    .into()
}

pub async fn method_not_allowed(OriginalUri(path): OriginalUri) -> ErrorResponse {
    ClientError::MethodNotAllowed {
        path: path.to_string(),
    }
    .into()
}

pub fn router() -> OpenApiRouter<AppState> {
    OpenApiRouter::with_openapi(AppOpenApi::openapi())
        .nest("/account", account::router())
        .nest("/queue", queue::router())
}