Add a API entry point to get all tags

This commit is contained in:
Greg Burri 2025-05-20 15:32:54 +02:00
parent 6e017e41a3
commit c24b0caeaf
7 changed files with 55 additions and 63 deletions

View file

@ -1,11 +1,10 @@
use axum::{
debug_handler,
extract::{Extension, Path, Query, State},
extract::{Extension, Path, State},
http::{HeaderMap, StatusCode},
response::{IntoResponse, Result},
};
use axum_extra::extract::cookie::{Cookie, CookieJar, SameSite};
use common::ron_api;
use crate::{
app::Context,

View file

@ -88,6 +88,19 @@ pub async fn get_tags(
))
}
#[debug_handler]
pub async fn get_all_tags(
State(connection): State<db::Connection>,
Extension(context): Extension<Context>,
nb_max_tags: Query<Option<u32>>,
lang: Query<Option<String>>,
) -> Result<impl IntoResponse> {
let lang = lang.0.unwrap_or(context.tr.current_lang_code().to_string());
Ok(ron_response_ok(
connection.get_all_tags(&lang, nb_max_tags.0).await?,
))
}
#[debug_handler]
pub async fn add_tags(
State(connection): State<db::Connection>,