use crate::generators::rust::model::Model;
pub(in crate::generators::rust::actix) fn list(model: &Model) -> String {
format!(
"#[utoipa::path(\n\
\x20 get,\n\
\x20 path = \"/{path}\",\n\
\x20 tag = \"{path}\",\n\
\x20 responses(\n\
\x20 (status = 200, description = \"Every row\", body = [{name}]),\n\
\x20 (status = 500, description = \"Query failed\"),\n\
\x20 ),\n\
)]\n",
path = model.table,
name = model.name
)
}
pub(in crate::generators::rust::actix) fn create(model: &Model) -> String {
format!(
"#[utoipa::path(\n\
\x20 post,\n\
\x20 path = \"/{path}\",\n\
\x20 tag = \"{path}\",\n\
\x20 request_body = {name},\n\
\x20 responses(\n\
\x20 (status = 201, description = \"The row as stored\", body = {name}),\n\
\x20 (status = 500, description = \"Insert failed\"),\n\
\x20 ),\n\
)]\n",
path = model.table,
name = model.name
)
}
pub(in crate::generators::rust::actix) fn create_empty(model: &Model) -> String {
format!(
"#[utoipa::path(\n\
\x20 post,\n\
\x20 path = \"/{path}\",\n\
\x20 tag = \"{path}\",\n\
\x20 responses(\n\
\x20 (status = 201, description = \"The row as stored\", body = {name}),\n\
\x20 (status = 500, description = \"Insert failed\"),\n\
\x20 ),\n\
)]\n",
path = model.table,
name = model.name
)
}