- Tambah GET /api/bugs/stats dengan summary cards & chart trend/bugs per app - Tambah date range picker di village activity chart - Tambah tabel Recent Activity (action + description) di village detail - Update API graph-log-villages support dateFrom/dateTo custom range
74 lines
4.3 KiB
TypeScript
74 lines
4.3 KiB
TypeScript
const DESA_PLUS_PROXY = '/api/proxy/desa-plus'
|
|
|
|
export const API_URLS = {
|
|
getVillages: (page: number, search: string) =>
|
|
`${DESA_PLUS_PROXY}/api/monitoring/get-villages?page=${page}&search=${encodeURIComponent(search)}`,
|
|
infoVillages: (id: string) =>
|
|
`${DESA_PLUS_PROXY}/api/monitoring/info-villages?id=${id}`,
|
|
gridVillages: (id: string) =>
|
|
`${DESA_PLUS_PROXY}/api/monitoring/grid-villages?id=${id}`,
|
|
graphLogVillages: (id: string, time: string, dateFrom?: string, dateTo?: string) => {
|
|
const params = new URLSearchParams({ id, time })
|
|
if (dateFrom) params.set('dateFrom', dateFrom)
|
|
if (dateTo) params.set('dateTo', dateTo)
|
|
return `${DESA_PLUS_PROXY}/api/monitoring/graph-log-villages?${params}`
|
|
},
|
|
getRecentVillageLogs: (id: string) =>
|
|
`${DESA_PLUS_PROXY}/api/monitoring/recent-village-logs?id=${id}`,
|
|
getUsers: (page: number, search: string, isActive?: string, idUserRole?: string, idVillage?: string, orderBy?: string, orderDir?: string) => {
|
|
const params = new URLSearchParams({ page: String(page), search })
|
|
if (isActive !== undefined) params.set('isActive', isActive)
|
|
if (idUserRole) params.set('idUserRole', idUserRole)
|
|
if (idVillage) params.set('idVillage', idVillage)
|
|
if (orderBy) params.set('orderBy', orderBy)
|
|
if (orderDir) params.set('orderDir', orderDir)
|
|
return `${DESA_PLUS_PROXY}/api/monitoring/user?${params}`
|
|
},
|
|
getLogsAllVillages: (page: number, search: string, action?: string, idVillage?: string, dateFrom?: string, dateTo?: string) => {
|
|
const params = new URLSearchParams({ page: String(page), search })
|
|
if (action) params.set('action', action)
|
|
if (idVillage) params.set('idVillage', idVillage)
|
|
if (dateFrom) params.set('dateFrom', dateFrom)
|
|
if (dateTo) params.set('dateTo', dateTo)
|
|
return `${DESA_PLUS_PROXY}/api/monitoring/log-all-villages?${params}`
|
|
},
|
|
getGridOverview: () => `${DESA_PLUS_PROXY}/api/monitoring/grid-overview`,
|
|
getDailyActivity: (range: 7 | 30 | 90 = 7) => `${DESA_PLUS_PROXY}/api/monitoring/daily-activity?range=${range}`,
|
|
getComparisonActivity: (range: 7 | 30 | 90 = 7) => `${DESA_PLUS_PROXY}/api/monitoring/comparison-activity?range=${range}`,
|
|
postVersionUpdate: () => `${DESA_PLUS_PROXY}/api/monitoring/version-update`,
|
|
createVillages: () => `${DESA_PLUS_PROXY}/api/monitoring/create-villages`,
|
|
createUser: () => `${DESA_PLUS_PROXY}/api/monitoring/create-user`,
|
|
listRole: () => `${DESA_PLUS_PROXY}/api/monitoring/list-userrole-villages`,
|
|
listGroup: (id: string) => `${DESA_PLUS_PROXY}/api/monitoring/list-group-villages?id=${id}`,
|
|
listPosition: (id: string) => `${DESA_PLUS_PROXY}/api/monitoring/list-position-villages?id=${id}`,
|
|
editUser: () => `${DESA_PLUS_PROXY}/api/monitoring/edit-user`,
|
|
updateStatusVillages: () => `${DESA_PLUS_PROXY}/api/monitoring/update-status-villages`,
|
|
editVillages: () => `${DESA_PLUS_PROXY}/api/monitoring/edit-villages`,
|
|
getGlobalLogs: (page: number, search: string, type: string, userId: string, dateFrom?: string, dateTo?: string) => {
|
|
const params = new URLSearchParams({ page: String(page), search, type, userId })
|
|
if (dateFrom) params.set('dateFrom', dateFrom)
|
|
if (dateTo) params.set('dateTo', dateTo)
|
|
return `/api/logs?${params}`
|
|
},
|
|
getLogOperators: () => `/api/logs/operators`,
|
|
getOperators: (page: number, search: string) =>
|
|
`/api/operators?page=${page}&search=${encodeURIComponent(search)}`,
|
|
getOperatorStats: () => `/api/operators/stats`,
|
|
createOperator: () => `/api/operators`,
|
|
editOperator: (id: string) => `/api/operators/${id}`,
|
|
deleteOperator: (id: string) => `/api/operators/${id}`,
|
|
getBugs: (page: number, search: string, app: string, status: string, source?: string, dateFrom?: string, dateTo?: string) => {
|
|
const params = new URLSearchParams({ page: String(page), search: encodeURIComponent(search), app, status })
|
|
if (source && source !== 'all') params.set('source', source)
|
|
if (dateFrom) params.set('dateFrom', dateFrom)
|
|
if (dateTo) params.set('dateTo', dateTo)
|
|
return `/api/bugs?${params}`
|
|
},
|
|
createBug: () => `/api/bugs`,
|
|
getBugStats: (range: 7 | 30 | 90 = 30) => `/api/bugs/stats?range=${range}`,
|
|
uploadImage: () => `/api/upload/image`,
|
|
updateBugStatus: (id: string) => `/api/bugs/${id}/status`,
|
|
updateBugFeedback: (id: string) => `/api/bugs/${id}/feedback`,
|
|
createLog: () => `/api/logs`,
|
|
}
|