Issues
Model
- class pytm4srv.models.Issue
A record of an ongoing issue.
- additional_value: Mapped[float]
Manually-entered value for this issue to be added to the value calculated from downtime.
- description: Mapped[str]
Long description of the issue or notes about it.
- end: Mapped[datetime | None]
When the issue ended, or
NULLif the issue is still happening.The
timestampfield is used for the start timestamp.
- equipment_id: Mapped[int | None]
The ID of the equipment this issue is for.
Set to
NULLfor issues that apply to a machine or the shop as a whole instead of a particular piece of equipment.Only one of
machine_idorequipment_idmay be set for a given issue.
- id: MappedColumn object at 0x79861b52dc60>]]
Unique ID across all issues.
- machine_id: Mapped[int | None]
The ID of the machine this issue is for.
Set to
NULLfor issues that apply to the shop as a whole instead of a particular machine.Only one of
machine_idorequipment_idmay be set for a given issue.
- maintenance_item_id: Mapped[int | None]
The ID of the maintenance item that caused this issue by being neglected, if any.
- name: Mapped[str]
Short name of the issue.
- priority: Mapped[int]
The priority of this issue for sorting.
Allowed values are: -
1= low -2= medium (default) -3= high
- resolution: Mapped[str]
The action taken to resolve the issue. Can be entered when ending an issue for future documentation purposes.
- solve_cost: Mapped[float | None]
Currency cost spent solving this issue.
- tags: Mapped[List[str]]
List of tags that have been applied to this issue.
- timestamp: Mapped[datetime]
When this issue was created.
- user_id: Mapped[int]
The ID of the user who entered this issue.
Endpoints
- GET /api/issues/
Get existing issues.
Use
limitandoffsetto get only recent issues (results are queried newest to oldest, but the returned object is unordered).Note
Providing non-zero values for both
machine_idandequipment_idwill return issues assigned to any of the specified machines or pieces of equipment. All other query parameters are treated as and conditions.Note
Shop wide issues will be included when
machine_id=0and/orequipment_id=0.- Query Parameters:
limit (int) – limit the number of entries returned
offset (int) – skip this many entries
machine_id (int) – limit results to issues with this machine. Can be provided multiple times to include issues from multiple machines.
equipment_id (int) – limit results to issues with this equipment. Can be provided multiple times to include issues from multiple pieces of equipment.
bubble_equipment_issues (int) – set to
1to also include issues related to any equipment that belongs to each specifiedmachine_id, “bubbling up” issues from equipment to machinesitem_id (int) – limit results to issues caused by neglecting a specific maintenance item. Use
0to get issues with no item assigned. Can be provided multiple times to include issues for multiple items.priority (int) – limit results to issues with this priority value (1..3). Can be provided multiple times to include issues with any of the provided priorities.
ended (int) – set to
0to get only issues whereendis not set or set in the future, or set to1to get only issues whereendis set and in the past.start (int) – only include issues timestamped on or after this time (UNIX timestamp)
end (int) – only include issues timestamped on or before this time (UNIX timestamp)
q – case-insensitive search for issue names and descriptions. If not empty, only issues containing this string will be included.
- Status Codes:
400 Bad Request – if a query parameter is invalid
- Returns:
a map of
IssueID toIssueobject
- GET /api/issues/(int: issue_id)
Get details for a single issue.
- Parameters:
issue_id – the ID of the issue to get
- Resjson:
the Issue object
- Status Codes:
404 Not Found – if the issue does not exist
- PUT /api/issues/
Create a new issue.
- Reqjson:
a
Issueobject- Status Codes:
400 Bad Request – if a required field is missing or invalid
201 Created – on success
- Returns:
the newly created
Issueobject
- PATCH /api/issues/(int: issue_id)
Edit an existing issue.
- Reqjson:
a (partial)
Issueobject- Status Codes:
400 Bad Request – if the item properties are invalid
404 Not Found – if the issue ID is not valid
- Returns:
the modified
Issueobject
- DELETE /api/issues/(int: issue_id)
Delete an existing issue.
- Status Codes:
404 Not Found – if the issue ID is not valid
204 No Content – on success
- GET /api/issues/tags
Get all known issue tags and their colors.
Tool tag colors can be customized by setting the
issue_tag_colorsoption.- Returns:
an object with tags as keys and colors as values