예제 #1
0
 def previous_slots_wrapper(self, username: str, date: str, presenter: PresenterInterface):
     try:
         return self.previous_slots_response(date, username, presenter)
     except UserIsAdmin:
         return presenter.raise_exception_for_user_is_admin()
     except DateInvalid:
         return presenter.raise_exception_for_invalid_date()
 def get_allocated_slots_wrapper(self, username: str,
                                 washing_machine_id: str, day: str,
                                 presenter: PresenterInterface):
     try:
         return self.get_allocated_slots_response(username,
                                                  washing_machine_id, day,
                                                  presenter)
     except UserIsNotAdmin:
         return presenter.raise_exception_for_user_is_not_admin()
     except InvalidWashingMachineId:
         return presenter.raise_exception_for_invalid_washing_machine_id()
 def add_washing_machine_wrapper(self, username: str,
                                 washing_machine_id: str,
                                 presenter: PresenterInterface):
     try:
         return self.add_washing_machine_response(username,
                                                  washing_machine_id,
                                                  presenter)
     except UserIsNotAdmin:
         return presenter.raise_exception_for_user_is_not_admin()
     except InvalidWashingMachineNumber:
         return presenter.raise_exception_for_invalid_washing_machine_id()
예제 #4
0
 def update_slots_wrapper(self, username: str, washing_machine_id: str,
                          day: str, slots_dtos: List[SlotDto],
                          presenter: PresenterInterface):
     try:
         return self.update_slots_response(username, slots_dtos,
                                           washing_machine_id, day,
                                           presenter)
     except UserIsNotAdmin:
         return presenter.raise_exception_for_user_is_not_admin()
     except InvalidWashingMachineId:
         return presenter.raise_exception_for_invalid_washing_machine_id()
     except InvalidInputsGiven:
         return presenter.raise_exception_for_invalid_inputs()
예제 #5
0
 def add_washing_machine_wise_day_wise_slots_interactor_wrapper(
         self, day: Days, washing_machine_id: str, start_time, end_time,
         presenter: PresenterInterface):
     try:
         self.add_washing_machine_wise_day_wise_slots_interactor(
             day=day,
             washing_machine_id=washing_machine_id,
             start_time=start_time,
             end_time=end_time)
     except InvalidWashingMachineId:
         presenter.raise_exception_for_invalid_washing_machine_id()
     except InvalidDay:
         presenter.raise_exception_for_invalid_day()
     except StartTimeGreaterThanEndTimeError:
         presenter.raise_exception_start_time_is_not_less_than_end_time()
예제 #6
0
 def get_washing_machine_wise_day_wise_slots_wrapper(self, day:Days,
                                                  washing_machine_id:str,
                                                  limit:int,
                                                  offset:int,
                                                  presenter:PresenterInterface):
     try:
         self.get_washing_machine_wise_day_wise_slots_response(day=day,
                                 washing_machine_id=washing_machine_id,\
                                 limit=limit,
                                 offset=offset,
                                 presenter=presenter)
                                 
     except InvalidWashingMachineId:    
         presenter.raise_exception_for_invalid_washing_machine_id()
         
     except InvalidDay:    
         presenter.raise_exception_for_invalid_day()
         
     except DayDoesntBelongToWashingMachine:
         presenter.raise_exception_for_day_doesnt_belong_to_washing_machine()
 def upcoming_slots_wrapper(self, username: str, date: str,
                            presenter: PresenterInterface):
     try:
         return self.upcoming_slots_response(date, username, presenter)
     except UserIsAdmin:
         return presenter.raise_exception_for_user_is_admin()
예제 #8
0
 def washing_machine_details_wrapper(self,username: str, washing_machine_status: str, presenter: PresenterInterface):
     try:
         return self.washing_machine_details_response(username, washing_machine_status, presenter)
     except UserIsNotAdmin:
         return presenter.raise_exception_for_user_is_not_admin()
 def book_slot_wrapper(self, BookSlotDto: BookSlotDto,
                       presenter: PresenterInterface):
     try:
         return self.book_slot_response(BookSlotDto, presenter)
     except UserCanNotBookASlot:
         return presenter.raise_exception_for_user_cannot_book_a_slot()