Api: add REST API handler and JSON format for Tracker items#3
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a REST/JSON layer for the Tracker app analogous to other EGroupware apps' CalDAV handlers. The handler hooks into the GroupDAV endpoint and the JsTracker class converts tracker items to/from a JSON representation.
Changes:
- New
ApiHandler(CalDAVHandlersubclass) implementing PROPFIND/GET/PUT/POST/PATCH/DELETE, sync-collection, filter mapping, ETag and exception handling for/trackercollections. - New
JsTracker(CalDAVJsBasesubclass) providingJsTicket()serialization andparseJsTicket()/parseStatus()/parseAssigned()deserialization including custom-status and custom-field support. - Auto-creates a "Default" tracker queue on first REST use if none exist, so search/list does not return empty.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/ApiHandler.php | New REST handler for /tracker collection: routing, filters, sync-collection, ACL, ETag, exception responses. |
| src/JsTracker.php | New JSON renderer/parser for tracker items (JsTicket/parseJsTicket), including status label mapping and assigned/account handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi Amir, as I said in our AI meeting:
Ralf |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Align propfind paging stride with the fetch size so nresults values above CHUNK_SIZE do not overlap pages, and only emit deleted tickets as path-only entries during sync-collection reports. Based on Copilot review.
|
Hi Amir, Ralf |
Hi Ralf, |
Adds two new PHPUnit test classes under tests/REST/: - TrackerRestCreateReadDelete: covers create, read, update and delete of tracker tickets via the JSON REST API (groupdav.php endpoint). - TrackerRestPermissions: covers role-based access scenarios for manager, technician and reporter actors against the same endpoint. Both suites auto-skip until a tracker_groupdav handler is implemented.
ralfbecker
left a comment
There was a problem hiding this comment.
Sorry, found a couple more things ;)
Ralf
96789bb to
83e2569
Compare
- Remove auto-create queue from constructor; return 403 Forbidden in
propfind and new-ticket PUT/POST when the user has no queue access
- Change assigned field from sequential array to JMAP-style map
keyed by numeric account-id string, so PATCH can add/remove
individual assignees: {"uid": true} to add, {"uid": null} to remove
- Fix parseAssigned to apply map as delta on top of $old for PATCH
- Add TrackerRestAssignedPatch test covering add and remove via PATCH
83e2569 to
d69d5da
Compare
|
|
||
| case 'assigned': | ||
| $ticket['tr_assigned'] = self::parseAssigned($value); | ||
| $ticket['tr_assigned'] = self::parseAssigned($value, (array)($old['assigned'] ?? []), $method); |
There was a problem hiding this comment.
Please use the Responsible and parseResponsible methods from Api\src\CalDAV\JsCalendar by extending it instead of JsBase.
It makes sense to stay relativ close with Tickets to the standardized Tasks, as they are very similar with the exception of the replies.
So we should use participants instead of assigned and cc. Maybe have a quick check, if the other attributes use different names from Tasks/InfoLog, and change them too, obviously only if they exist in InfoLog/Tasks.
Sorry, for not writing that in the first review :(
No description provided.