mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
add name to createShare
This commit is contained in:
parent
1174ce89bc
commit
4a3190b2da
1 changed files with 5 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ export async function POST(request: Request) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
entityId: z.uuid(),
|
entityId: z.uuid(),
|
||||||
shareType: z.coerce.number().int(),
|
shareType: z.coerce.number().int(),
|
||||||
|
name: z.string().max(200),
|
||||||
slug: z.string().max(100).optional(),
|
slug: z.string().max(100).optional(),
|
||||||
parameters: anyObjectParam,
|
parameters: anyObjectParam,
|
||||||
});
|
});
|
||||||
|
|
@ -21,7 +22,8 @@ export async function POST(request: Request) {
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { entityId, shareType, slug, parameters } = body;
|
const { entityId, shareType, name, slug, parameters } = body;
|
||||||
|
const shareParameters = parameters ?? {};
|
||||||
|
|
||||||
if (!(await canUpdateEntity(auth, entityId))) {
|
if (!(await canUpdateEntity(auth, entityId))) {
|
||||||
return unauthorized();
|
return unauthorized();
|
||||||
|
|
@ -31,8 +33,9 @@ export async function POST(request: Request) {
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
entityId,
|
entityId,
|
||||||
shareType,
|
shareType,
|
||||||
|
name,
|
||||||
slug: slug || getRandomChars(16),
|
slug: slug || getRandomChars(16),
|
||||||
parameters,
|
parameters: shareParameters,
|
||||||
});
|
});
|
||||||
|
|
||||||
return json(share);
|
return json(share);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue