User Holiday¶
-
class
moco_wrapper.models.
UserHoliday
(moco)¶ Class for handling users holiday/vacation credits.
Every user that can take vacation has a number of vacation credits. These can be manged with this model.
Example usage:
from moco_wrapper import Moco user_id = 22 #this user gets extra vacation in 2020 m.UserHoliday.create( 2020, "extra vacation day", 8 #hours )
Note
Please not that the base unit for holiday credits is hours. So if your typical workday contains 8 hours, 8 holiday credits means one day off.
-
create
(year: int, title: str, user_id: int, hours: float = 0)¶ Create an users entitlement for holidays/vacation
Parameters: - year (int) – Year of the holiday (e.g. 2019)
- title (str) – Title
- user_id (int) – Id of the user this holiday belongs to
- hours (float) – Hours (e.g. 160) (default 0)
Returns: The created holiday object
-
delete
(holyday_id: int)¶ Delete a holiday entry
Parameters: holyday_id (int) – Id of the holiday entry to delete Returns: Empty response on success
-
get
(holyday_id: int)¶ Retrieve single holiday entry
Parameters: holyday_id (int) – Id of the holiday Returns: The holiday object
-
getlist
(year: int = None, user_id: int = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of holidays entries
Parameters: - year (int) – Show only this year (e.g. 2019)
- user_id (int) – Show only holidays from this user (e.g. 5)
- sort_by (str) – field to sort results by
- sort_order (str) – asc or desc
- page (int) – Page number (default 1)
Returns: List of holiday entries
-
update
(holyday_id: int, year: int = None, title: str = None, user_id: int = None, hours: float = None)¶ Update a holiday entry
Parameters: - holyday_id (int) – Id of the holiday entry
- year (int) – Year of the holiday entry (e.g. 2019)
- title (str) – Title
- hours (float) – Hours (e.g. 160)
- user_id (int) – User this holiday entry belongs to
Returns: The updated holiday object
-