Browse Source

refactor: include request object in app-hook payload

pull/6894/head
Pranav C 1 year ago
parent
commit
55e0c6edbd
  1. 4
      packages/nocodb/src/controllers/auth/auth.controller.ts
  2. 4
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  3. 2
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts
  4. 2
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.processor.ts
  5. 3
      packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts
  6. 1
      packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts
  7. 2
      packages/nocodb/src/services/sources.service.ts

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

@ -83,7 +83,7 @@ export class AuthController {
NcError.forbidden('Email authentication is disabled'); NcError.forbidden('Email authentication is disabled');
} }
await this.setRefreshToken({ req, res }); await this.setRefreshToken({ req, res });
res.json(await this.usersService.login(req.user)); res.json(await this.usersService.login(req.user, req));
} }
@UseGuards(GlobalGuard) @UseGuards(GlobalGuard)
@ -106,7 +106,7 @@ export class AuthController {
@UseGuards(PublicApiLimiterGuard, AuthGuard('google')) @UseGuards(PublicApiLimiterGuard, AuthGuard('google'))
async googleSignin(@Request() req, @Response() res) { async googleSignin(@Request() req, @Response() res) {
await this.setRefreshToken({ req, res }); await this.setRefreshToken({ req, res });
res.json(await this.usersService.login(req.user)); res.json(await this.usersService.login(req.user, req));
} }
@Get('/auth/google') @Get('/auth/google')

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

@ -1527,8 +1527,8 @@ export class AtImportProcessor {
url: attachment.url, url: attachment.url,
size: attachment.size, size: attachment.size,
mimetype: attachment.type, mimetype: attachment.type,
req:{} })), req:{}
})),
}); });
} catch (e) { } catch (e) {
console.log(e); console.log(e);

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save