Browse Source

chore: lint

pull/6894/head
Pranav C 1 year ago
parent
commit
117f37d8a1
  1. 4
      packages/nocodb/src/controllers/api-tokens.controller.ts
  2. 4
      packages/nocodb/src/controllers/attachments-secure.controller.ts
  3. 11
      packages/nocodb/src/controllers/attachments.controller.ts
  4. 4
      packages/nocodb/src/controllers/bases.controller.ts
  5. 7
      packages/nocodb/src/controllers/filters.controller.ts
  6. 11
      packages/nocodb/src/controllers/form-columns.controller.ts
  7. 13
      packages/nocodb/src/controllers/forms.controller.ts
  8. 2
      packages/nocodb/src/controllers/galleries.controller.ts
  9. 12
      packages/nocodb/src/controllers/grid-columns.controller.ts
  10. 4
      packages/nocodb/src/controllers/kanbans.controller.ts
  11. 4
      packages/nocodb/src/controllers/maps.controller.ts
  12. 4
      packages/nocodb/src/controllers/model-visibilities.controller.ts
  13. 4
      packages/nocodb/src/controllers/org-tokens.controller.ts
  14. 14
      packages/nocodb/src/controllers/plugins.controller.ts
  15. 12
      packages/nocodb/src/controllers/shared-bases.controller.ts
  16. 6
      packages/nocodb/src/controllers/sorts.controller.ts
  17. 12
      packages/nocodb/src/controllers/sources.controller.ts
  18. 15
      packages/nocodb/src/controllers/sync.controller.ts
  19. 2
      packages/nocodb/src/controllers/tables.controller.ts
  20. 14
      packages/nocodb/src/controllers/view-columns.controller.ts
  21. 12
      packages/nocodb/src/controllers/views.controller.ts
  22. 26
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  23. 4
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts
  24. 4
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.processor.ts
  25. 37
      packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts
  26. 7
      packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts
  27. 2
      packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts
  28. 12
      packages/nocodb/src/services/api-tokens.service.ts
  29. 2
      packages/nocodb/src/services/bases.service.ts
  30. 8
      packages/nocodb/src/services/forms.service.ts
  31. 2
      packages/nocodb/src/services/grid-columns.service.ts
  32. 12
      packages/nocodb/src/services/grids.service.ts
  33. 16
      packages/nocodb/src/services/hooks.service.ts
  34. 4
      packages/nocodb/src/services/kanbans.service.ts
  35. 6
      packages/nocodb/src/services/maps.service.ts
  36. 6
      packages/nocodb/src/services/meta-diffs.service.ts
  37. 15
      packages/nocodb/src/services/notifications.service.ts
  38. 10
      packages/nocodb/src/services/org-tokens.service.ts
  39. 12
      packages/nocodb/src/services/plugins.service.ts
  40. 11
      packages/nocodb/src/services/shared-bases.service.ts
  41. 16
      packages/nocodb/src/services/sorts.service.ts
  42. 2
      packages/nocodb/src/services/sources.service.ts
  43. 10
      packages/nocodb/src/services/sync.service.ts
  44. 8
      packages/nocodb/src/services/users/users.service.ts
  45. 12
      packages/nocodb/src/services/view-columns.service.ts
  46. 16
      packages/nocodb/src/services/views.service.ts

4
packages/nocodb/src/controllers/api-tokens.controller.ts

@ -41,7 +41,7 @@ export class ApiTokensController {
return await this.apiTokensService.apiTokenCreate({
tokenBody: body,
userId: req['user'].id,
req
req,
});
}
@ -54,7 +54,7 @@ export class ApiTokensController {
return await this.apiTokensService.apiTokenDelete({
token,
user: req['user'],
req
req,
});
}
}

4
packages/nocodb/src/controllers/attachments-secure.controller.ts

