mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-13 17:21:48 +02:00
Adjust validation to allow creation with (optional) path
This commit is contained in:
@@ -27,6 +27,7 @@ import { OpenAPITags, registry } from "@server/openApi";
|
|||||||
export const generateAccessTokenBodySchema = z.strictObject({
|
export const generateAccessTokenBodySchema = z.strictObject({
|
||||||
validForSeconds: z.int().positive().optional(), // seconds
|
validForSeconds: z.int().positive().optional(), // seconds
|
||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
|
path: z.string().optional(),
|
||||||
description: z.string().optional()
|
description: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ export async function generateAccessToken(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { resourceId } = parsedParams.data;
|
const { resourceId } = parsedParams.data;
|
||||||
const { validForSeconds, title, description } = parsedBody.data;
|
const { validForSeconds, title, path, description } = parsedBody.data;
|
||||||
|
|
||||||
const [resource] = await db
|
const [resource] = await db
|
||||||
.select()
|
.select()
|
||||||
@@ -121,6 +122,7 @@ export async function generateAccessToken(
|
|||||||
expiresAt: expiresAt || null,
|
expiresAt: expiresAt || null,
|
||||||
sessionLength: sessionLength,
|
sessionLength: sessionLength,
|
||||||
title: title || null,
|
title: title || null,
|
||||||
|
path: path || null,
|
||||||
description: description || null,
|
description: description || null,
|
||||||
createdAt: new Date().getTime()
|
createdAt: new Date().getTime()
|
||||||
})
|
})
|
||||||
@@ -131,6 +133,7 @@ export async function generateAccessToken(
|
|||||||
expiresAt: resourceAccessToken.expiresAt,
|
expiresAt: resourceAccessToken.expiresAt,
|
||||||
sessionLength: resourceAccessToken.sessionLength,
|
sessionLength: resourceAccessToken.sessionLength,
|
||||||
title: resourceAccessToken.title,
|
title: resourceAccessToken.title,
|
||||||
|
path: resourceAccessToken.path,
|
||||||
description: resourceAccessToken.description,
|
description: resourceAccessToken.description,
|
||||||
createdAt: resourceAccessToken.createdAt
|
createdAt: resourceAccessToken.createdAt
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -306,11 +306,13 @@ export default function CreateShareLinkForm({
|
|||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="path"
|
name="title"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
{t("sharePathOptional")}
|
{t(
|
||||||
|
"shareTitleOptional"
|
||||||
|
)}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
@@ -322,13 +324,11 @@ export default function CreateShareLinkForm({
|
|||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="title"
|
name="path"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
{t(
|
{t("sharePathOptional")}
|
||||||
"shareTitleOptional"
|
|
||||||
)}
|
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
|
|||||||
Reference in New Issue
Block a user