updates
This commit is contained in:
@@ -46,6 +46,11 @@ export class InspectionsClient extends ApiClient {
|
||||
return this.get(INSPECTION_ROUTES.INDEX, query ? { query } as never : undefined)
|
||||
}
|
||||
|
||||
async getById(id: string) {
|
||||
const res = await this.list({ query: { id } } as never)
|
||||
return {...res, data: res.data[0] }
|
||||
}
|
||||
|
||||
async create(payload: ApiRequestBody<typeof INSPECTION_ROUTES.INDEX, "post">) {
|
||||
return this.post(INSPECTION_ROUTES.INDEX, payload)
|
||||
}
|
||||
@@ -100,16 +105,35 @@ export class InspectionsClient extends ApiClient {
|
||||
return this.post(INSPECTION_ROUTES.TOGGLE_LABEL_TO_CHECKPOINT, payload)
|
||||
}
|
||||
|
||||
async changeCheckpointStatus(payload: ApiRequestBody<typeof INSPECTION_ROUTES.CHECKPOINT_CHANGE_STATUS, "post">) {
|
||||
async changeCheckpointStatus(payload: ApiRequestBody<typeof INSPECTION_ROUTES.CHECKPOINT_CHANGE_STATUS, "post">, ) {
|
||||
return this.post(INSPECTION_ROUTES.CHECKPOINT_CHANGE_STATUS, payload)
|
||||
}
|
||||
|
||||
async addCheckpointAttachment(payload: ApiRequestBody<typeof INSPECTION_ROUTES.CHECKPOINT_ADD_ATTACHMENT, "post">) {
|
||||
return this.post(INSPECTION_ROUTES.CHECKPOINT_ADD_ATTACHMENT, payload)
|
||||
async addCheckpointAttachment(payload: Record<string, any>) {
|
||||
const fd = new FormData()
|
||||
for (const [key, value] of Object.entries(payload)) {
|
||||
if (value == null) continue
|
||||
if (value instanceof File) {
|
||||
fd.append(key, value)
|
||||
} else {
|
||||
fd.append(key, String(value))
|
||||
}
|
||||
}
|
||||
return this.postFormData(INSPECTION_ROUTES.CHECKPOINT_ADD_ATTACHMENT, fd)
|
||||
}
|
||||
|
||||
async uploadCheckpointMedia(id: string, payload: ApiRequestBody<typeof INSPECTION_ROUTES.CHECKPOINT_UPLOAD_MEDIA, "post">) {
|
||||
return this.post(INSPECTION_ROUTES.CHECKPOINT_UPLOAD_MEDIA, payload, { params: { id } })
|
||||
async uploadCheckpointMedia(id: string, payload: Record<string, any>) {
|
||||
const fd = new FormData()
|
||||
for (const [key, value] of Object.entries(payload)) {
|
||||
if (value == null) continue
|
||||
if (value instanceof File) {
|
||||
fd.append(key, value)
|
||||
} else {
|
||||
fd.append(key, String(value))
|
||||
}
|
||||
}
|
||||
const url = INSPECTION_ROUTES.CHECKPOINT_UPLOAD_MEDIA.replace("{id}", id)
|
||||
return this.postFormData(url, fd)
|
||||
}
|
||||
|
||||
async deleteCheckpointMedia(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user