luk707 / luk707/trmnl-server

Unify update methods in device repository

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

At present, the device repository has two methods for updating device fields:

- `update_images`
- `update_status`

These should be unified into an update method that takes a sparse structure of all editable fields of the device model.

This also allows us to remove the PUT `/api/devices/{id}/images` endpoint, in favor of a PUT `/api/devices/{id}` method, though we should limit user editable fields to just `images` for now.

AC:

- [ ] Only one method called `update` on the device repository exists
- [ ] Update calls of the previous methods to use this new method
- [ ] Remove the `PUT /api/devices/{id}/images` endpoint
- [ ] Introduces a `PUT /api/devices{id}`
- [ ] Ensure the images are returned along with the DeviceInfo struct
- [ ] Update any necessary unit/integration tests

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the device repository methods update_images and update_status, their callers, and the PUT /api/devices/{id}/images route. Trace the DeviceInfo structure and existing unit or integration tests before consolidating the update path. Done means the old method and route are gone, the new PUT /api/devices/{id} accepts the intended sparse update, and images are included in DeviceInfo.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.