Browse Source

fix: at-service corrections

pull/6894/head
Pranav C 1 year ago
parent
commit
d3e765f507
  1. 2
      packages/nocodb/src/helpers/exportImportHelpers.ts
  2. 4
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts
  3. 47
      packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts
  4. 4
      packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts
  5. 4
      packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts
  6. 9
      packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts
  7. 11
      packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts

2
packages/nocodb/src/helpers/exportImportHelpers.ts

@ -46,7 +46,7 @@ export function reverseGet(map: Map<string, string>, vl: string) {
return undefined;
}
export function withoutId(obj: any) {
export function withoutId<T>(obj: T): Omit<T, 'id'> {
const { id, ...rest } = obj;
return rest;
}

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

@ -151,7 +151,7 @@ export class DuplicateController {
sourceId: source.id,
dupProjectId: dupProject.id,
options: body.options || {},
req: {
req: {
user: req.user,
clientIp: req.clientIp,
headers: req.headers,
@ -207,7 +207,7 @@ export class DuplicateController {
modelId: model.id,
title: uniqueTitle,
options: body.options || {},
req: {
req: {
user: req.user,
clientIp: req.clientIp,
headers: req.headers,

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

@ -391,7 +391,7 @@ export class ImportService {
ur: colOptions.ur,
dr: colOptions.dr,
},
}),
}) as any,
req: param.req,
user: param.user,
});
@ -508,7 +508,7 @@ export class ImportService {
ur: colOptions.ur,
dr: colOptions.dr,
},
}),
}) as any,
req: param.req,
user: param.user,
});
@ -630,7 +630,7 @@ export class ImportService {
ur: colOptions.ur,
dr: colOptions.dr,
},
}),
}) as any,
req: param.req,
user: param.user,
});
@ -801,7 +801,7 @@ export class ImportService {
colOptions.fk_relation_column_id,
),
},
}),
}) as any,
req: param.req,
user: param.user,
});
@ -827,7 +827,7 @@ export class ImportService {
),
rollup_function: colOptions.rollup_function,
},
}),
}) as any,
req: param.req,
user: param.user,
});
@ -901,7 +901,7 @@ export class ImportService {
fk_parent_id: getIdOrExternalId(fl.fk_parent_id),
}),
user: param.user,
req: {},
req: param.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: param.req,
});
}
@ -936,7 +936,7 @@ export class ImportService {
show: fcl.show,
order: fcl.order,
},
req: {},
req: param.req,
});
}
@ -953,7 +953,7 @@ export class ImportService {
grid: {
...withoutNull(rest),
},
req: {},
req: param.req,
});
}
break;
@ -969,7 +969,7 @@ export class ImportService {
formViewColumn: {
...withoutNull(rest),
},
req: {},
req: param.req,
});
}
break;
@ -986,7 +986,7 @@ export class ImportService {
order: view.order,
},
user: param.user,
req: {},
req: param.req,
});
}
}
@ -1013,8 +1013,8 @@ export class ImportService {
tableId: table.id,
hook: {
...hookData,
},
req: {},
} as any,
req: param.req,
});
if (!hk) continue;
@ -1031,7 +1031,7 @@ export class ImportService {
fk_parent_id: getIdOrExternalId(fl.fk_parent_id),
}),
user: param.user,
req: {},
req: param.req,
});
idMap.set(fl.id, fg.id);
@ -1050,6 +1050,7 @@ export class ImportService {
vw: Partial<View>,
views: View[],
user: UserType,
req: any,
): Promise<View> {
if (vw.is_default) {
const view = views.find((a) => a.is_default);
@ -1059,7 +1060,7 @@ export class ImportService {
await this.gridsService.gridViewUpdate({
viewId: view.id,
grid: gridData,
req: {},
req,
});
}
}
@ -1071,14 +1072,14 @@ export class ImportService {
const gview = await this.gridsService.gridViewCreate({
tableId: md.id,
grid: vw as ViewCreateReqType,
req: {},
req: param.req,
});
const gridData = withoutNull(vw.view);
if (gridData) {
await this.gridsService.gridViewUpdate({
viewId: gview.id,
grid: gridData,
req: {},
req,
});
}
return gview;
@ -1088,14 +1089,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;
@ -1105,7 +1106,7 @@ export class ImportService {
tableId: md.id,
gallery: vw as ViewCreateReqType,
user,
req: {},
req,
});
const galleryData = withoutNull(vw.view);
if (galleryData) {
@ -1119,7 +1120,7 @@ export class ImportService {
await this.galleriesService.galleryViewUpdate({
galleryViewId: glview.id,
gallery: galleryData,
req: {},
req,
});
}
return glview;
@ -1129,7 +1130,7 @@ export class ImportService {
tableId: md.id,
kanban: vw as ViewCreateReqType,
user,
req: {},
req,
});
const kanbanData = withoutNull(vw.view);
if (kanbanData) {
@ -1175,7 +1176,7 @@ export class ImportService {
await this.kanbansService.kanbanViewUpdate({
kanbanViewId: kview.id,
kanban: kanbanData,
req: {},
req,
});
}
return kview;

4
packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts

@ -38,7 +38,7 @@ export class MetaSyncController {
baseId,
sourceId: 'all',
user: req.user,
req: {
req: {
user: req.user,
clientIp: req.clientIp,
headers: req.headers,
@ -75,7 +75,7 @@ export class MetaSyncController {
baseId,
sourceId,
user: req.user,
req: {
req: {
user: req.user,
clientIp: req.clientIp,
headers: req.headers,

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

@ -17,8 +17,8 @@ export class MetaSyncProcessor {
const info: {
baseId: string;
sourceId: string;
user: any
req:any;
user: any;
req: any;
} = job.data;
if (info.sourceId === 'all') {

9
packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts

@ -4,7 +4,8 @@ import {
HttpCode,
Inject,
Param,
Post, Req,
Post,
Req,
UseGuards,
} from '@nestjs/common';
import { BaseReqType } from 'nocodb-sdk';
@ -25,7 +26,11 @@ export class SourceCreateController {
])
@HttpCode(200)
@Acl('baseCreate')
async baseCreate(@Param('baseId') baseId: string, @Body() body: BaseReqType, @Req() req) {
async baseCreate(
@Param('baseId') baseId: string,
@Body() body: BaseReqType,
@Req() req,
) {
const jobs = await this.jobsService.jobList();
const fnd = jobs.find(
(j) => j.name === JobTypes.BaseCreate && j.data.baseId === baseId,

11
packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts

@ -1,4 +1,11 @@
import {Controller, Delete, Inject, Param, Req, UseGuards} from '@nestjs/common';
import {
Controller,
Delete,
Inject,
Param,
Req,
UseGuards,
} from '@nestjs/common';
import { GlobalGuard } from '~/guards/global/global.guard';
import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware';
import { NcError } from '~/helpers/catchError';
@ -19,7 +26,7 @@ export class SourceDeleteController {
'/api/v2/meta/bases/:baseId/sources/:sourceId',
])
@Acl('baseDelete')
async baseDelete(@Param('sourceId') sourceId: string,@Req() req){
async baseDelete(@Param('sourceId') sourceId: string, @Req() req) {
const jobs = await this.jobsService.jobList();
const fnd = jobs.find(
(j) => j.name === JobTypes.BaseDelete && j.data.sourceId === sourceId,

Loading…
Cancel
Save