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

No files matched your search

+20 -4
View File
@@ -1,11 +1,12 @@
// Base // Base
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/vclaim-swagger/RencanaKontrol' const path = '/api/v1/control-plan'
const name = 'rencana-kontrol' const pathOld = '/api/v1/rencana-kontrol'
const name = 'control-plan' // 'rencana-kontrol'
export function getList(params: any = null) { export function getListOld(params: any = null) {
let url = path let url = pathOld
if (params?.letterNumber && params.mode === 'by-control') { if (params?.letterNumber && params.mode === 'by-control') {
url += `/noSuratKontrol/${params.letterNumber}` url += `/noSuratKontrol/${params.letterNumber}`
} }
@@ -27,3 +28,18 @@ export function getList(params: any = null) {
} }
return base.getList(url, params, name) 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 // Base
import * as base from './_crud-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' const name = 'diagnose-referral'
export function getList(params: any = null) { 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 // Base
import * as base from './_crud-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' const name = 'diagnose'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params && params?.diagnosa) { if (params && params?.diagnosa) {
url += `/${params.diagnosa}` url += `/${params.diagnosa}`
delete params.diagnosa delete params.diagnosa
+4 -2
View File
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'responsible-doctor'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.serviceType) { if (params?.serviceType) {
url += `/${params.serviceType}` url += `/${params.serviceType}`
delete params.serviceType delete params.serviceType
+4 -2
View File
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'healthcare'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.healthcare) { if (params?.healthcare) {
url += `/${params.healthcare}` url += `/${params.healthcare}`
delete params.healthcare delete params.healthcare
+5 -2
View File
@@ -1,11 +1,14 @@
// Base // Base
import * as base from './_crud-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' const name = 'medicine'
export function getList(params: any = null) { 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 }[]> { export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
+4 -2
View File
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'member'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.number && params.mode === 'by-identity') { if (params?.number && params.mode === 'by-identity') {
url += `/nik/${params.number}/${params.date}` url += `/nik/${params.number}/${params.date}`
} }
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'monitoring-history'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params && params?.cardNumber) { if (params && params?.cardNumber) {
url += `/${params.cardNumber}/${params.startDate}/${params.endDate}` url += `/${params.cardNumber}/${params.startDate}/${params.endDate}`
delete params.cardNumber delete params.cardNumber
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'monitoring-visit'
export async function getList(params: any = null) { export async function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.date && params.serviceType) { if (params?.date && params.serviceType) {
url += `/${params.date}/${params.serviceType}` url += `/${params.date}/${params.serviceType}`
} }
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/vclaim-swagger/Rujukan/RS' const path = '/api/v1/referral'
const name = 'rujukan-rumah-sakit' const pathOld = '/api/vclaim-swagger/Rujukan/RS'
const name = 'reference-hospital-letter' // 'rujukan-rumah-sakit'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.letterNumber) { if (params?.letterNumber) {
url += `/${params.letterNumber}` url += `/${params.letterNumber}`
} }
+4 -2
View File
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'cities'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.province) { if (params?.province) {
url += `/${params.province}` url += `/${params.province}`
delete params.province delete params.province
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'districts'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.city) { if (params?.city) {
url += `/${params.city}` url += `/${params.city}`
delete params.city delete params.city
@@ -1,11 +1,14 @@
// Base // Base
import * as base from './_crud-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' const name = 'provinces'
export function getList(params: any = null) { 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 }[]> { 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 // Types
import type { IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema' 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' const name = 'sep'
// TODO: temporary destinationClinic // TODO: temporary destinationClinic
@@ -15,7 +16,8 @@ export function create(data: any) {
} }
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.number) { if (params?.number) {
url += `/${params.number}` url += `/${params.number}`
delete params.number delete params.number
@@ -24,11 +26,14 @@ export function getList(params: any = null) {
} }
export function getDetail(id: number | string) { 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) { export function remove(payload: any) {
const url = `${path}` const isNew = true
const url = !isNew ? pathOld : path
return base.removeCustom(url, payload, name) return base.removeCustom(url, payload, name)
} }
+4 -2
View File
@@ -1,11 +1,13 @@
// Base // Base
import * as base from './_crud-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' const name = 'unit'
export function getList(params: any = null) { export function getList(params: any = null) {
let url = path const isNew = true
let url = !isNew ? pathOld : path
if (params?.unitCode) { if (params?.unitCode) {
url += `/${params.unitCode}` url += `/${params.unitCode}`
delete params.unitCode delete params.unitCode