feat: update API paths to v1 and remove old path references for consistency

This commit is contained in:
riefive
2025-12-02 11:06:48 +07:00
parent be3f5c9d40
commit 297e16eaee
14 changed files with 15 additions and 41 deletions
@@ -2,11 +2,9 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true const url = path
const url = !isNew ? pathOld : path
return base.getList(url, params, name) return base.getList(url, params, name)
} }
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
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
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.serviceType) { if (params?.serviceType) {
url += `/${params.serviceType}` url += `/${params.serviceType}`
delete params.serviceType delete params.serviceType
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.healthcare) { if (params?.healthcare) {
url += `/${params.healthcare}` url += `/${params.healthcare}`
delete params.healthcare delete params.healthcare
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true const url = path
const url = !isNew ? pathOld : path
return base.getList(url, params, name) return base.getList(url, params, name)
} }
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
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}`
} }
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
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
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
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}`
} }
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/v1/referral' const path = '/api/v1/referral'
const pathOld = '/api/vclaim-swagger/Rujukan/RS'
const name = 'reference-hospital-letter' // 'rujukan-rumah-sakit' const name = 'reference-hospital-letter' // 'rujukan-rumah-sakit'
export function getList(params: any = null) { export function getList(params: any = null) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.letterNumber) { if (params?.letterNumber) {
url += `/${params.letterNumber}` url += `/${params.letterNumber}`
} }
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.province) { if (params?.province) {
url += `/${params.province}` url += `/${params.province}`
delete params.province delete params.province
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.city) { if (params?.city) {
url += `/${params.city}` url += `/${params.city}`
delete params.city delete params.city
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true const url = path
let url = !isNew ? pathOld : path
return base.getList(url, params, name) return base.getList(url, params, name)
} }
+1 -3
View File
@@ -2,12 +2,10 @@
import * as base from './_crud-base' import * as base from './_crud-base'
const path = '/api/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) {
const isNew = true let url = path
let url = !isNew ? pathOld : path
if (params?.unitCode) { if (params?.unitCode) {
url += `/${params.unitCode}` url += `/${params.unitCode}`
delete params.unitCode delete params.unitCode
+2 -2
View File
@@ -10,10 +10,10 @@ export default defineEventHandler(async (event) => {
const apiVclaim = config.public.VCLAIM const apiVclaim = config.public.VCLAIM
const apiVclaimSwagger = config.public.VCLAIM_SWAGGER const apiVclaimSwagger = config.public.VCLAIM_SWAGGER
const pathname = url.pathname.replace(/^\/api/, '') const pathname = url.pathname.replace(/^\/api/, '')
const isVclaim = pathname.includes('/vclaim') const isVclaim = pathname.includes('/vclaim') && !pathname.includes('/vclaim-sep')
let targetUrl = apiOrigin + pathname + (url.search || '') let targetUrl = apiOrigin + pathname + (url.search || '')
if (pathname.includes('/vclaim')) { if (pathname.includes('/vclaim') && !pathname.includes('/vclaim-sep')) {
targetUrl = apiVclaim + pathname.replace('/vclaim', '') + (url.search || '') targetUrl = apiVclaim + pathname.replace('/vclaim', '') + (url.search || '')
} }
if (pathname.includes('/vclaim-swagger')) { if (pathname.includes('/vclaim-swagger')) {