Reorganize PagedRepository
volbap opened this issue · 2 comments
volbap commented
Re-organize PagedRepository's API to match the new CRUD API design
volbap commented
Proposed solution:
- Move the
find(byPage:)
functionality to theReadable
protocol - Remove
PagedRepository
volbap commented
Current:
Single-Entity Repository (e.g. /profile) | Multiple-Entity Repository (e.g. /users) |
|
---|---|---|
Creatable | .create(e) POST /profile → ⚪ | .create(e) POST /users → ⚪ .create([e1, e2, ...]) POST /users → [⚪ ,⚪ , ...] |
Readable | .read() GET /profile → ⚪ | .read(id: x) GET /users/x →⚪ .readAll() GET /users → [⚪ ,⚪ , ...] |
Updatable | .update(e) PUT /profile → ⚪ | .update(e, id: x) PUT /users/x → ⚪ .update([e1, e2, ...]) PATCH /users → [⚪ ,⚪ , ...] |
Deletable | .delete() DELETE /profile | .delete(id: x) DELETE /users/x |
PagedRepository (pageSize: N) | .findByPage(pageNumber: n) GET /users?page=n&per_page=N → ( [⚪ ,⚪ , ...] , pageInfo ) |
New:
Single-Entity Repository (e.g. /profile) | Multiple-Entity Repository (e.g. /users) |
|
---|---|---|
Creatable | .create(e) POST /profile → ⚪ | .create(e) POST /users → ⚪ .create([e1, e2, ...]) POST /users → [⚪ ,⚪ , ...] |
Readable | .read() GET /profile → ⚪ | .read(id: x) GET /users/x →⚪ .readAll() GET /users → [⚪ ,⚪ , ...] .read(pageNumber: n, pageSize: N) GET /users?page=n&per_page=N → ( [⚪ ,⚪ , ...] , pageInfo ) |
Updatable | .update(e) PUT /profile → ⚪ | .update(e, id: x) PUT /users/x → ⚪ .update([e1, e2, ...]) PATCH /users → [⚪ ,⚪ , ...] |
Deletable | .delete() DELETE /profile | .delete(id: x) DELETE /users/x |