@ -41,7 +41,7 @@ export class AttachmentsSecureController {
const attachments = await this.attachmentsService.upload({
files: files,
path: path,
req
req,
});
return attachments;
@ -60,7 +60,7 @@ export class AttachmentsSecureController {
const attachments = await this.attachmentsService.uploadViaURL({
urls: body,
path,
req
req,
});
return attachments;

11
packages/nocodb/src/controllers/attachments.controller.ts

@ -37,7 +37,7 @@ export class AttachmentsController {
const attachments = await this.attachmentsService.upload({
files: files,
path: req.query?.path as string,
req
req,
});
return attachments;
@ -47,12 +47,15 @@ export class AttachmentsController {
@HttpCode(200)
@UseInterceptors(UploadAllowedInterceptor)
@UseGuards(MetaApiLimiterGuard, GlobalGuard)
async uploadViaURL(@Body() body: any, @Query('path') path: string,
@Request() req: any,) {
async uploadViaURL(
@Body() body: any,
@Query('path') path: string,
@Request() req: any,
) {
const attachments = await this.attachmentsService.uploadViaURL({
urls: body,
path,
req
req,
});
return attachments;

4
packages/nocodb/src/controllers/bases.controller.ts

@ -82,7 +82,7 @@ export class BasesController {
baseId,
base: body,
user: req.user,
req
req,
});
return base;
@ -94,7 +94,7 @@ export class BasesController {
const deleted = await this.projectsService.baseSoftDelete({
baseId,
user: req.user,
req
req,
});
return deleted;

7
packages/nocodb/src/controllers/filters.controller.ts

@ -50,7 +50,7 @@ export class FiltersController {
filter: body,
viewId: viewId,
user: req.user,
req
req,
});
return filter;
}
@ -70,7 +70,7 @@ export class FiltersController {
filter: body,
hookId,
user: req.user,
req
req,
});
return filter;
}
@ -107,7 +107,8 @@ export class FiltersController {
const filter = await this.filtersService.filterUpdate({
filterId: filterId,
filter: body,
user: req.user,req
user: req.user,
req,
});
return filter;
}

11
packages/nocodb/src/controllers/form-columns.controller.ts

@ -1,4 +1,11 @@
import { Body, Controller, Param, Patch, UseGuards , Request} from '@nestjs/common';
import {
Body,
Controller,
Param,
Patch,
Request,
UseGuards,
} from '@nestjs/common';
import { GlobalGuard } from '~/guards/global/global.guard';
import { FormColumnsService } from '~/services/form-columns.service';
import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware';
@ -25,7 +32,7 @@ export class FormColumnsController {
return await this.formColumnsService.columnUpdate({
formViewColumnId,
formViewColumn: formViewColumnbody,
req
req,
});
}
}

13
packages/nocodb/src/controllers/forms.controller.ts

@ -6,8 +6,8 @@ import {
Param,
Patch,
Post,
Request,
Req,
Request,
UseGuards,
} from '@nestjs/common';
import { ViewCreateReqType } from 'nocodb-sdk';
@ -45,7 +45,7 @@ export class FormsController {
body,
tableId,
user: req.user,
req
req,
});
return view;
}
@ -54,12 +54,15 @@ export class FormsController {
'/api/v2/meta/forms/:formViewId',
])
@Acl('formViewUpdate')
async formViewUpdate(@Param('formViewId') formViewId: string, @Body() body,
@Request() req: any,) {
async formViewUpdate(
@Param('formViewId') formViewId: string,
@Body() body,
@Request() req: any,
) {
return await this.formsService.formViewUpdate({
formViewId,
form: body,
req
req,
});
}
}

2
packages/nocodb/src/controllers/galleries.controller.ts

@ -65,7 +65,7 @@ export class GalleriesController {
return await this.galleriesService.galleryViewUpdate({
galleryViewId,
gallery: body,
req
req,
});
}
}

12
packages/nocodb/src/controllers/grid-columns.controller.ts

@ -1,4 +1,12 @@
import { Body, Controller, Get,Req, Param, Patch, UseGuards } from '@nestjs/common';
import {
Body,
Controller,
Get,
Param,
Patch,
Req,
UseGuards,
} from '@nestjs/common';
import { GridColumnReqType } from 'nocodb-sdk';
import { GlobalGuard } from '~/guards/global/global.guard';
import { GridColumnsService } from '~/services/grid-columns.service';
@ -34,7 +42,7 @@ export class GridColumnsController {
return this.gridColumnsService.gridColumnUpdate({
gridViewColumnId,
grid: body,
req
req,
});
}
}

4
packages/nocodb/src/controllers/kanbans.controller.ts

@ -46,7 +46,7 @@ export class KanbansController {
tableId,
kanban: body,
user: req.user,
req
req,
});
}
@ -64,7 +64,7 @@ export class KanbansController {
return await this.kanbansService.kanbanViewUpdate({
kanbanViewId,
kanban: body,
req
req,
});
}
}

4
packages/nocodb/src/controllers/maps.controller.ts

@ -41,7 +41,7 @@ export class MapsController {
tableId,
map: body,
user: req.user,
req
req,
});
return view;
}
@ -57,7 +57,7 @@ export class MapsController {
return await this.mapsService.mapViewUpdate({
mapViewId: mapViewId,
map: body,
req
req,
});
}
}

4
packages/nocodb/src/controllers/model-visibilities.controller.ts

@ -2,11 +2,11 @@ import {
Body,
Controller,
Get,
Req,
HttpCode,
Param,
Post,
Query,
Req,
UseGuards,
} from '@nestjs/common';
import { GlobalGuard } from '~/guards/global/global.guard';
@ -35,7 +35,7 @@ export class ModelVisibilitiesController {
await this.modelVisibilitiesService.xcVisibilityMetaSetAll({
visibilityRule: body,
baseId,
req
req,
});
return { msg: 'UI ACL has been created successfully' };

4
packages/nocodb/src/controllers/org-tokens.controller.ts

@ -50,7 +50,7 @@ export class OrgTokensController {
return await this.orgTokensService.apiTokenCreate({
apiToken: body,
user: req['user'],
req
req,
});
}
@ -64,7 +64,7 @@ export class OrgTokensController {
await this.orgTokensService.apiTokenDelete({
token,
user: req['user'],
req
req,
});
}
}

