|
| 1 | +import * as crud from './crud' |
| 2 | + |
| 3 | +/* -------------------------------------------------------------------------- */ |
| 4 | +/* Models */ |
| 5 | +/* -------------------------------------------------------------------------- */ |
| 6 | + |
| 7 | +export type SchoolDetails = { |
| 8 | + id: string; |
| 9 | + name: string; |
| 10 | +} |
| 11 | + |
| 12 | +export type SchoolSummary = Pick<SchoolDetails, 'id' | 'name'>; |
| 13 | + |
| 14 | +/* -------------------------------------------------------------------------- */ |
| 15 | +/* Create */ |
| 16 | +/* -------------------------------------------------------------------------- */ |
| 17 | + |
| 18 | +export type CreateSchoolRequest = crud.CreateItemRequest<Omit<SchoolDetails, 'id'>>; |
| 19 | +export type CreateSchoolResponse = crud.CreateItemResponse<SchoolDetails['id']>; |
| 20 | + |
| 21 | +/* -------------------------------------------------------------------------- */ |
| 22 | +/* Read */ |
| 23 | +/* -------------------------------------------------------------------------- */ |
| 24 | + |
| 25 | +export type GetSchoolsResponse = |
| 26 | + crud.GetItemsListResponse<SchoolSummary>; |
| 27 | + |
| 28 | +export type GetSchoolResponse = |
| 29 | + crud.GetItemResponse<SchoolDetails>; |
| 30 | + |
| 31 | +/* -------------------------------------------------------------------------- */ |
| 32 | +/* Update */ |
| 33 | +/* -------------------------------------------------------------------------- */ |
| 34 | + |
| 35 | +export type UpdateSchoolRequest = |
| 36 | + crud.UpdateItemRequest<Omit<SchoolDetails, 'id'>>; |
| 37 | + |
| 38 | +export type UpdateSchoolResponse = |
| 39 | + crud.UpdateItemResponse<SchoolDetails>; |
| 40 | + |
| 41 | +/* -------------------------------------------------------------------------- */ |
| 42 | +/* Delete */ |
| 43 | +/* -------------------------------------------------------------------------- */ |
| 44 | + |
| 45 | +export type DeleteSchoolResponse = |
| 46 | + crud.DeleteItemResponse; |
0 commit comments