This commit is contained in:
Peter Schiwy
2024-06-20 14:50:36 +02:00
parent 1d60fc5a3f
commit 44931afbe7
23 changed files with 431 additions and 25 deletions

View File

@@ -0,0 +1,26 @@
use anyhow::Error;
use chrono::Utc;
use ulid::Ulid;
use super::Service;
use crate::domain::rolle::entity;
use crate::domain::rolle::model::CreateRolleInput;
impl Service {
pub async fn create_rolle(&self, input: CreateRolleInput) -> Result<entity::Rolle, Error> {
// let username_exists = self.check_username_exists(&self.db, &input.name).await?;
// if username_exists {
// return Err(Error::UsernameAlreadyExists.into());
// }
let rolle_input = entity::Rolle {
id: Ulid::new().into(),
name: input.name,
created_at: Utc::now(),
updated_at: Utc::now(),
};
let rolle = self.repo.create_rolle(&self.db, &rolle_input).await?;
Ok(rolle)
}
}