lab-64 / split-the-bill-server

Backend for the Split the Bill App
4 stars 0 forks source link

Decide on item contribution #128

Closed GR0ZA closed 8 months ago

GR0ZA commented 9 months ago
  1. Neue Tabelle: bill_pending_review
    • mit 2 Spalten:
    • bill_id
    • user_id

Flow:

  1. Felix hat neuen bil hinzugefügt ---> write in bill_pending_review bill_id = 123 user_id = ID von jan

bill_id = 123 user_id = ID von Marvin

  1. Marvin hat neuen bil hingezufügt

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

f-odc commented 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:

f-odc commented 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:

  • [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.