Пример #1
0
 def get(self, person_id, date):
     """
     Get day off object for given person and date.
     ---
     tags:
     - Persons
     parameters:
       - in: path
         name: person_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
       - in: path
         name: date
         required: True
         schema:
             type: timestamp
             example: 2022-07-12
     responses:
         200:
             description: Day off object for given person and date
         404:
             description: Wrong date format
     """
     current_user = persons_service.get_current_user()
     if current_user["id"] != person_id:
         try:
             permissions.check_at_least_supervisor_permissions()
         except permissions.PermissionDenied:
             return []
     try:
         return time_spents_service.get_day_off(person_id, date)
     except WrongDateFormatException:
         abort(404)
Пример #2
0
 def get(self, person_id, date):
     current_user = persons_service.get_current_user()
     if current_user["id"] != person_id:
         permissions.check_admin_permissions()
     try:
         return time_spents_service.get_day_off(person_id, date)
     except WrongDateFormatException:
         abort(404)
Пример #3
0
 def get(self, date):
     """
     Get day off object for current user and given date.
     ---
     tags:
     - User
     parameters:
       - in: path
         name: date
         required: True
         schema:
             type: string
             example: 2022-07-12
     responses:
         200:
             description:  Day off object for current user and given date
         404:
             description: Wrong date format
     """
     try:
         current_user = persons_service.get_current_user()
         return time_spents_service.get_day_off(current_user["id"], date)
     except WrongDateFormatException:
         abort(404)
Пример #4
0
 def get(self, date):
     try:
         current_user = persons_service.get_current_user()
         return time_spents_service.get_day_off(current_user["id"], date)
     except WrongDateFormatException:
         abort(404)