Adjust validation to allow creation with (optional) path

This commit is contained in:
NHClaessens
2026-02-08 20:23:05 +01:00
committed by Owen
parent a9b0bd8b47
commit b84a7996a9
2 changed files with 10 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ import { OpenAPITags, registry } from "@server/openApi";
export const generateAccessTokenBodySchema = z.strictObject({
validForSeconds: z.int().positive().optional(), // seconds
title: z.string().optional(),
path: z.string().optional(),
description: z.string().optional()
});
@@ -85,7 +86,7 @@ export async function generateAccessToken(
}
const { resourceId } = parsedParams.data;
const { validForSeconds, title, description } = parsedBody.data;
const { validForSeconds, title, path, description } = parsedBody.data;
const [resource] = await db
.select()
@@ -121,6 +122,7 @@ export async function generateAccessToken(
expiresAt: expiresAt || null,
sessionLength: sessionLength,
title: title || null,
path: path || null,
description: description || null,
createdAt: new Date().getTime()
})
@@ -131,6 +133,7 @@ export async function generateAccessToken(
expiresAt: resourceAccessToken.expiresAt,
sessionLength: resourceAccessToken.sessionLength,
title: resourceAccessToken.title,
path: resourceAccessToken.path,
description: resourceAccessToken.description,
createdAt: resourceAccessToken.createdAt
})