14
packages/nocodb/src/controllers/plugins.controller.ts

@ -5,8 +5,8 @@ import {
HttpCode,
Param,
Patch,
Req,
Post,
Req,
UseGuards,
} from '@nestjs/common';
import { GlobalGuard } from '~/guards/global/global.guard';
@ -48,8 +48,7 @@ export class PluginsController {
@Acl('pluginTest', {
scope: 'org',
})
async pluginTest(@Body() body: any,
@Req() req: any,) {
async pluginTest(@Body() body: any, @Req() req: any) {
return await this.pluginsService.pluginTest({ body: body, req });
}
@ -68,12 +67,15 @@ export class PluginsController {
@Acl('pluginUpdate', {
scope: 'org',
})
async pluginUpdate(@Body() body: any, @Param('pluginId') pluginId: string,
@Req() req: any,) {
async pluginUpdate(
@Body() body: any,
@Param('pluginId') pluginId: string,
@Req() req: any,
) {
const plugin = await this.pluginsService.pluginUpdate({
pluginId: pluginId,
plugin: body,
req
req,
});
return plugin;
}

12
packages/nocodb/src/controllers/shared-bases.controller.ts

@ -36,7 +36,7 @@ export class SharedBasesController {
roles: body?.roles,
password: body?.password,
siteUrl: req.ncSiteUrl,
req
req,
});
return sharedBase;
@ -57,7 +57,7 @@ export class SharedBasesController {
roles: body?.roles,
password: body?.password,
siteUrl: req.ncSiteUrl,
req
req,
});
return sharedBase;
@ -68,11 +68,13 @@ export class SharedBasesController {
'/api/v2/meta/bases/:baseId/shared',
])
@Acl('disableSharedBaseLink')
async disableSharedBaseLink(@Param('baseId') baseId: string,
@Request() req: any,): Promise<any> {
async disableSharedBaseLink(
@Param('baseId') baseId: string,
@Request() req: any,
): Promise<any> {
const sharedBase = await this.sharedBasesService.disableSharedBaseLink({
baseId,
req
req,
});
return sharedBase;

6
packages/nocodb/src/controllers/sorts.controller.ts

@ -49,7 +49,7 @@ export class SortsController {
const sort = await this.sortsService.sortCreate({
sort: body,
viewId,
req
req,
});
return sort;
}
@ -73,7 +73,7 @@ export class SortsController {
const sort = await this.sortsService.sortUpdate({
sortId,
sort: body,
req
req,
});
return sort;
}
@ -83,7 +83,7 @@ export class SortsController {
async sortDelete(@Param('sortId') sortId: string, @Req() req) {
const sort = await this.sortsService.sortDelete({
sortId,
req
req,
});
return sort;
}

12
packages/nocodb/src/controllers/sources.controller.ts

@ -1,4 +1,12 @@
import { Body, Controller, Get,Request, Param, Patch, UseGuards } from '@nestjs/common';
import {
Body,
Controller,
Get,
Param,
Patch,
Request,
UseGuards,
} from '@nestjs/common';
import { BaseReqType } from 'nocodb-sdk';
import { GlobalGuard } from '~/guards/global/global.guard';
import { PagedResponseImpl } from '~/helpers/PagedResponse';
@ -43,7 +51,7 @@ export class SourcesController {
sourceId,
source: body,
baseId,
req
req,
});
return source;

15
packages/nocodb/src/controllers/sync.controller.ts

@ -56,27 +56,30 @@ export class SyncController {
sourceId: sourceId,
userId: (req as any).user.id,
syncPayload: body,
req
req,
});
}
@Delete(['/api/v1/db/meta/syncs/:syncId', '/api/v2/meta/syncs/:syncId'])
@Acl('syncSourceDelete')
async syncDelete(@Param('syncId') syncId: string,@Req() req: any) {
async syncDelete(@Param('syncId') syncId: string, @Req() req: any) {
return await this.syncService.syncDelete({
syncId: syncId,
req
req,
});
}
@Patch(['/api/v1/db/meta/syncs/:syncId', '/api/v2/meta/syncs/:syncId'])
@Acl('syncSourceUpdate')
async syncUpdate(@Param('syncId') syncId: string, @Body() body: any,
@Req() req: any,) {
async syncUpdate(
@Param('syncId') syncId: string,
@Body() body: any,
@Req() req: any,
) {
return await this.syncService.syncUpdate({
syncId: syncId,
syncPayload: body,
req
req,
});
}
}

2
packages/nocodb/src/controllers/tables.controller.ts

@ -93,7 +93,7 @@ export class TablesController {
table: body,
baseId: req.ncProjectId,
user: req.ncProjectId,
req
req,
});
return { msg: 'The table has been updated successfully' };
}

14
packages/nocodb/src/controllers/view-columns.controller.ts

