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
|
||||
}
|
||||
|
||||
// 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) {
|
||||
targetTimestamp, _ := strconv.ParseInt(c.Query("target_timestamp"), 10, 64)
|
||||
if targetTimestamp == 0 {
|
||||
|
||||
@@ -304,6 +304,8 @@ func SetApiRouter(router *gin.Engine) {
|
||||
}
|
||||
logRoute := apiRouter.Group("/log")
|
||||
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.GET("/stat", middleware.AdminAuth(), controller.GetLogsStat)
|
||||
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 type {
|
||||
ConfirmPaymentComplianceResponse,
|
||||
DeleteLogsResponse,
|
||||
FetchUpstreamRatiosRequest,
|
||||
LogCleanupTask,
|
||||
SystemOptionsResponse,
|
||||
@@ -48,13 +47,6 @@ export async function confirmPaymentCompliance() {
|
||||
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) {
|
||||
const res = await api.post<SystemTaskResponse<LogCleanupTask>>(
|
||||
'/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 SystemTask<
|
||||
|
||||
Reference in New Issue
Block a user