refactor(log): remove legacy log deletion endpoint and associated types
This commit is contained in:
@@ -150,6 +150,10 @@ func GetLogsSelfStat(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteHistoryLogs is the legacy synchronous log cleanup endpoint (DELETE /api/log/).
|
||||||
|
// It deletes directly instead of going through the async system task. It is kept only
|
||||||
|
// for the classic frontend; the default frontend uses POST /api/system-task/log-cleanup.
|
||||||
|
// TODO: remove this handler (and its route) once the classic frontend is removed.
|
||||||
func DeleteHistoryLogs(c *gin.Context) {
|
func DeleteHistoryLogs(c *gin.Context) {
|
||||||
targetTimestamp, _ := strconv.ParseInt(c.Query("target_timestamp"), 10, 64)
|
targetTimestamp, _ := strconv.ParseInt(c.Query("target_timestamp"), 10, 64)
|
||||||
if targetTimestamp == 0 {
|
if targetTimestamp == 0 {
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ func SetApiRouter(router *gin.Engine) {
|
|||||||
}
|
}
|
||||||
logRoute := apiRouter.Group("/log")
|
logRoute := apiRouter.Group("/log")
|
||||||
logRoute.GET("/", middleware.AdminAuth(), controller.GetAllLogs)
|
logRoute.GET("/", middleware.AdminAuth(), controller.GetAllLogs)
|
||||||
|
// Legacy synchronous direct-delete route used only by the classic frontend.
|
||||||
|
// TODO: remove once the classic frontend is removed; the default frontend uses /system-task/log-cleanup.
|
||||||
logRoute.DELETE("/", middleware.RootAuth(), controller.DeleteHistoryLogs)
|
logRoute.DELETE("/", middleware.RootAuth(), controller.DeleteHistoryLogs)
|
||||||
logRoute.GET("/stat", middleware.AdminAuth(), controller.GetLogsStat)
|
logRoute.GET("/stat", middleware.AdminAuth(), controller.GetLogsStat)
|
||||||
logRoute.GET("/self/stat", middleware.UserAuth(), controller.GetLogsSelfStat)
|
logRoute.GET("/self/stat", middleware.UserAuth(), controller.GetLogsSelfStat)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ For commercial licensing, please contact support@quantumnous.com
|
|||||||
import { api } from '@/lib/api'
|
import { api } from '@/lib/api'
|
||||||
import type {
|
import type {
|
||||||
ConfirmPaymentComplianceResponse,
|
ConfirmPaymentComplianceResponse,
|
||||||
DeleteLogsResponse,
|
|
||||||
FetchUpstreamRatiosRequest,
|
FetchUpstreamRatiosRequest,
|
||||||
LogCleanupTask,
|
LogCleanupTask,
|
||||||
SystemOptionsResponse,
|
SystemOptionsResponse,
|
||||||
@@ -48,13 +47,6 @@ export async function confirmPaymentCompliance() {
|
|||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteLogsBefore(targetTimestamp: number) {
|
|
||||||
const res = await api.delete<DeleteLogsResponse>('/api/log/', {
|
|
||||||
params: { target_timestamp: targetTimestamp },
|
|
||||||
})
|
|
||||||
return res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function startLogCleanupTask(targetTimestamp: number) {
|
export async function startLogCleanupTask(targetTimestamp: number) {
|
||||||
const res = await api.post<SystemTaskResponse<LogCleanupTask>>(
|
const res = await api.post<SystemTaskResponse<LogCleanupTask>>(
|
||||||
'/api/system-task/log-cleanup',
|
'/api/system-task/log-cleanup',
|
||||||
|
|||||||
@@ -50,12 +50,6 @@ export type ConfirmPaymentComplianceResponse = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DeleteLogsResponse = {
|
|
||||||
success: boolean
|
|
||||||
message: string
|
|
||||||
data?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SystemTaskStatus = 'pending' | 'running' | 'succeeded' | 'failed'
|
export type SystemTaskStatus = 'pending' | 'running' | 'succeeded' | 'failed'
|
||||||
|
|
||||||
export type SystemTask<
|
export type SystemTask<
|
||||||
|
|||||||
Reference in New Issue
Block a user