Implement booking service without validity checks
This commit is contained in:
parent
8efc3843ad
commit
4bca60a23c
8 changed files with 536 additions and 0 deletions
28
dao/src/booking.rs
Normal file
28
dao/src/booking.rs
Normal 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>;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue