Browse Source

fix: shared base apis parameters correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
e3a76245c8
  1. 40
      packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts

40
packages/nocodb-nest/src/modules/shared-bases/shared-bases.controller.ts

@ -5,6 +5,9 @@ import {
Patch, Patch,
Post, Post,
UseGuards, UseGuards,
Request,
Body,
Param,
} from '@nestjs/common'; } from '@nestjs/common';
import { import {
Acl, Acl,
@ -20,28 +23,36 @@ export class SharedBasesController {
@Post('/api/v1/db/meta/projects/:projectId/shared') @Post('/api/v1/db/meta/projects/:projectId/shared')
@Acl('createSharedBaseLink') @Acl('createSharedBaseLink')
async createSharedBaseLink(req, res): Promise<any> { async createSharedBaseLink(
@Request() req,
@Body() body: any,
@Param('projectId') projectId: string,
): Promise<any> {
const sharedBase = await this.sharedBasesService.createSharedBaseLink({ const sharedBase = await this.sharedBasesService.createSharedBaseLink({
projectId: req.params.projectId, projectId: projectId,
roles: req.body?.roles, roles: body?.roles,
password: req.body?.password, password: body?.password,
siteUrl: req.ncSiteUrl, siteUrl: req.ncSiteUrl,
}); });
res.json(sharedBase); return sharedBase;
} }
@Patch('/api/v1/db/meta/projects/:projectId/shared') @Patch('/api/v1/db/meta/projects/:projectId/shared')
@Acl('updateSharedBaseLink') @Acl('updateSharedBaseLink')
async updateSharedBaseLink(req, res): Promise<any> { async updateSharedBaseLink(
@Request() req,
@Body() body: any,
@Param('projectId') projectId: string,
): Promise<any> {
const sharedBase = await this.sharedBasesService.updateSharedBaseLink({ const sharedBase = await this.sharedBasesService.updateSharedBaseLink({
projectId: req.params.projectId, projectId: projectId,
roles: req.body?.roles, roles: body?.roles,
password: req.body?.password, password: body?.password,
siteUrl: req.ncSiteUrl, siteUrl: req.ncSiteUrl,
}); });
res.json(sharedBase); return sharedBase;
} }
@Delete('/api/v1/db/meta/projects/:projectId/shared') @Delete('/api/v1/db/meta/projects/:projectId/shared')
@ -56,12 +67,15 @@ export class SharedBasesController {
@Get('/api/v1/db/meta/projects/:projectId/shared') @Get('/api/v1/db/meta/projects/:projectId/shared')
@Acl('getSharedBaseLink') @Acl('getSharedBaseLink')
async getSharedBaseLink(req, res): Promise<any> { async getSharedBaseLink(
@Request() req,
@Param('projectId') projectId: string,
): Promise<any> {
const sharedBase = await this.sharedBasesService.getSharedBaseLink({ const sharedBase = await this.sharedBasesService.getSharedBaseLink({
projectId: req.params.projectId, projectId: projectId,
siteUrl: req.ncSiteUrl, siteUrl: req.ncSiteUrl,
}); });
res.json(sharedBase); return sharedBase;
} }
} }

Loading…
Cancel
Save