Add service for sales_persond

This commit is contained in:
Simon Goller 2024-05-06 13:33:54 +02:00
parent 20828fb4a1
commit ad88a1c983
9 changed files with 792 additions and 2 deletions

View file

@ -5,6 +5,7 @@ use mockall::automock;
use thiserror::Error;
pub mod permission;
pub mod sales_person;
pub mod slot;
pub use permission::MockPermissionDao;

25
dao/src/sales_person.rs Normal file
View file

@ -0,0 +1,25 @@
use std::sync::Arc;
use async_trait::async_trait;
use mockall::automock;
use uuid::Uuid;
use crate::DaoError;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SalesPersonEntity {
pub id: Uuid,
pub name: Arc<str>,
pub deleted: Option<time::PrimitiveDateTime>,
pub inactive: bool,
pub version: Uuid,
}
#[automock]
#[async_trait]
pub trait SalesPersonDao {
async fn all(&self) -> Result<Arc<[SalesPersonEntity]>, DaoError>;
async fn find_by_id(&self, id: Uuid) -> Result<Option<SalesPersonEntity>, DaoError>;
async fn create(&self, entity: &SalesPersonEntity, process: &str) -> Result<(), DaoError>;
async fn update(&self, entity: &SalesPersonEntity, process: &str) -> Result<(), DaoError>;
}