50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { z } from 'zod'
|
|
import { InternalReferenceSchema } from './internal-reference.schema'
|
|
|
|
// Check In
|
|
const CheckInSchema = z.object({
|
|
// registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
|
|
responsible_doctor_code: z.string({ required_error: 'Dokter harus diisi' }),
|
|
// adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
|
|
registeredAt: z.string({ required_error: 'waktu harus diisi' }),
|
|
})
|
|
type CheckInFormData = z.infer<typeof CheckInSchema>
|
|
|
|
// Checkout
|
|
const CheckOutSchema = z.object({
|
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
|
})
|
|
type CheckOutFormData = z.infer<typeof CheckOutSchema>
|
|
|
|
// CheckoutDeath
|
|
const CheckOutDeathSchema = z.object({
|
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
|
death_cause: z.array(z.string()).nonempty(),
|
|
})
|
|
type CheckOutDeathFormData = z.infer<typeof CheckOutDeathSchema>
|
|
|
|
// CheckoutDeath
|
|
const CheckOutInternalReferenceSchema = z.object({
|
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
|
internalReferences: z.array(InternalReferenceSchema).nonempty(),
|
|
})
|
|
type CheckOutInternalReferenceFormData = z.infer<typeof CheckOutInternalReferenceSchema>
|
|
|
|
|
|
// Exports
|
|
export {
|
|
CheckInSchema,
|
|
CheckOutSchema,
|
|
CheckOutDeathSchema,
|
|
CheckOutInternalReferenceSchema
|
|
}
|
|
export type {
|
|
CheckInFormData,
|
|
CheckOutFormData,
|
|
CheckOutDeathFormData,
|
|
CheckOutInternalReferenceFormData
|
|
}
|