feat: validate team slug format and improve error handling in team creation

This commit is contained in:
2026-07-11 13:15:53 +08:00
parent acf7ae0cd7
commit 9c33a4e9b9
3 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export async function registerTeamsRoutes(
const { orgSlug } = request.params as { orgSlug: string };
const auth = await requireOrgRole(request, reply, guardDeps, { orgSlug });
if (auth === null) return;
const body = request.body as { slug?: unknown; name?: unknown; description?: unknown };
const body = (request.body ?? {}) as { slug?: unknown; name?: unknown; description?: unknown };
if (typeof body.slug !== "string" || typeof body.name !== "string") {
return reply.status(400).send({
error: { code: "bad_request", message: "slug and name are required" },