typ refactor

This commit is contained in:
2026-06-03 22:08:44 +02:00
parent 16f8a929d2
commit b3b7b75ea8
22 changed files with 92 additions and 64 deletions

View File

@@ -8,16 +8,17 @@ impl Repository {
pub async fn typ_erstellen<'c, C: Queryer<'c>>(
&self,
db: C,
typ: &entity::Typ,
typ: &entity::TypErstellen,
) -> Result<model::Typ, Error> {
const QUERY: &str = r#"
INSERT INTO typen (id, erstellt_am, geaendert_am, typname) VALUES (
$1, $2, $3, $4
INSERT INTO typen (typ_id, id, erstellt_am, geaendert_am, typname) VALUES (
$1, $2, $3, $4, $5
) RETURNING id, erstellt_am, geaendert_am, typname;
"#;
let typ = sqlx::query_as::<_, model::Typ>(QUERY)
.bind(typ.id)
.bind(typ.typ_id)
.bind(typ.id.to_string())
.bind(typ.erstellt_am)
.bind(typ.geaendert_am)
.bind(&typ.typname)