Add REST endpoint for slot
This commit is contained in:
parent
82e89baeeb
commit
8f378472ea
28 changed files with 1925 additions and 28 deletions
|
|
@ -2,8 +2,14 @@ use async_trait::async_trait;
|
|||
use mockall::automock;
|
||||
use std::{future::Future, sync::Arc};
|
||||
use thiserror::Error;
|
||||
use time::Date;
|
||||
use time::Time;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub mod clock;
|
||||
pub mod permission;
|
||||
pub mod slot;
|
||||
pub mod uuid_service;
|
||||
|
||||
pub use permission::MockPermissionService;
|
||||
pub use permission::PermissionService;
|
||||
|
|
@ -11,6 +17,11 @@ pub use permission::Privilege;
|
|||
pub use permission::Role;
|
||||
pub use permission::User;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum ValidationFailureItem {
|
||||
ModificationNotAllowed(Arc<str>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ServiceError {
|
||||
#[error("Database query error: {0}")]
|
||||
|
|
@ -18,6 +29,33 @@ pub enum ServiceError {
|
|||
|
||||
#[error("Forbidden")]
|
||||
Forbidden,
|
||||
|
||||
#[error("Entity {0} aready exists")]
|
||||
EntityAlreadyExists(Uuid),
|
||||
|
||||
#[error("Entity {0} not found")]
|
||||
EntityNotFound(Uuid),
|
||||
|
||||
#[error("Entity {0} conflicts, expected version {1} but got {2}")]
|
||||
EntityConflicts(Uuid, Uuid, Uuid),
|
||||
|
||||
#[error("Validation error: {0:?}")]
|
||||
ValidationError(Arc<[ValidationFailureItem]>),
|
||||
|
||||
#[error("ID cannot be set on create")]
|
||||
IdSetOnCreate,
|
||||
|
||||
#[error("Version cannot be set on create")]
|
||||
VersionSetOnCreate,
|
||||
|
||||
#[error("Overlapping time range")]
|
||||
OverlappingTimeRange,
|
||||
|
||||
#[error("Time order wrong. {0} must is not smaller or equal to {1}")]
|
||||
TimeOrderWrong(Time, Time),
|
||||
|
||||
#[error("Date order wrong. {0} must is not smaller or equal to {1}")]
|
||||
DateOrderWrong(Date, Date),
|
||||
}
|
||||
|
||||
#[automock]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue