From 6d93b57d25e90051b58e7455a54416e0774f6518 Mon Sep 17 00:00:00 2001 From: Ankit Singh Tomar Date: Thu, 25 Jan 2024 12:14:58 +0530 Subject: [PATCH] add customUserId to add website of any user by admin --- src/pages/api/websites/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/api/websites/index.ts b/src/pages/api/websites/index.ts index b30681cfc..49c0b3e67 100644 --- a/src/pages/api/websites/index.ts +++ b/src/pages/api/websites/index.ts @@ -15,6 +15,7 @@ export interface WebsitesRequestBody { name: string; domain: string; shareId: string; + customUserId:string } const schema = { @@ -25,6 +26,7 @@ const schema = { name: yup.string().max(100).required(), domain: yup.string().max(500).required(), shareId: yup.string().max(50).nullable(), + customUserId: yup.string().max(50).nullable(), }), }; @@ -53,7 +55,7 @@ export default async ( } if (req.method === 'POST') { - const { name, domain, shareId } = req.body; + const { name, domain, shareId ,customUserId} = req.body; if (!(await canCreateWebsite(req.auth))) { return unauthorized(res); @@ -65,11 +67,11 @@ export default async ( domain, shareId, }; - data.userId = userId; - + if(customUserId){ + data.userId = customUserId; + } const website = await createWebsite(data); - return ok(res, website); }