Legal API - add GET /batches admin endpoint(exclude column filtering)
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
Implement a first cut of GET `/admin/batches` endpoint that includes paging and sorting so we are able to start implementing the [batch history screens in the designs](https://www.figma.com/design/LcP4NgVYKVxEk8V7fXWIuc/Involuntary-Dissolution-%26-Delay-of-Dissolution?node-id=1115-1404&t=2YmOJ1Zs63J7mdGr-0).
Keep in mind that we will be implementing column filtering for the GET batches endpoint after this ticket is implemented.
**GET /admin/batches endpoint URL structure**
```
GET /api/v2/admin/batches?page=1&page_size=2&sort_by=&sort_order=desc
```
**Sample response from GET /admin/batches endpoint**
Note that we will be returning all columns in the `batches` table. It will be up to the UI to decide which columns to use.
```json
{
"batches": [
{
"id": 1,
"created_date": "2024-06-25",
"end_date": "2024-08-26",
"status": "COMPLETED",
"size": 344,
"max_size": 600,
"batch_type": "DAILY",
"notes": null
},
{
"id": 15,
"created_date": "2024-06-19",
"end_date": null,
"status": "FAILED",
"size": 300,
"max_size": 600,
"batch_type": "DAILY",
"notes": "reason for failure"
}
],
"total": 10,
"pages": 5,
"current_page": 1
}
```
**TODOs**
- [ ] Create `GET /admin/batches` endpoint. Can probably add a new resource under [admin folder](https://github.com/bcgov/lear/tree/25992fea431bd6cedadeaa21515216f9db0ff2db/legal-api/src/legal_api/resources/v2/admin).
- [ ] endpoint only accessible to admin users
- [ ] supports paging via `page_size` and `page` parameters. Think we should have default `page_size` of 5 if no `page_size` is provided. And default `page` of 1 if that isn’t provided
- [ ] supports sorting by column via `sort_by` and `sort_order`. **Need clarification on design. Are we able to sort by multiple columns? Or one column at any given time?**
- [ ] Add/update tests as appropriate
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.