mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-31 06:33:09 +02:00
feat: categories list api router
This commit is contained in:
13
api-router/src/routes/categories.rs
Normal file
13
api-router/src/routes/categories.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use axum::{extract::State, response::IntoResponse, Extension, Json};
|
||||
use common::storage::types::user::User;
|
||||
|
||||
use crate::{api_state::ApiState, error::ApiError};
|
||||
|
||||
pub async fn get_categories(
|
||||
State(state): State<ApiState>,
|
||||
Extension(user): Extension<User>,
|
||||
) -> Result<impl IntoResponse, ApiError> {
|
||||
let categories = User::get_user_categories(&user.id, &state.db).await?;
|
||||
|
||||
Ok(Json(categories))
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
pub mod categories;
|
||||
pub mod ingress;
|
||||
|
||||
Reference in New Issue
Block a user