diff --git a/packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts b/packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts index 365be5ef36..f0b753005f 100644 --- a/packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts +++ b/packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts @@ -5,6 +5,9 @@ import { Patch, Post, UseGuards, + Request, + Body, + Param, } from '@nestjs/common'; import { Acl, @@ -20,28 +23,36 @@ export class SharedBasesController { @Post('/api/v1/db/meta/projects/:projectId/shared') @Acl('createSharedBaseLink') - async createSharedBaseLink(req, res): Promise { + async createSharedBaseLink( + @Request() req, + @Body() body: any, + @Param('projectId') projectId: string, + ): Promise { const sharedBase = await this.sharedBasesService.createSharedBaseLink({ - projectId: req.params.projectId, - roles: req.body?.roles, - password: req.body?.password, + projectId: projectId, + roles: body?.roles, + password: body?.password, siteUrl: req.ncSiteUrl, }); - res.json(sharedBase); + return sharedBase; } @Patch('/api/v1/db/meta/projects/:projectId/shared') @Acl('updateSharedBaseLink') - async updateSharedBaseLink(req, res): Promise { + async updateSharedBaseLink( + @Request() req, + @Body() body: any, + @Param('projectId') projectId: string, + ): Promise { const sharedBase = await this.sharedBasesService.updateSharedBaseLink({ - projectId: req.params.projectId, - roles: req.body?.roles, - password: req.body?.password, + projectId: projectId, + roles: body?.roles, + password: body?.password, siteUrl: req.ncSiteUrl, }); - res.json(sharedBase); + return sharedBase; } @Delete('/api/v1/db/meta/projects/:projectId/shared') @@ -56,12 +67,15 @@ export class SharedBasesController { @Get('/api/v1/db/meta/projects/:projectId/shared') @Acl('getSharedBaseLink') - async getSharedBaseLink(req, res): Promise { + async getSharedBaseLink( + @Request() req, + @Param('projectId') projectId: string, + ): Promise { const sharedBase = await this.sharedBasesService.getSharedBaseLink({ - projectId: req.params.projectId, + projectId: projectId, siteUrl: req.ncSiteUrl, }); - res.json(sharedBase); + return sharedBase; } }