@ -5,7 +5,8 @@ import {
HttpCode,
Param,
Patch,
Post, Req,
Post,
Req,
UseGuards,
} from '@nestjs/common';
import { ViewColumnReqType } from 'nocodb-sdk';
@ -41,11 +42,13 @@ export class ViewColumnsController {
@Acl('columnAdd')
async columnAdd(
@Param('viewId') viewId: string,
@Body() body: ViewColumnReqType,@Req() req: any
@Body() body: ViewColumnReqType,
@Req() req: any,
) {
const viewColumn = await this.viewColumnsService.columnAdd({
viewId,
column: body,req
column: body,
req,
});
return viewColumn;
}
@ -58,13 +61,14 @@ export class ViewColumnsController {
async columnUpdate(
@Param('viewId') viewId: string,
@Param('columnId') columnId: string,
@Body() body: ViewColumnReqType,@Req() req: any
@Body() body: ViewColumnReqType,
@Req() req: any,
) {
const result = await this.viewColumnsService.columnUpdate({
viewId,
columnId,
column: body,
req
req,
});
return result;
}

12
packages/nocodb/src/controllers/views.controller.ts

@ -48,7 +48,7 @@ export class ViewsController {
viewId,
view: body,
user: req.user,
req
req,
});
return result;
}
@ -59,7 +59,7 @@ export class ViewsController {
const result = await this.viewsService.viewDelete({
viewId,
user: req.user,
req
req,
});
return result;
}
@ -132,7 +132,7 @@ export class ViewsController {
viewId,
sharedView: body,
user: req.user,
req
req,
});
}
@ -142,6 +142,10 @@ export class ViewsController {
])
@Acl('shareViewDelete')
async shareViewDelete(@Param('viewId') viewId: string, @Request() req) {
return await this.viewsService.shareViewDelete({ viewId, user: req.user , req});
return await this.viewsService.shareViewDelete({
viewId,
user: req.user,
req,
});
}
}

