Closed GR0ZA closed 8 months ago
I decided to use another implementation: Each bill stores the users which have not viewed the bill. Initially all group members except the owner are included in that list.
The bill owner is capable of changing all bill fields. A bill member is only capable of adding or deleting itself from the item contributor list.
Some TODOs:
GET /bill
, PUT /bill/item
own endpoint?)
-> Idea: PUT /item
endpoint with parameter indicating no change. I decided to use another implementation: Each bill stores the users which have not viewed the bill. Initially all group members except the owner are included in that list.
The bill owner is capable of changing all bill fields. A bill member is only capable of adding or deleting itself from the item contributor list.
Some TODOs:
- [x] Check if changed contributor belongs to the member if the update function is performed by an member
- [ ] Delete users from the "not viewed" list of the bill -> How do we know if the bill gets viewed? (
GET /bill
,PUT /bill/item
own endpoint?) -> Idea:PUT /item
endpoint with parameter indicating no change.
To point 2:
I allow all group members to perform PUT /bill
and add isViewed
as a dto field to the body, so viewed bills can get marked.
Flow:
bill_id = 123 user_id = ID von Marvin
bill_id = 123 user_id = ID von jan
bill_id = 345 user_id = ID von jan
bill_id = 345 user_id = ID von felix
bill_id = 123 user_id = ID von Marvin
--- getPendingReviews array von bills inklusive items
für jedes item
POST /bill/{id}/ ---> mal gucken
[ itemId: true, ]
---> updated contributors von itemId = true && löscht eintrag aus bill_pending_review