HomeUniteUs
HomeUniteUs copied to clipboard
Coordinator Dashboard Endpoint
Dependencies
- This can be revisited/confirmed as completed after codebase cleanup is complete #771
Overview
We need to create an endpoint that returns a paginated list of all users to be displayed on the coordinator dashboard. The users should also be filtered and sorted based on query string parameters passed to the endpoint.
GET
/coordinator/dashboard?role=host,guest&name=John_Doe&sort=updated&order=asc&limit=10&offset=20
**Description:**
Get users for the coordinator dashboard based on sorting, filtering, and pagination requirements
**Response Body:**
Response {
total_guests: int
total_hosts: int
users: UserInfo[]
}
UserInfo {
user_id: int
first_name: string // Not currently apart of User model
last_name: string // Not currently included in User model
type: 'guest' | 'host' // Not currently included in User model
status: string
coordinator: string // name of assigned coordinator
last_updated: date
notes: string // No model currently exists
}
Query Parameters
- role=host,guest
- Filter which users types to fetch.
- name=John_Doe
- Search/filter by name
- sort=updated&order=asc
- The property to sort by and the order in which into return them
- limit=10&offset=20
- The number of items to return per page and the offset depending on the page
Action Items
- [ ] Write spec and define controller for route
- [ ] Update User model to include necessary properties (eg. first_name, last_name, type)
- [ ] Query database for users based on query parameters. Maybe create a script to add list of users to DB.
- [ ] Return list of users from endpoint
Parent Issues
- #501
Please remember to add milestones thank you!