Add endpoint to get sales_person for current user

This commit is contained in:
Simon Goller 2024-06-12 12:04:41 +02:00
parent 42ebce15e8
commit bd887cfd7b
12 changed files with 108 additions and 5 deletions

View file

@ -66,7 +66,7 @@ pub trait BookingService {
) -> Result<Booking, ServiceError>;
async fn get_for_week(
&self,
calendar_week: i32,
calendar_week: u8,
year: u32,
context: Authentication<Self::Context>,
) -> Result<Arc<[Booking]>, ServiceError>;

View file

@ -65,6 +65,10 @@ impl<Context: Clone + Debug + PartialEq + Eq + Send + Sync + 'static> From<Conte
pub trait PermissionService {
type Context: Clone + PartialEq + Eq + Debug + Send + Sync + 'static;
async fn current_user_id(
&self,
context: Authentication<Self::Context>,
) -> Result<Option<Arc<str>>, ServiceError>;
async fn check_permission(
&self,
privilege: &str,

View file

@ -84,4 +84,13 @@ pub trait SalesPersonService {
user_id: Option<Arc<str>>,
context: Authentication<Self::Context>,
) -> Result<(), ServiceError>;
async fn get_sales_person_for_user(
&self,
user_id: Arc<str>,
context: Authentication<Self::Context>,
) -> Result<Option<SalesPerson>, ServiceError>;
async fn get_sales_person_current_user(
&self,
context: Authentication<Self::Context>,
) -> Result<Option<SalesPerson>, ServiceError>;
}