feat(satusehat): implement query schema and improve data table
- Add schema.query.ts for query validation with zod - Move constants to const.ts for better organization - Refactor list.vue to use new query schema and constants - Add empty state handling to data-table.vue
This commit is contained in:
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import * as z from 'zod'
|
||||
|
||||
const resourceTabEnum = z.enum(['all', 'patient', 'encounter', 'observation'])
|
||||
|
||||
export const tabSwitcher = resourceTabEnum.default('all').catch('all')
|
||||
export const querySchema = z.object({
|
||||
q: z.string().min(3).optional().catch(''),
|
||||
resource_type: tabSwitcher,
|
||||
date_from: z.string().optional().catch(''),
|
||||
date_to: z.string().optional().catch(''),
|
||||
page: z.coerce.number().int().min(1).default(1).catch(1),
|
||||
limit: z.coerce.number().int().min(1).max(20).default(10).catch(10),
|
||||
})
|
||||
|
||||
export const defaultQuery = {
|
||||
q: '',
|
||||
status: '',
|
||||
resource_type: 'all',
|
||||
date_from: '',
|
||||
date_to: '',
|
||||
page: 1,
|
||||
limit: 10,
|
||||
}
|
||||
Reference in New Issue
Block a user