24 lines
594 B
Rust
24 lines
594 B
Rust
|
|
use anyhow::Error;
|
||
|
|
use chrono::Utc;
|
||
|
|
use ulid::Ulid;
|
||
|
|
|
||
|
|
use super::Service;
|
||
|
|
use crate::domain::rolle::{
|
||
|
|
entity,
|
||
|
|
model::{self, RolleErstelleInput},
|
||
|
|
};
|
||
|
|
|
||
|
|
impl Service {
|
||
|
|
pub async fn rolle_erstellen(&self, input: RolleErstelleInput) -> Result<model::Rolle, Error> {
|
||
|
|
let rolle_input = entity::Rolle {
|
||
|
|
id: Ulid::new().into(),
|
||
|
|
rollenname: input.rollenname,
|
||
|
|
erstellt_am: Some(Utc::now()),
|
||
|
|
geaendert_am: Some(Utc::now()),
|
||
|
|
};
|
||
|
|
|
||
|
|
let rolle = self.repo.rolle_erstellen(&self.db, &rolle_input).await?;
|
||
|
|
Ok(rolle)
|
||
|
|
}
|
||
|
|
}
|