From c91dce4f77ae12453203f0a28b91efb6533cc095 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 9 Dec 2025 13:07:14 +0100 Subject: feat(rocie-server): Implement basic user handling and authentication --- crates/rocie-server/src/api/get/recipe.rs | 66 ------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 crates/rocie-server/src/api/get/recipe.rs (limited to 'crates/rocie-server/src/api/get/recipe.rs') diff --git a/crates/rocie-server/src/api/get/recipe.rs b/crates/rocie-server/src/api/get/recipe.rs deleted file mode 100644 index 70bab39..0000000 --- a/crates/rocie-server/src/api/get/recipe.rs +++ /dev/null @@ -1,66 +0,0 @@ -use actix_web::{HttpResponse, Responder, error::Result, get, web}; - -use crate::{ - app::App, - storage::sql::recipe::{Recipe, RecipeId, RecipeIdStub}, -}; - -/// Get an recipe by it's id. -#[utoipa::path( - responses( - ( - status = OK, - description = "Recipe found in database and fetched", - body = Recipe, - ), - ( - status = NOT_FOUND, - description = "Recipe not found in database" - ), - ( - status = INTERNAL_SERVER_ERROR, - description = "Server encountered error", - body = String - ) - ), - params( - ( - "id" = RecipeId, - description = "Recipe id" - ), - ) -)] -#[get("/recipe/by-id/{id}")] -pub(crate) async fn recipe_by_id( - app: web::Data, - id: web::Path, -) -> Result { - let id = id.into_inner(); - - match Recipe::from_id(&app, id.into()).await? { - Some(recipe) => Ok(HttpResponse::Ok().json(recipe)), - None => Ok(HttpResponse::NotFound().finish()), - } -} - -/// Get all added recipes -#[utoipa::path( - responses( - ( - status = OK, - description = "All recipes found in database and fetched", - body = Recipe, - ), - ( - status = INTERNAL_SERVER_ERROR, - description = "Server encountered error", - body = String - ) - ), -)] -#[get("/recipe/all")] -pub(crate) async fn recipes(app: web::Data) -> Result { - let all = Recipe::get_all(&app).await?; - - Ok(HttpResponse::Ok().json(all)) -} -- cgit 1.4.1