fix: add horizontal scroll to benchmarks table, add hard delete functionality

- Wrap table in overflow-x-auto container with min-w-[800px] to prevent overflow on smaller screens
- Add hard delete (purge) button to actions column for each benchmark entry
- Add confirmation dialog for permanent deletion with warning
- Add handleHardDelete handler that calls DELETE /api/admin/performance/:id/hard-delete
- Add DELETE endpoint for hard-deleting performance entries from the database
- Expand confirmAction state type to include 'hardDelete'
This commit is contained in:
2026-04-29 01:38:29 +08:00
parent 2fed5a3964
commit b64e55157e
2 changed files with 90 additions and 2 deletions
+30
View File
@@ -226,6 +226,36 @@ export const adminPerformanceRoutes = new Elysia({ prefix: "/admin" })
),
},
)
.delete(
"/performance/:id/hard-delete",
async ({ params, request, set }) => {
const guard = await requireAdmin(request.headers)
if (!guard.ok) {
set.status = guard.status
return { error: guard.error }
}
const [entry] = await db
.select()
.from(performanceEntries)
.where(eq(performanceEntries.id, params.id))
.limit(1)
if (!entry) {
set.status = 404
return { error: "Performance entry not found" }
}
await db
.delete(performanceEntries)
.where(eq(performanceEntries.id, params.id))
return { success: true }
},
{
params: t.Object({ id: t.String() }),
},
)
.patch(
"/performance/:id/restore",
async ({ params, request, set }) => {