diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api.rs | 7 | ||||
| -rw-r--r-- | src/routers/queue/access.rs | 7 | ||||
| -rw-r--r-- | src/routers/queue/manage.rs | 14 | ||||
| -rw-r--r-- | src/routers/queue/mod.rs | 5 |
4 files changed, 23 insertions, 10 deletions
| @@ -7,7 +7,8 @@ use crate::ErrorResponse; | |||
| 7 | 7 | ||
| 8 | pub mod tags { | 8 | pub mod tags { |
| 9 | pub const ACCOUNT: &str = "Account"; | 9 | pub const ACCOUNT: &str = "Account"; |
| 10 | pub const QUEUE_MANAGEMENT: &str = "Queue management"; | 10 | pub const QUEUE: &str = "Queue"; |
| 11 | pub const QUEUE_ACCESS: &str = "Queue access"; | ||
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | struct AuthModifier; | 14 | struct AuthModifier; |
| @@ -50,7 +51,9 @@ impl Modify for AuthModifier { | |||
| 50 | (url = "https://очередь.псж.онлайн/api/v1/", description = "Production server"), | 51 | (url = "https://очередь.псж.онлайн/api/v1/", description = "Production server"), |
| 51 | ), | 52 | ), |
| 52 | tags( | 53 | tags( |
| 53 | (name=tags::ACCOUNT, description="Account management methods") | 54 | (name=tags::ACCOUNT, description="Account management methods"), |
| 55 | (name=tags::QUEUE, description="Queue management methods"), | ||
| 56 | (name=tags::QUEUE_ACCESS, description="Queue access management methods") | ||
| 54 | ), | 57 | ), |
| 55 | components( | 58 | components( |
| 56 | schemas(ErrorResponse) | 59 | schemas(ErrorResponse) |
diff --git a/src/routers/queue/access.rs b/src/routers/queue/access.rs new file mode 100644 index 0000000..1cba0b1 --- /dev/null +++ b/src/routers/queue/access.rs | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | use utoipa_axum::router::OpenApiRouter; | ||
| 2 | |||
| 3 | use crate::AppState; | ||
| 4 | |||
| 5 | pub fn router() -> OpenApiRouter<AppState> { | ||
| 6 | OpenApiRouter::new() | ||
| 7 | } | ||
diff --git a/src/routers/queue/manage.rs b/src/routers/queue/manage.rs index 67a3abc..8f42e07 100644 --- a/src/routers/queue/manage.rs +++ b/src/routers/queue/manage.rs | |||
| @@ -12,7 +12,7 @@ use crate::{ | |||
| 12 | ApiError, ApiResult, AppState, ClientError, GlobalResponses, SuccessResponse, | 12 | ApiError, ApiResult, AppState, ClientError, GlobalResponses, SuccessResponse, |
| 13 | extract::{ApiJson, ApiQuery, Auth}, | 13 | extract::{ApiJson, ApiQuery, Auth}, |
| 14 | models::Queue, | 14 | models::Queue, |
| 15 | tags::QUEUE_MANAGEMENT, | 15 | tags::QUEUE, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | async fn user_exists(id: i64, db: &DatabaseConnection) -> Result<bool, ApiError> { | 18 | async fn user_exists(id: i64, db: &DatabaseConnection) -> Result<bool, ApiError> { |
| @@ -83,7 +83,7 @@ struct DeleteQueueRequest { | |||
| 83 | #[utoipa::path( | 83 | #[utoipa::path( |
| 84 | get, | 84 | get, |
| 85 | path = "/get/id", | 85 | path = "/get/id", |
| 86 | tag = QUEUE_MANAGEMENT, | 86 | tag = QUEUE, |
| 87 | summary = "Get by id", | 87 | summary = "Get by id", |
| 88 | description = "Get the queue by id", | 88 | description = "Get the queue by id", |
| 89 | params(GetByIdQueueQuery), | 89 | params(GetByIdQueueQuery), |
| @@ -110,7 +110,7 @@ async fn get_by_id( | |||
| 110 | #[utoipa::path( | 110 | #[utoipa::path( |
| 111 | get, | 111 | get, |
| 112 | path = "/get/owner", | 112 | path = "/get/owner", |
| 113 | tag = QUEUE_MANAGEMENT, | 113 | tag = QUEUE, |
| 114 | summary = "Get by owner", | 114 | summary = "Get by owner", |
| 115 | description = "Get queues for a given owner", | 115 | description = "Get queues for a given owner", |
| 116 | params(GetByOwnerIdQuery), | 116 | params(GetByOwnerIdQuery), |
| @@ -140,7 +140,7 @@ async fn get_by_owner( | |||
| 140 | #[utoipa::path( | 140 | #[utoipa::path( |
| 141 | post, | 141 | post, |
| 142 | path = "/create", | 142 | path = "/create", |
| 143 | tag = QUEUE_MANAGEMENT, | 143 | tag = QUEUE, |
| 144 | summary = "Create", | 144 | summary = "Create", |
| 145 | description = "Create a new queue", | 145 | description = "Create a new queue", |
| 146 | request_body = CreateQueueRequest, | 146 | request_body = CreateQueueRequest, |
| @@ -173,7 +173,7 @@ async fn create( | |||
| 173 | #[utoipa::path( | 173 | #[utoipa::path( |
| 174 | put, | 174 | put, |
| 175 | path = "/update/name", | 175 | path = "/update/name", |
| 176 | tag = QUEUE_MANAGEMENT, | 176 | tag = QUEUE, |
| 177 | summary = "Change name", | 177 | summary = "Change name", |
| 178 | description = "Change queue name", | 178 | description = "Change queue name", |
| 179 | request_body = ChangeQueueNameRequest, | 179 | request_body = ChangeQueueNameRequest, |
| @@ -204,7 +204,7 @@ async fn update_name( | |||
| 204 | #[utoipa::path( | 204 | #[utoipa::path( |
| 205 | put, | 205 | put, |
| 206 | path = "/update/owner", | 206 | path = "/update/owner", |
| 207 | tag = QUEUE_MANAGEMENT, | 207 | tag = QUEUE, |
| 208 | summary = "Change owner", | 208 | summary = "Change owner", |
| 209 | description = "Reassign queue ownership", | 209 | description = "Reassign queue ownership", |
| 210 | request_body = ChangeQueueOwnershipRequest, | 210 | request_body = ChangeQueueOwnershipRequest, |
| @@ -242,7 +242,7 @@ async fn update_owner( | |||
| 242 | #[utoipa::path( | 242 | #[utoipa::path( |
| 243 | delete, | 243 | delete, |
| 244 | path = "/delete", | 244 | path = "/delete", |
| 245 | tag = QUEUE_MANAGEMENT, | 245 | tag = QUEUE, |
| 246 | summary = "Delete", | 246 | summary = "Delete", |
| 247 | description = "Delete the queue", | 247 | description = "Delete the queue", |
| 248 | request_body = DeleteQueueRequest, | 248 | request_body = DeleteQueueRequest, |
diff --git a/src/routers/queue/mod.rs b/src/routers/queue/mod.rs index bf2acb5..dd03956 100644 --- a/src/routers/queue/mod.rs +++ b/src/routers/queue/mod.rs | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | mod access; | ||
| 1 | mod manage; | 2 | mod manage; |
| 2 | 3 | ||
| 3 | use utoipa_axum::router::OpenApiRouter; | 4 | use utoipa_axum::router::OpenApiRouter; |
| @@ -5,5 +6,7 @@ use utoipa_axum::router::OpenApiRouter; | |||
| 5 | use crate::AppState; | 6 | use crate::AppState; |
| 6 | 7 | ||
| 7 | pub fn router() -> OpenApiRouter<AppState> { | 8 | pub fn router() -> OpenApiRouter<AppState> { |
| 8 | OpenApiRouter::new().merge(manage::router()) | 9 | OpenApiRouter::new() |
| 10 | .merge(manage::router()) | ||
| 11 | .merge(access::router()) | ||
| 9 | } | 12 | } |
