同步异常兜底
This commit is contained in:
1 parent
9cb8552a99
commit
a1b4a63552
20 files changed
+754
-54
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { requireSiteSyncAuth } from '../../utils/access'
|
||||
import { createApiError } from '../../utils/api-error'
|
||||
import { cleanupSiteSyncJobArtifacts } from '../../utils/site-sync/artifacts'
|
||||
|
||||
interface Body {
|
||||
jobId?: string
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
await requireSiteSyncAuth(event)
|
||||
const body = await readBody<Body>(event).catch(() => null)
|
||||
const jobId = body?.jobId?.trim() ?? ''
|
||||
if (!jobId || jobId.length > 128) {
|
||||
createApiError(event, 'INVALID_REQUEST', '缺少同步任务 ID', 400)
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
...await cleanupSiteSyncJobArtifacts(jobId)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user