mirror of
https://github.com/umami-software/umami.git
synced 2026-02-03 20:27:13 +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({
|
||||
entityId: z.uuid(),
|
||||
shareType: z.coerce.number().int(),
|
||||
name: z.string().max(200),
|
||||
slug: z.string().max(100).optional(),
|
||||
parameters: anyObjectParam,
|
||||
});
|
||||
|
|
@ -21,7 +22,8 @@ export async function POST(request: Request) {
|
|||
return error();
|
||||
}
|
||||
|
||||
const { entityId, shareType, slug, parameters } = body;
|
||||
const { entityId, shareType, name, slug, parameters } = body;
|
||||
const shareParameters = parameters ?? {};
|
||||
|
||||
if (!(await canUpdateEntity(auth, entityId))) {
|
||||
return unauthorized();
|
||||
|
|
@ -31,8 +33,9 @@ export async function POST(request: Request) {
|
|||
id: uuid(),
|
||||
entityId,
|
||||
shareType,
|
||||
name,
|
||||
slug: slug || getRandomChars(16),
|
||||
parameters,
|
||||
parameters: shareParameters,
|
||||
});
|
||||
|
||||
return json(share);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue