add name to createShare
This commit is contained in:
1 parent
1174ce89bc
commit
4a3190b2da
1 file changed
+5
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user