Maintenance Entry
Completion of a maintenance item by a shop user.
Models
- class pytm4srv.models.MaintenanceMeasurementEntry
A single measured value for a
MaintenanceMeasurementItem
.- duration: Mapped[timedelta | None]
How long it took to complete this entry (in minutes).
- entry_type: Mapped[str]
The type of this entry. This corresponds to a model type and determines which fields are available.
See the entry API endpoint documentation for the possible values.
- id: Mapped[IntPK]
Unique ID across all maintenance entries.
- item_id: Mapped[int]
The ID of the maintenance item this entry is for.
- notes: Mapped[str]
User-specified notes about this entry.
- timestamp: Mapped[datetime]
When this entry was created.
- unit: Mapped[str | None]
The unit the value was measured in.
Can be
NULL
, in which case the maintenance measurement’s unit may be assumed, but that could have changed after this measurement was taken. Therefore, it is best for the user to always enter this with the measurement, though the client can suggest the measurement item’s default unit and require the user to change it.
- user_id: Mapped[int]
The ID of the user who entered this information.
- value: Mapped[float | None]
The measured value.
Can be
NULL
, but thenotes
should explain why.
- class pytm4srv.models.MaintenanceTaskEntry
A single completion of a
MaintenanceTaskEntry
.- duration: Mapped[timedelta | None]
How long it took to complete this entry (in minutes).
- entry_type: Mapped[str]
The type of this entry. This corresponds to a model type and determines which fields are available.
See the entry API endpoint documentation for the possible values.
- id: Mapped[IntPK]
Unique ID across all maintenance entries.
- item_id: Mapped[int]
The ID of the maintenance item this entry is for.
- notes: Mapped[str]
User-specified notes about this entry.
- success: Mapped[bool]
Whether the task was completed successfully.
If
FALSE
, thenotes
should explain why.
- timestamp: Mapped[datetime]
When this entry was created.
- user_id: Mapped[int]
The ID of the user who entered this information.
Endpoints
- PUT /api/maintenance/entries/
Create a new maintenance entry.
- Reqjson:
a
MaintenanceEntry
object- Request JSON Object:
entry_type (string) – one of
measurement
,task
(required)item_id (int) – ID of the item this entry is for (required)
- Status Codes:
400 Bad Request – if a required field is missing or invalid
201 Created – on success
- Returns:
the newly created
MaintenanceEntry
object
- PATCH /api/maintenance/entries/(int: entry_id)
Edit an existing maintenance entry.
- Reqjson:
a (partial)
MaintenanceEntry
object. It is not possible to change an entry’s type, so theentry_type
field will be ignored.- Status Codes:
404 Not Found – if the entry ID is not valid
- Returns:
the modified
MaintenanceEntry
object
- DELETE /api/maintenance/entries/(int: entry_id)
Delete an existing maintenance entry.
- Status Codes:
404 Not Found – if the entry ID is not valid
204 No Content – on success