31 lines
799 B
Rust
31 lines
799 B
Rust
use anyhow::Error;
|
|
use chrono::Utc;
|
|
use ulid::Ulid;
|
|
|
|
use super::Service;
|
|
use crate::domain::liegenschaft::{
|
|
entity,
|
|
model::{self, LiegenschaftErstelleInput},
|
|
};
|
|
|
|
impl Service {
|
|
pub async fn liegenschaft_erstellen(
|
|
&self,
|
|
input: LiegenschaftErstelleInput,
|
|
) -> Result<model::Liegenschaft, Error> {
|
|
let liegenschaft_input = entity::Liegenschaft {
|
|
id_liegenschaft: Ulid::new().into(),
|
|
id: Ulid::new().to_string(),
|
|
liegenschaftname: input.liegenschaftname,
|
|
erstellt_am: Some(Utc::now()),
|
|
geaendert_am: Some(Utc::now()),
|
|
};
|
|
|
|
let liegenschaft = self
|
|
.repo
|
|
.liegenschaft_erstellen(&self.db, &liegenschaft_input)
|
|
.await?;
|
|
Ok(liegenschaft)
|
|
}
|
|
}
|