Skip to content

Commit

Permalink
refactor: fmt more files
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDecMeetsMore committed Jul 25, 2024
1 parent 2d3b5b5 commit 3eaf737
Show file tree
Hide file tree
Showing 49 changed files with 374 additions and 104 deletions.
7 changes: 5 additions & 2 deletions scheduler/clients/rust/src/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ use std::sync::Arc;
use nettu_scheduler_api_structs::*;
use nettu_scheduler_domain::{
providers::{google::GoogleCalendarAccessRole, outlook::OutlookCalendarAccessRole},
IntegrationProvider, Metadata, ID,
IntegrationProvider,
Metadata,
ID,
};
use reqwest::StatusCode;

use crate::{
base::{APIResponse, BaseClient},
shared::MetadataFindInput,
Tz, Weekday,
Tz,
Weekday,
};

#[derive(Clone)]
Expand Down
7 changes: 6 additions & 1 deletion scheduler/clients/rust/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ use reqwest::StatusCode;
use serde::Serialize;

use crate::{
shared::MetadataFindInput, APIResponse, BaseClient, CalendarEventReminder, RRuleOptions, ID,
shared::MetadataFindInput,
APIResponse,
BaseClient,
CalendarEventReminder,
RRuleOptions,
ID,
};

#[derive(Clone)]
Expand Down
65 changes: 50 additions & 15 deletions scheduler/clients/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,77 @@ pub(crate) use base::BaseClient;
pub use base::{APIError, APIErrorVariant, APIResponse};
use calendar::CalendarClient;
pub use calendar::{
CreateCalendarInput, GetCalendarEventsInput, GetGoogleCalendars, GetOutlookCalendars,
StopCalendarSyncInput, SyncCalendarInput, UpdateCalendarInput,
CreateCalendarInput,
GetCalendarEventsInput,
GetGoogleCalendars,
GetOutlookCalendars,
StopCalendarSyncInput,
SyncCalendarInput,
UpdateCalendarInput,
};
use event::CalendarEventClient;
pub use event::{CreateEventInput, GetEventsInstancesInput, UpdateEventInput};
// Domain
pub use nettu_scheduler_api_structs::dtos::{
AccountDTO as Account, AccountSettingsDTO as AccountSettings,
AccountWebhookSettingsDTO as AccountWebhookSettings, CalendarDTO as Calendar,
CalendarEventDTO as CalendarEvent, CalendarSettingsDTO as CalendarSettings,
EventWithInstancesDTO as EventWithIInstances, ScheduleDTO as Schedule,
ServiceResourceDTO as ServiceResource, ServiceWithUsersDTO as Service, UserDTO as User,
AccountDTO as Account,
AccountSettingsDTO as AccountSettings,
AccountWebhookSettingsDTO as AccountWebhookSettings,
CalendarDTO as Calendar,
CalendarEventDTO as CalendarEvent,
CalendarSettingsDTO as CalendarSettings,
EventWithInstancesDTO as EventWithIInstances,
ScheduleDTO as Schedule,
ServiceResourceDTO as ServiceResource,
ServiceWithUsersDTO as Service,
UserDTO as User,
};
pub use nettu_scheduler_api_structs::{
dtos::*, send_event_reminders::AccountRemindersDTO as AccountReminders,
dtos::*,
send_event_reminders::AccountRemindersDTO as AccountReminders,
};
pub use nettu_scheduler_domain::{
providers::{google::*, outlook::*},
scheduling::RoundRobinAlgorithm,
BusyCalendar, CalendarEventReminder, IntegrationProvider, Metadata, Month, RRuleFrequency,
RRuleOptions, ScheduleRule, ServiceMultiPersonOptions, SyncedCalendar, TimePlan, Tz, WeekDay,
Weekday, ID,
BusyCalendar,
CalendarEventReminder,
IntegrationProvider,
Metadata,
Month,
RRuleFrequency,
RRuleOptions,
ScheduleRule,
ServiceMultiPersonOptions,
SyncedCalendar,
TimePlan,
Tz,
WeekDay,
Weekday,
ID,
};
use schedule::ScheduleClient;
pub use schedule::{CreateScheduleInput, UpdateScheduleInput};
use service::ServiceClient;
pub use service::{
AddBusyCalendar, AddServiceUserInput, CreateBookingIntendInput, CreateServiceInput,
GetServiceBookingSlotsInput, RemoveBookingIntendInput, RemoveBusyCalendar,
RemoveServiceUserInput, UpdateServiceInput, UpdateServiceUserInput,
AddBusyCalendar,
AddServiceUserInput,
CreateBookingIntendInput,
CreateServiceInput,
GetServiceBookingSlotsInput,
RemoveBookingIntendInput,
RemoveBusyCalendar,
RemoveServiceUserInput,
UpdateServiceInput,
UpdateServiceUserInput,
};
pub use shared::{KVMetadata, MetadataFindInput};
use status::StatusClient;
use user::UserClient;
pub use user::{
CreateUserInput, GetUserFreeBusyInput, OAuthInput, RemoveUserIntegrationInput, UpdateUserInput,
CreateUserInput,
GetUserFreeBusyInput,
OAuthInput,
RemoveUserIntegrationInput,
UpdateUserInput,
};

