feat/procedure-room-order: finishing
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// Base
|
||||
import type { ProcedureRoomOrder } from '~/models/procedure-room-order'
|
||||
import type { ProcedureRoomOrder, CreateDto } from '~/models/procedure-room-order'
|
||||
import * as base from './_crud-base'
|
||||
|
||||
const name = 'procedure-room'
|
||||
const name = 'procedure-room-order'
|
||||
const path = `/api/v1/${name}`
|
||||
|
||||
export function create(data: ProcedureRoomOrder) {
|
||||
export function create(data: CreateDto) {
|
||||
return base.create(path, data, name)
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ export function getList(params: any = null) {
|
||||
return base.getList(path, params, name)
|
||||
}
|
||||
|
||||
export function getDetail(id: number | string) {
|
||||
return base.getDetail(path, id, name)
|
||||
export function getDetail(id: number | string, params: any = null) {
|
||||
return base.getDetail(path, id, name, params)
|
||||
}
|
||||
|
||||
export function update(id: number | string, data: ProcedureRoomOrder) {
|
||||
@@ -24,3 +24,19 @@ export function update(id: number | string, data: ProcedureRoomOrder) {
|
||||
export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
|
||||
export async function submit(id: number) {
|
||||
try {
|
||||
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
|
||||
const result: any = {}
|
||||
if (resp.success) {
|
||||
result.success = resp.success
|
||||
result.body = (resp.body as Record<string, any>) || {}
|
||||
return result
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error submitting ${name}:`, error)
|
||||
throw new Error(`Failed to submit ${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user