26
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -680,7 +680,7 @@ export class AtImportProcessor {
viewId: view.list[0].id,
view: { title: aTbl_grid.name },
user: syncDB.user,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbView.update');
@ -1527,8 +1527,8 @@ export class AtImportProcessor {
url: attachment.url,
size: attachment.size,
mimetype: attachment.type,
})), req:{}
})),
req: {},
});
} catch (e) {
console.log(e);
@ -1571,7 +1571,7 @@ export class AtImportProcessor {
ncCreatedProjectSchema = await this.basesService.baseCreate({
base: { title: projName },
user: { id: syncDB.user.id },
req:{}
req: {},
});
recordPerfStats(_perfStart, 'base.create');
@ -1622,7 +1622,7 @@ export class AtImportProcessor {
title: viewName,
},
user: syncDB.user,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbView.galleryCreate');
@ -1689,7 +1689,7 @@ export class AtImportProcessor {
tableId: tblId,
body: formData,
user: syncDB.user,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbView.formCreate');
@ -1769,7 +1769,7 @@ export class AtImportProcessor {
grid: {
title: viewName,
},
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbView.gridCreate');
@ -2146,7 +2146,7 @@ export class AtImportProcessor {
viewId: viewId,
filter: ncFilters[i],
user: syncDB.user,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbTableFilter.create');
@ -2225,7 +2225,7 @@ export class AtImportProcessor {
group_by_sort:
ncGroup[i].direction === 'ascending' ? 'asc' : 'desc',
},
req:{}
req: {},
});
} catch (e) {
// ignore
@ -2247,7 +2247,7 @@ export class AtImportProcessor {
fk_column_id: columnId,
direction: s.sortSet[i].ascending ? 'asc' : 'desc',
},
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbTableSort.create');
}
@ -2312,7 +2312,7 @@ export class AtImportProcessor {
show: false,
order: j + 1 + c.length,
},
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbViewColumn.update');
}
@ -2340,7 +2340,7 @@ export class AtImportProcessor {
await this.formColumnsService.columnUpdate({
formViewColumnId: ncViewColumnId,
formViewColumn: formData,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbView.formColumnUpdate');
}
@ -2350,7 +2350,7 @@ export class AtImportProcessor {
viewId: viewId,
columnId: ncViewColumnId,
column: configData,
req:{}
req: {},
});
recordPerfStats(_perfStart, 'dbViewColumn.update');
}

4
packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts

@ -72,7 +72,7 @@ export class DuplicateController {
...(body.base || {}),
},
user: { id: req.user.id },
req
req,
});
const job = await this.jobsService.add(JobTypes.DuplicateBase, {
@ -142,7 +142,7 @@ export class DuplicateController {
...(body.base || {}),
},
user: { id: req.user.id },
req
req,
});
const job = await this.jobsService.add(JobTypes.DuplicateBase, {

4
packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.processor.ts

@ -104,14 +104,14 @@ export class DuplicateProcessor {
status: null,
},
user: req.user,
req
req,
});
} catch (e) {
if (dupProject?.id) {
await this.projectsService.baseSoftDelete({
baseId: dupProject.id,
user: req.user,
req
req,
});
}
throw e;

37
packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts

@ -901,7 +901,7 @@ export class ImportService {
fk_parent_id: getIdOrExternalId(fl.fk_parent_id),
}),
user: param.user,
req:{}
req: {},
});
idMap.set(fl.id, fg.id);
@ -915,7 +915,7 @@ export class ImportService {
...sr,
fk_column_id: getIdOrExternalId(sr.fk_column_id),
}),
req:{}
req: {},
});
}
@ -934,9 +934,9 @@ export class ImportService {
columnId: cl.id,
column: {
show: fcl.show,
order: fcl.order
order: fcl.order,
},
req:{}
req: {},
});
}
@ -953,7 +953,7 @@ export class ImportService {
grid: {
...withoutNull(rest),
},
req:{}
req: {},
});
}
break;
@ -969,7 +969,7 @@ export class ImportService {
formViewColumn: {
...withoutNull(rest),
},
req:{}
req: {},
});
}
break;
@ -986,7 +986,7 @@ export class ImportService {
order: view.order,
},
user: param.user,
req:{}
req: {},
});
}
}
@ -1014,7 +1014,7 @@ export class ImportService {
hook: {
...hookData,
},
req:{}
req: {},
});
if (!hk) continue;
@ -1031,7 +1031,7 @@ export class ImportService {
fk_parent_id: getIdOrExternalId(fl.fk_parent_id),
}),
user: param.user,
req:{}
req: {},
});
idMap.set(fl.id, fg.id);
@ -1059,7 +1059,7 @@ export class ImportService {
await this.gridsService.gridViewUpdate({
viewId: view.id,
grid: gridData,
req:{}
req: {},
});
}
}
@ -1071,14 +1071,14 @@ export class ImportService {
const gview = await this.gridsService.gridViewCreate({
tableId: md.id,
grid: vw as ViewCreateReqType,
req:{}
req: {},
});
const gridData = withoutNull(vw.view);
if (gridData) {
await this.gridsService.gridViewUpdate({
viewId: gview.id,
grid: gridData,
req:{}
req: {},
});
}
return gview;
@ -1088,14 +1088,14 @@ export class ImportService {
tableId: md.id,
body: vw as ViewCreateReqType,
user,
req:{}
req: {},
});
const formData = withoutNull(vw.view);
if (formData) {
await this.formsService.formViewUpdate({
formViewId: fview.id,
form: formData,
req:{}
req: {},
});
}
return fview;
@ -1104,7 +1104,8 @@ export class ImportService {
const glview = await this.galleriesService.galleryViewCreate({
tableId: md.id,
gallery: vw as ViewCreateReqType,
user,req:{}
user,
req: {},
});
const galleryData = withoutNull(vw.view);
if (galleryData) {
@ -1118,7 +1119,7 @@ export class ImportService {
await this.galleriesService.galleryViewUpdate({
galleryViewId: glview.id,
gallery: galleryData,
req:{}
req: {},
});
}
return glview;
@ -1128,7 +1129,7 @@ export class ImportService {
tableId: md.id,
kanban: vw as ViewCreateReqType,
user,
req: {}
req: {},
});
const kanbanData = withoutNull(vw.view);
if (kanbanData) {
@ -1174,7 +1175,7 @@ export class ImportService {
await this.kanbansService.kanbanViewUpdate({
kanbanViewId: kview.id,
kanban: kanbanData,
req: {}
req: {},
});
}
return kview;

7
packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts

@ -21,12 +21,15 @@ export class MetaSyncProcessor {
} = job.data;
if (info.sourceId === 'all') {
await this.metaDiffsService.metaDiffSync({ baseId: info.baseId, req: {} });
await this.metaDiffsService.metaDiffSync({
baseId: info.baseId,
req: {},
});
} else {
await this.metaDiffsService.baseMetaDiffSync({
baseId: info.baseId,
sourceId: info.sourceId,
req: {}
req: {},
});
}

2
packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts

@ -18,7 +18,7 @@ export class SourceDeleteProcessor {
await this.sourcesService.baseDelete({
sourceId,
req: {}
req: {},
});
this.debugLog(`job completed for ${job.id}`);

12
packages/nocodb/src/services/api-tokens.service.ts

@ -14,7 +14,11 @@ export class ApiTokensService {
async apiTokenList(param: { userId: string }) {
return await ApiToken.list(param.userId);
}
async apiTokenCreate(param: { userId: string; tokenBody: ApiTokenReqType; req:any }) {
async apiTokenCreate(param: {
userId: string;
tokenBody: ApiTokenReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/ApiTokenReq',
param.tokenBody,
@ -23,7 +27,7 @@ export class ApiTokensService {
this.appHooksService.emit(AppEvents.API_TOKEN_CREATE, {
userId: param.userId,
tokenBody: param.tokenBody,
req: param.req
req: param.req,
});
return await ApiToken.insert({
@ -32,7 +36,7 @@ export class ApiTokensService {
});
}
async apiTokenDelete(param: { token; user: User; req:any }) {
async apiTokenDelete(param: { token; user: User; req: any }) {
const apiToken = await ApiToken.getByToken(param.token);
if (
!extractRolesObj(param.user.roles)[OrgUserRoles.SUPER_ADMIN] &&
@ -44,7 +48,7 @@ export class ApiTokensService {
this.appHooksService.emit(AppEvents.API_TOKEN_DELETE, {
userId: param.user?.id,
token: param.token,
req:param.req
req: param.req,
});
// todo: verify token belongs to the user

2
packages/nocodb/src/services/bases.service.ts

@ -63,7 +63,7 @@ export class BasesService {
baseId: string;
base: ProjectUpdateReqType;
user: UserType;
req:any
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/ProjectUpdateReq',

8
packages/nocodb/src/services/forms.service.ts

@ -52,7 +52,11 @@ export class FormsService {
return view;
}
async formViewUpdate(param: { formViewId: string; form: FormUpdateReqType; req: any }) {
async formViewUpdate(param: {
formViewId: string;
form: FormUpdateReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/FormUpdateReq',
param.form,
@ -68,7 +72,7 @@ export class FormsService {
this.appHooksService.emit(AppEvents.VIEW_UPDATE, {
view,
showAs: 'form',
req: param.req
req: param.req,
});
return res;

2
packages/nocodb/src/services/grid-columns.service.ts

@ -26,7 +26,7 @@ export class GridColumnsService {
const res = await GridViewColumn.update(param.gridViewColumnId, param.grid);
this.appHooksService.emit(AppEvents.GRID_COLUMN_UPDATE, {
req: param.req
req: param.req,
});
return res;

12
packages/nocodb/src/services/grids.service.ts

@ -10,7 +10,11 @@ import { GridView, View } from '~/models';
export class GridsService {
constructor(private readonly appHooksService: AppHooksService) {}
async gridViewCreate(param: { tableId: string; grid: ViewCreateReqType; req:any}) {
async gridViewCreate(param: {
tableId: string;
grid: ViewCreateReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/ViewCreateReq',
param.grid,
@ -32,7 +36,11 @@ export class GridsService {
return view;
}
async gridViewUpdate(param: { viewId: string; grid: GridUpdateReqType; req: any }) {
async gridViewUpdate(param: {
viewId: string;
grid: GridUpdateReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/GridUpdateReq',
param.grid,

16
packages/nocodb/src/services/hooks.service.ts

@ -37,9 +37,7 @@ export class HooksService {
return await HookLog.list({ fk_hook_id: param.hookId }, param.query);
}
async hookCreate(param: { tableId: string; hook: HookReqType;
req: any
}) {
async hookCreate(param: { tableId: string; hook: HookReqType; req: any }) {
validatePayload('swagger.json#/components/schemas/HookReq', param.hook);
this.validateHookPayload(param.hook.notification);
@ -57,9 +55,7 @@ export class HooksService {
return hook;
}
async hookDelete(param: { hookId: string
req: any
}) {
async hookDelete(param: { hookId: string; req: any }) {
const hook = await Hook.get(param.hookId);
if (!hook) {
@ -74,7 +70,7 @@ export class HooksService {
return true;
}
async hookUpdate(param: { hookId: string; hook: HookReqType ; req:any}) {
async hookUpdate(param: { hookId: string; hook: HookReqType; req: any }) {
validatePayload('swagger.json#/components/schemas/HookReq', param.hook);
const hook = await Hook.get(param.hookId);
@ -98,7 +94,11 @@ export class HooksService {
return res;
}
async hookTest(param: { tableId: string; hookTest: HookTestReqType; req: any }) {
async hookTest(param: {
tableId: string;
hookTest: HookTestReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/HookTestReq',
param.hookTest,

4
packages/nocodb/src/services/kanbans.service.ts

@ -41,7 +41,7 @@ export class KanbansService {
showAs: 'kanban',
user: param.user,
req: param.req
req: param.req,
});
return view;
@ -68,7 +68,7 @@ export class KanbansService {
this.appHooksService.emit(AppEvents.VIEW_UPDATE, {
view,
showAs: 'kanban',
req: param.req
req: param.req,
});
return res;

6
packages/nocodb/src/services/maps.service.ts

@ -35,13 +35,15 @@ export class MapsService {
view,
showAs: 'map',
req: param.req
req: param.req,
});
return view;
}
async mapViewUpdate(param: { mapViewId: string; map: MapUpdateReqType;
async mapViewUpdate(param: {
mapViewId: string;
map: MapUpdateReqType;
req: any;
}) {
validatePayload('swagger.json#/components/schemas/MapUpdateReq', param.map);

6
packages/nocodb/src/services/meta-diffs.service.ts

@ -896,7 +896,11 @@ export class MetaDiffsService {
return true;
}
async baseMetaDiffSync(param: { baseId: string; sourceId: string, req: any }) {
async baseMetaDiffSync(param: {
baseId: string;
sourceId: string;
req: any;
}) {
const base = await Base.getWithInfo(param.baseId);
const source = await Source.get(param.sourceId);

15
packages/nocodb/src/services/notifications.service.ts

@ -37,7 +37,8 @@ export class NotificationsService implements OnModuleInit, OnModuleDestroy {
{
const { base, user, invitedBy } = data as ProjectInviteEvent;
await this.insertNotification({
await this.insertNotification(
{
fk_user_id: user.id,
type: AppEvents.PROJECT_INVITE,
body: {
@ -45,20 +46,24 @@ export class NotificationsService implements OnModuleInit, OnModuleDestroy {
title: base.title,
type: base.type,
invited_by: invitedBy.email,
}
},
req,);
},
req,
);
}
break;
case AppEvents.WELCOME:
{
const { user, req } = data as WelcomeEvent;
await this.insertNotification({
await this.insertNotification(
{
fk_user_id: user.id,
type: AppEvents.WELCOME,
body: {},
}, req);
},
req,
);
}
break;
}

10
packages/nocodb/src/services/org-tokens.service.ts

@ -35,7 +35,9 @@ export class OrgTokensService {
);
}
async apiTokenCreate(param: { user: User; apiToken: ApiTokenReqType
async apiTokenCreate(param: {
user: User;
apiToken: ApiTokenReqType;
req: any;
}) {
validatePayload(
@ -52,15 +54,13 @@ export class OrgTokensService {
tokenBody: param.apiToken,
userId: param.user?.id,
req: param.req
req: param.req,
});
return apiToken;
}
async apiTokenDelete(param: { user: User; token: string;
req: any;
}) {
async apiTokenDelete(param: { user: User; token: string; req: any }) {
const fk_user_id = param.user.id;
const apiToken = await ApiToken.getByToken(param.token);
if (

12
packages/nocodb/src/services/plugins.service.ts

@ -14,7 +14,7 @@ export class PluginsService {
return await Plugin.list();
}
async pluginTest(param: { body: PluginTestReqType; req: any}) {
async pluginTest(param: { body: PluginTestReqType; req: any }) {
validatePayload(
'swagger.json#/components/schemas/PluginTestReq',
param.body,
@ -22,7 +22,7 @@ export class PluginsService {
this.appHooksService.emit(AppEvents.PLUGIN_TEST, {
testBody: param.body,
req: param.req
req: param.req,
});
return await NcPluginMgrv2.test(param.body);
}
@ -30,7 +30,11 @@ export class PluginsService {
async pluginRead(param: { pluginId: string }) {
return await Plugin.get(param.pluginId);
}
async pluginUpdate(param: { pluginId: string; plugin: PluginType; req: any }) {
async pluginUpdate(param: {
pluginId: string;
plugin: PluginType;
req: any;
}) {
validatePayload('swagger.json#/components/schemas/PluginReq', param.plugin);
const plugin = await Plugin.update(param.pluginId, param.plugin);
@ -39,7 +43,7 @@ export class PluginsService {
plugin.active ? AppEvents.PLUGIN_INSTALL : AppEvents.PLUGIN_UNINSTALL,
{
plugin,
req: param.req
req: param.req,
},
);

11
packages/nocodb/src/services/shared-bases.service.ts

@ -26,7 +26,7 @@ export class SharedBasesService {
password: string;
siteUrl: string;
req: any
req: any;
}): Promise<any> {
validatePayload('swagger.json#/components/schemas/SharedBaseReq', param);
@ -74,7 +74,7 @@ export class SharedBasesService {
roles: string;
password: string;
siteUrl: string;
req:any
req: any;
}): Promise<any> {
validatePayload('swagger.json#/components/schemas/SharedBaseReq', param);
@ -110,7 +110,7 @@ export class SharedBasesService {
this.appHooksService.emit(AppEvents.SHARED_BASE_GENERATE_LINK, {
link: data.url,
base,
req: param.req
req: param.req,
});
return data;
}
@ -130,8 +130,9 @@ export class SharedBasesService {
return `${siteUrl}${config.dashboardPath}#/base/${base.uuid}`;
}
async disableSharedBaseLink(param: { baseId: string
req:any
async disableSharedBaseLink(param: {
baseId: string;
req: any;
}): Promise<any> {
const base = await Base.get(param.baseId);

16
packages/nocodb/src/services/sorts.service.ts

@ -14,9 +14,7 @@ export class SortsService {
return Sort.get(param.sortId);
}
async sortDelete(param: { sortId: string
req: any
}) {
async sortDelete(param: { sortId: string; req: any }) {
const sort = await Sort.get(param.sortId);
if (!sort) {
@ -27,14 +25,12 @@ export class SortsService {
this.appHooksService.emit(AppEvents.SORT_CREATE, {
sort,
req: param.req
req: param.req,
});
return true;
}
async sortUpdate(param: { sortId: any; sort: SortReqType
req: any
}) {
async sortUpdate(param: { sortId: any; sort: SortReqType; req: any }) {
validatePayload('swagger.json#/components/schemas/SortReq', param.sort);
const sort = await Sort.get(param.sortId);
@ -48,15 +44,13 @@ export class SortsService {
this.appHooksService.emit(AppEvents.SORT_UPDATE, {
sort,
req: param.req
req: param.req,
});
return res;
}
async sortCreate(param: { viewId: any; sort: SortReqType
req: any
}) {
async sortCreate(param: { viewId: any; sort: SortReqType; req: any }) {
validatePayload('swagger.json#/components/schemas/SortReq', param.sort);
const sort = await Sort.insert({

2
packages/nocodb/src/services/sources.service.ts

@ -53,7 +53,7 @@ export class SourcesService {
return sources;
}
async baseDelete(param: { sourceId: string; req: any}) {
async baseDelete(param: { sourceId: string; req: any }) {
try {
const source = await Source.get(param.sourceId, true);
await source.delete();

10
packages/nocodb/src/services/sync.service.ts

@ -33,15 +33,13 @@ export class SyncService {
this.appHooksService.emit(AppEvents.SYNC_SOURCE_CREATE, {
syncSource: sync,
req: param.req
req: param.req,
});
return sync;
}
async syncDelete(param: { syncId: string
req: any
}) {
async syncDelete(param: { syncId: string; req: any }) {
const syncSource = await SyncSource.get(param.syncId);
if (!syncSource) {
@ -52,7 +50,7 @@ export class SyncService {
this.appHooksService.emit(AppEvents.SYNC_SOURCE_DELETE, {
syncSource,
req: param.req
req: param.req,
});
return res;
}
@ -73,7 +71,7 @@ export class SyncService {
this.appHooksService.emit(AppEvents.SYNC_SOURCE_UPDATE, {
syncSource,
req: param.req
req: param.req,
});
return res;

8
packages/nocodb/src/services/users/users.service.ts

@ -91,7 +91,7 @@ export class UsersService {
salt,
password,
email_verification_token,
req
req,
}: {
email: string;
salt: any;
@ -353,7 +353,7 @@ export class UsersService {
this.appHooksService.emit(AppEvents.USER_EMAIL_VERIFICATION, {
user: user,
ip: req?.clientIp,
req
req,
});
return true;
@ -545,11 +545,11 @@ export class UsersService {
param.res.clearCookie('refresh_token');
}
private async createDefaultProject(user: User,req:any) {
private async createDefaultProject(user: User, req: any) {
// create new base for user
const base = await this.basesService.createDefaultBase({
user,
req
req,
});
return base;

12
packages/nocodb/src/services/view-columns.service.ts

@ -12,8 +12,10 @@ export class ViewColumnsService {
async columnList(param: { viewId: string }) {
return await View.getColumns(param.viewId, undefined);
}
async columnAdd(param: { viewId: string; column: ViewColumnReqType
req: any
async columnAdd(param: {
viewId: string;
column: ViewColumnReqType;
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/ViewColumnReq',
@ -30,7 +32,7 @@ export class ViewColumnsService {
);
this.appHooksService.emit(AppEvents.VIEW_COLUMN_CREATE, {
viewColumn,
req:param.req
req: param.req,
});
return viewColumn;
@ -40,7 +42,7 @@ export class ViewColumnsService {
viewId: string;
columnId: string;
column: ViewColumnUpdateReqType;
req: any
req: any;
}) {
validatePayload(
'swagger.json#/components/schemas/ViewColumnUpdateReq',
@ -55,7 +57,7 @@ export class ViewColumnsService {
this.appHooksService.emit(AppEvents.VIEW_COLUMN_UPDATE, {
viewColumn: param.column,
req: param.req
req: param.req,
});
return result;

16
packages/nocodb/src/services/views.service.ts

@ -91,9 +91,7 @@ export class ViewsService {
return filteredViewList;
}
async shareView(param: { viewId: string; user: UserType
req: any;
}) {
async shareView(param: { viewId: string; user: UserType; req: any }) {
const res = await View.share(param.viewId);
const view = await View.get(param.viewId);
@ -105,7 +103,7 @@ export class ViewsService {
this.appHooksService.emit(AppEvents.SHARED_VIEW_CREATE, {
user: param.user,
view,
req: param.req
req: param.req,
});
return res;
@ -137,14 +135,12 @@ export class ViewsService {
},
user: param.user,
req: param.req
req: param.req,
});
return result;
}
async viewDelete(param: { viewId: string; user: UserType
req: any;
}) {
async viewDelete(param: { viewId: string; user: UserType; req: any }) {
const view = await View.get(param.viewId);
if (!view) {
@ -184,7 +180,7 @@ export class ViewsService {
this.appHooksService.emit(AppEvents.SHARED_VIEW_UPDATE, {
user: param.user,
view,
req: param.req
req: param.req,
});
return result;
@ -201,7 +197,7 @@ export class ViewsService {
this.appHooksService.emit(AppEvents.SHARED_VIEW_DELETE, {
user: param.user,
view,
req: param.req
req: param.req,
});
return true;

Loading…
Cancel
Save