Implement booking service without validity checks

This commit is contained in:
Simon Goller 2024-05-07 08:31:50 +02:00
parent 8efc3843ad
commit 4bca60a23c
8 changed files with 536 additions and 0 deletions

28
dao/src/booking.rs Normal file
View file

@ -0,0 +1,28 @@
use std::sync::Arc;
use async_trait::async_trait;
use mockall::automock;
use time::PrimitiveDateTime;
use uuid::Uuid;
use crate::DaoError;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BookingEntity {
pub id: Uuid,
pub sales_person_id: Uuid,
pub slot_id: Uuid,
pub calendar_week: i32,
pub year: u32,
pub deleted: Option<PrimitiveDateTime>,
pub version: Uuid,
}
#[automock]
#[async_trait]
pub trait BookingDao {
async fn all(&self) -> Result<Arc<[BookingEntity]>, DaoError>;
async fn find_by_id(&self, id: Uuid) -> Result<Option<BookingEntity>, DaoError>;
async fn create(&self, entity: &BookingEntity, process: &str) -> Result<(), DaoError>;
async fn update(&self, entity: &BookingEntity, process: &str) -> Result<(), DaoError>;
}

View file

@ -4,6 +4,7 @@ use async_trait::async_trait;
use mockall::automock;
use thiserror::Error;
pub mod booking;
pub mod permission;
pub mod sales_person;
pub mod slot;