/// Nettu Scheduler Server SDK
Expand Down
8 changes: 6 additions & 2 deletions scheduler/crates/api/src/calendar/add_sync_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::add_sync_calendar::{APIResponse, PathParams, RequestBody};
use nettu_scheduler_domain::{
providers::{google::GoogleCalendarAccessRole, outlook::OutlookCalendarAccessRole},
IntegrationProvider, SyncedCalendar, User, ID,
IntegrationProvider,
SyncedCalendar,
User,
ID,
};
use nettu_scheduler_infra::{
google_calendar::GoogleCalendarProvider, outlook_calendar::OutlookCalendarProvider,
google_calendar::GoogleCalendarProvider,
outlook_calendar::OutlookCalendarProvider,
NettuContext,
};

Expand Down
6 changes: 4 additions & 2 deletions scheduler/crates/api/src/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ use get_calendar::{get_calendar_admin_controller, get_calendar_controller};
use get_calendar_events::{get_calendar_events_admin_controller, get_calendar_events_controller};
use get_calendars_by_meta::get_calendars_by_meta_controller;
use get_google_calendars::{
get_google_calendars_admin_controller, get_google_calendars_controller,
get_google_calendars_admin_controller,
get_google_calendars_controller,
};
use get_outlook_calendars::{
get_outlook_calendars_admin_controller, get_outlook_calendars_controller,
get_outlook_calendars_admin_controller,
get_outlook_calendars_controller,
};
use remove_sync_calendar::remove_sync_calendar_admin_controller;
use update_calendar::{update_calendar_admin_controller, update_calendar_controller};
Expand Down
7 changes: 5 additions & 2 deletions scheduler/crates/api/src/calendar/update_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ use crate::{
error::NettuError,
shared::{
auth::{
account_can_modify_calendar, account_can_modify_user, protect_account_route,
protect_route, Permission,
account_can_modify_calendar,
account_can_modify_user,
protect_account_route,
protect_route,
Permission,
},
usecase::{execute, execute_with_policy, PermissionBoundary, UseCase},
},
Expand Down
7 changes: 6 additions & 1 deletion scheduler/crates/api/src/event/create_event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::create_event::*;
use nettu_scheduler_domain::{
CalendarEvent, CalendarEventReminder, Metadata, RRuleOptions, User, ID,
CalendarEvent,
CalendarEventReminder,
Metadata,
RRuleOptions,
User,
ID,
};
use nettu_scheduler_infra::NettuContext;

Expand Down
10 changes: 7 additions & 3 deletions scheduler/crates/api/src/event/delete_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::delete_event::*;
use nettu_scheduler_domain::{CalendarEvent, IntegrationProvider, User, ID};
use nettu_scheduler_infra::{
google_calendar::GoogleCalendarProvider, outlook_calendar::OutlookCalendarProvider,
google_calendar::GoogleCalendarProvider,
outlook_calendar::OutlookCalendarProvider,
NettuContext,
};
use tracing::error;
Expand All @@ -11,8 +12,11 @@ use crate::{
error::NettuError,
shared::{
auth::{
account_can_modify_event, account_can_modify_user, protect_account_route,
protect_route, Permission,
account_can_modify_event,
account_can_modify_user,
protect_account_route,
protect_route,
Permission,
},
usecase::{execute, execute_with_policy, PermissionBoundary, UseCase},
},
Expand Down
3 changes: 2 additions & 1 deletion scheduler/crates/api/src/event/subscribers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use nettu_scheduler_domain::{CalendarEvent, IntegrationProvider, SyncedCalendarEvent};
use nettu_scheduler_infra::{
google_calendar::GoogleCalendarProvider, outlook_calendar::OutlookCalendarProvider,
google_calendar::GoogleCalendarProvider,
outlook_calendar::OutlookCalendarProvider,
};
use tracing::{error, info};

Expand Down
14 changes: 11 additions & 3 deletions scheduler/crates/api/src/event/update_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ use actix_web::{web, HttpRequest, HttpResponse};
use event::subscribers::SyncRemindersOnEventUpdated;
use nettu_scheduler_api_structs::update_event::*;
use nettu_scheduler_domain::{
CalendarEvent, CalendarEventReminder, Metadata, RRuleOptions, User, ID,
CalendarEvent,
CalendarEventReminder,
Metadata,
RRuleOptions,
User,
ID,
};
use nettu_scheduler_infra::NettuContext;

Expand All @@ -11,8 +16,11 @@ use crate::{
event::{self, subscribers::UpdateSyncedEventsOnEventUpdated},
shared::{
auth::{
account_can_modify_event, account_can_modify_user, protect_account_route,
protect_route, Permission,
account_can_modify_event,
account_can_modify_user,
protect_account_route,
protect_route,
Permission,
},
usecase::{execute, execute_with_policy, PermissionBoundary, Subscriber, UseCase},
},
Expand Down
7 changes: 6 additions & 1 deletion scheduler/crates/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ use actix_cors::Cors;
use actix_web::{dev::Server, middleware, web, web::Data, App, HttpServer};
use job_schedulers::{start_reminder_generation_job_scheduler, start_send_reminders_job};
use nettu_scheduler_domain::{
Account, AccountIntegration, AccountWebhookSettings, IntegrationProvider, PEMKey, ID,
Account,
AccountIntegration,
AccountWebhookSettings,
IntegrationProvider,
PEMKey,
ID,
};
use nettu_scheduler_infra::NettuContext;
use tracing::warn;
Expand Down
12 changes: 9 additions & 3 deletions scheduler/crates/api/src/service/add_busy_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::add_busy_calendar::*;
use nettu_scheduler_domain::{
providers::{google::GoogleCalendarAccessRole, outlook::OutlookCalendarAccessRole},
Account, BusyCalendar, IntegrationProvider, ID,
Account,
BusyCalendar,
IntegrationProvider,
ID,
};
use nettu_scheduler_infra::{
google_calendar::GoogleCalendarProvider, outlook_calendar::OutlookCalendarProvider,
BusyCalendarIdentifier, ExternalBusyCalendarIdentifier, NettuContext,
google_calendar::GoogleCalendarProvider,
outlook_calendar::OutlookCalendarProvider,
BusyCalendarIdentifier,
ExternalBusyCalendarIdentifier,
NettuContext,
};

use crate::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ use nettu_scheduler_api_structs::create_service_event_intend::*;
use nettu_scheduler_domain::{
format_date,
scheduling::{
RoundRobinAlgorithm, RoundRobinAvailabilityAssignment,
RoundRobinAlgorithm,
RoundRobinAvailabilityAssignment,
RoundRobinEqualDistributionAssignment,
},
ServiceMultiPersonOptions, User, ID,
ServiceMultiPersonOptions,
User,
ID,
};
use nettu_scheduler_infra::NettuContext;

Expand Down
37 changes: 30 additions & 7 deletions scheduler/crates/api/src/service/get_service_bookingslots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,33 @@ use futures::future::join_all;
use nettu_scheduler_api_structs::get_service_bookingslots::*;
use nettu_scheduler_domain::{
booking_slots::{
get_service_bookingslots, validate_bookingslots_query, validate_slots_interval,
BookingQueryError, BookingSlotsOptions, BookingSlotsQuery, ServiceBookingSlots,
get_service_bookingslots,
validate_bookingslots_query,
validate_slots_interval,
BookingQueryError,
BookingSlotsOptions,
BookingSlotsQuery,
ServiceBookingSlots,
UserFreeEvents,
},
get_free_busy, BusyCalendar, Calendar, CompatibleInstances, EventInstance,
ServiceMultiPersonOptions, ServiceResource, ServiceWithUsers, TimePlan, TimeSpan, Tz, ID,
get_free_busy,
BusyCalendar,
Calendar,
CompatibleInstances,
EventInstance,
ServiceMultiPersonOptions,
ServiceResource,
ServiceWithUsers,
TimePlan,
TimeSpan,
Tz,
ID,
};
use nettu_scheduler_infra::{
google_calendar::GoogleCalendarProvider, outlook_calendar::OutlookCalendarProvider,
FreeBusyProviderQuery, NettuContext,
google_calendar::GoogleCalendarProvider,
outlook_calendar::OutlookCalendarProvider,
FreeBusyProviderQuery,
NettuContext,
};
use tracing::error;

Expand Down Expand Up @@ -482,7 +499,13 @@ mod test {

use chrono::{prelude::*, Utc};
use nettu_scheduler_domain::{
Account, Calendar, CalendarEvent, RRuleOptions, Service, ServiceResource, User,
Account,
Calendar,
CalendarEvent,
RRuleOptions,
Service,
ServiceResource,
User,
};
use nettu_scheduler_infra::{setup_context, ISys};

Expand Down
4 changes: 3 additions & 1 deletion scheduler/crates/api/src/service/update_service_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use nettu_scheduler_domain::{Account, ServiceResource, TimePlan, ID};
use nettu_scheduler_infra::NettuContext;

use super::add_user_to_service::{
update_resource_values, ServiceResourceUpdate, UpdateServiceResourceError,
update_resource_values,
ServiceResourceUpdate,
UpdateServiceResourceError,
};
use crate::{
error::NettuError,
Expand Down
9 changes: 7 additions & 2 deletions scheduler/crates/api/src/shared/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ mod route_guards;

pub use policy::{Permission, Policy};
pub use route_guards::{
account_can_modify_calendar, account_can_modify_event, account_can_modify_schedule,
account_can_modify_user, protect_account_route, protect_public_account_route, protect_route,
account_can_modify_calendar,
account_can_modify_event,
account_can_modify_schedule,
account_can_modify_user,
protect_account_route,
protect_public_account_route,
protect_route,
};
3 changes: 2 additions & 1 deletion scheduler/crates/api_structs/src/calendar/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ pub mod get_calendars_by_meta {

pub mod get_google_calendars {
use nettu_scheduler_domain::providers::google::{
GoogleCalendarAccessRole, GoogleCalendarListEntry,
GoogleCalendarAccessRole,
GoogleCalendarListEntry,
};

use super::*;
Expand Down
6 changes: 5 additions & 1 deletion scheduler/crates/api_structs/src/event/api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use nettu_scheduler_domain::{
CalendarEvent, CalendarEventReminder, EventInstance, RRuleOptions, ID,
CalendarEvent,
CalendarEventReminder,
EventInstance,
RRuleOptions,
ID,
};
use serde::{Deserialize, Serialize};

Expand Down
Loading

0 comments on commit 3eaf737

Please sign in to comment.