fix: remaining type issues

This commit is contained in:
DecDuck
2025-09-25 12:13:07 +10:00
parent 55878bdf5f
commit 4c9a2c681a
21 changed files with 120 additions and 136 deletions

View File

@ -2,11 +2,10 @@ import { type } from "arktype";
import { readDropValidatedBody, throwingArktype } from "~~/server/arktype";
import aclManager from "~~/server/internal/acls";
import taskHandler from "~~/server/internal/tasks";
import type { TaskGroup } from "~~/server/internal/tasks/group";
import { taskGroups } from "~~/server/internal/tasks/group";
import { TASK_GROUPS, type TaskGroup } from "~~/server/internal/tasks/group";
const StartTask = type({
taskGroup: type("string"),
taskGroup: type.enumerated(...TASK_GROUPS),
}).configure(throwingArktype);
export default defineEventHandler(async (h3) => {
@ -14,14 +13,8 @@ export default defineEventHandler(async (h3) => {
if (!allowed) throw createError({ statusCode: 403 });
const body = await readDropValidatedBody(h3, StartTask);
const taskGroup = body.taskGroup as TaskGroup;
if (!taskGroups[taskGroup])
throw createError({
statusCode: 400,
message: "Invalid task group.",
});
const task = await taskHandler.runTaskGroupByName(taskGroup);
const task = await taskHandler.runTaskGroupByName(body.taskGroup);
if (!task)
throw createError({
statusCode: 500,