Shift
Model
- class pytm4srv.models.Shift
Represents a user-defined shift.
- color: Mapped[str]
User-specified color (#RRGGBB) of the shift when displayed.
- days: Mapped[int]
Days on which this shift occurs.
This is a bitfield (of length 16), so multiple days can be selected by combining their values with bitwise OR.
Value
Binary
Day
0
0000 0000 0000 0000
(None)
1
0000 0000 0000 0001
Monday
2
0000 0000 0000 0010
Tuesday
4
0000 0000 0000 0100
Wednesday
8
0000 0000 0000 1000
Thursday
16
0000 0000 0001 0000
Friday
32
0000 0000 0010 0000
Saturday
64
0000 0000 0100 0000
Sunday
For example, for a shift on Monday through Thursday, the value of this field would be 15 (
0000 1111
), and for a shift every day, this field would be 127 (0111 1111
).
- end_time: Mapped[time]
Time this shift ends (always assumed to be in the configured local time zone).
- id: MappedColumn object at 0x7d28dc361c60>]]
Unique, numeric ID for the shift.
- ignore_preflight: Mapped[bool]
Whether to ignore preflight failures and always report machines as ready during this shift.
- lights_out: Mapped[bool]
Whether this shift is automated.
- machines
The list of machines that are assigned to this shift.
Clients can link or unlink machines from this shift by setting a new list of machine IDs.
- name: Mapped[str]
User-specified name of the shift.
- start_time: Mapped[time]
Time this shift starts (always assumed to be in the configured local time zone).
Endpoints
- GET /api/shifts/
Get all shifts.
- Returns:
an object mapping shift ID to Shift object
- GET /api/shifts/(int: shift_id)
Get a single shift.
- Parameters:
shift_id – the ID of the shift to get
- Status Codes:
404 Not Found – if the shift does not exist
- Returns:
a Shift object
- PUT /api/shifts/
Create a new shift.
- Reqjson:
a (partial) Shift, with at least
name
set- Status Codes:
201 Created – on success
400 Bad Request – if the new Shift is invalid
- Returns:
the new Shift object
- PATCH /api/shifts/(int: shift_id)
Edit an existing shift.
- Parameters:
shift_id – the ID of the shift to edit
- Status Codes:
404 Not Found – if the shift does not exist
- Reqjson:
a (partial) Shift object
- Returns:
the modified Shift object
- DELETE /api/shifts/(int: shift_id)
Delete an existing shift.
- Parameters:
shift_id – the ID of the shift to delete
- Status Codes:
404 Not Found – if the shift does not exist
204 No Content – on success