feat: update API paths to v1 and add fallback to old paths for backward compatibility

This commit is contained in:
riefive
2025-12-01 13:53:25 +07:00
parent 6d3dc0e426
commit 8a954a8c00
16 changed files with 88 additions and 38 deletions
+21 -5
View File
@@ -1,11 +1,12 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim-swagger/RencanaKontrol'
const name = 'rencana-kontrol'
const path = '/api/v1/control-plan'
const pathOld = '/api/v1/rencana-kontrol'
const name = 'control-plan' // 'rencana-kontrol'
export function getList(params: any = null) {
let url = path
export function getListOld(params: any = null) {
let url = pathOld
if (params?.letterNumber && params.mode === 'by-control') {
url += `/noSuratKontrol/${params.letterNumber}`
}
@@ -26,4 +27,19 @@ export function getList(params: any = null) {
delete params.mode
}
return base.getList(url, params, name)
}
}
export function getList(params: any = null) {
let url = path
if (params?.controlDate && params.mode === 'by-schedule') {
url += `/${params.controlType}/${params.polyCode}/${params.controlDate}`
delete params.controlType
delete params.controlDate
delete params.polyCode
}
if (params) {
delete params.letterNumber
delete params.mode
}
return base.getList(url, params, name)
}
@@ -1,9 +1,12 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/diagnose-prb'
const path = '/api/v1/reference/diagnose-prb'
const pathOld = '/api/vclaim/v1/reference/diagnose-prb'
const name = 'diagnose-referral'
export function getList(params: any = null) {
return base.getList(path, params, name)
const isNew = true
const url = !isNew ? pathOld : path
return base.getList(url, params, name)
}
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/diagnose'
const path = '/api/v1/reference/diagnose'
const pathOld = '/api/vclaim/v1/reference/diagnose'
const name = 'diagnose'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params && params?.diagnosa) {
url += `/${params.diagnosa}`
delete params.diagnosa
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/responsible-doctor'
const path = '/api/v1/reference/responsible-doctor'
const pathOld = '/api/vclaim/v1/reference/responsible-doctor'
const name = 'responsible-doctor'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.serviceType) {
url += `/${params.serviceType}`
delete params.serviceType
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/healthcare'
const path = '/api/v1/reference/healthcare'
const pathOld = '/api/vclaim/v1/reference/healthcare'
const name = 'healthcare'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.healthcare) {
url += `/${params.healthcare}`
delete params.healthcare
+5 -2
View File
@@ -1,11 +1,14 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/medicine'
const path = '/api/v1/reference/medicine'
const pathOld = '/api/vclaim/v1/reference/medicine'
const name = 'medicine'
export function getList(params: any = null) {
return base.getList(path, params, name)
const isNew = true
const url = !isNew ? pathOld : path
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/member'
const path = '/api/v1/member'
const pathOld = '/api/vclaim/v1/member'
const name = 'member'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.number && params.mode === 'by-identity') {
url += `/nik/${params.number}/${params.date}`
}
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/monitoring/hist'
const path = '/api/v1/monitoring/hist'
const pathOld = '/api/vclaim/v1/monitoring/hist'
const name = 'monitoring-history'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params && params?.cardNumber) {
url += `/${params.cardNumber}/${params.startDate}/${params.endDate}`
delete params.cardNumber
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/monitoring/visit'
const path = '/api/v1/monitoring/visit'
const pathOld = '/api/vclaim/v1/monitoring/visit'
const name = 'monitoring-visit'
export async function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.date && params.serviceType) {
url += `/${params.date}/${params.serviceType}`
}
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim-swagger/Rujukan/RS'
const name = 'rujukan-rumah-sakit'
const path = '/api/v1/referral'
const pathOld = '/api/vclaim-swagger/Rujukan/RS'
const name = 'reference-hospital-letter' // 'rujukan-rumah-sakit'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.letterNumber) {
url += `/${params.letterNumber}`
}
@@ -13,4 +15,4 @@ export function getList(params: any = null) {
delete params.letterNumber
}
return base.getList(url, params, name)
}
}
@@ -13,4 +13,4 @@ export function getList(params: any = null) {
delete params.letterNumber
}
return base.getList(url, params, name)
}
}
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/regency'
const path = '/api/v1/reference/regency'
const pathOld = '/api/vclaim/v1/reference/regency'
const name = 'cities'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.province) {
url += `/${params.province}`
delete params.province
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/district'
const path = '/api/v1/reference/district'
const pathOld = '/api/vclaim/v1/reference/district'
const name = 'districts'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.city) {
url += `/${params.city}`
delete params.city
@@ -1,11 +1,14 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/province'
const path = '/api/v1/reference/province'
const pathOld = '/api/vclaim/v1/reference/province'
const name = 'provinces'
export function getList(params: any = null) {
return base.getList(path, params, name)
const isNew = true
let url = !isNew ? pathOld : path
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
+9 -4
View File
@@ -4,7 +4,8 @@ import * as base from './_crud-base'
// Types
import type { IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema'
const path = '/api/vclaim-swagger/sep'
const path = '/api/v1/vclaim-sep'
const pathOld = '/api/vclaim-swagger/sep'
const name = 'sep'
// TODO: temporary destinationClinic
@@ -15,7 +16,8 @@ export function create(data: any) {
}
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.number) {
url += `/${params.number}`
delete params.number
@@ -24,11 +26,14 @@ export function getList(params: any = null) {
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
const isNew = true
const url = !isNew ? pathOld : path
return base.getDetail(url, id, name)
}
export function remove(payload: any) {
const url = `${path}`
const isNew = true
const url = !isNew ? pathOld : path
return base.removeCustom(url, payload, name)
}
+4 -2
View File
@@ -1,11 +1,13 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/unit'
const path = '/api/v1/reference/unit'
const pathOld = '/api/vclaim/v1/reference/unit'
const name = 'unit'
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.unitCode) {
url += `/${params.unitCode}`
delete params.unitCode