commaai / commaai/comma-api

Return more information from the preserved route endpoints

Open
#34 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Sometimes a route being preserved can cause confusion when it was preserved automatically or by an admin.

Currently `GET /v1/devices/:dongleId/routes/preserved` returns the list of preserved routes for a dongle and user. The API returns a 403 error when trying to `DELETE /v1/route/:routeId/preserve` a route that was preserved by another user. The same error code is used when the user has preserved too many routes (10, or 100 for prime users), so clients cannot tell the difference easily.

Some potential solutions:
1. Differentiating the error code or adding an error message to the `/v1/route/:routeId/preserve` endpoint so that clients can tell the difference between the two errors.
2. Returning whether the user or someone else preserved the route in the API response to `GET /v1/devices/:dongleId/routes/preserved`. This would allow the client to disable the preserve button altogether.
1. Excluding routes preserved by admins from the list returned by `GET /v1/devices/:dongleId/routes/preserved`. This might be more difficult to implement since you would want to keep track of separate `RoutePreserved` entries by the user and admins for each route, but would completely hide this behaviour from the users.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.