add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { Container } from 'typedi';
import OrganizationService from '@/services/Organization/OrganizationService';
export default class OrganizationSetupJob {
/**
* Constructor method.
*/
constructor(agenda) {
agenda.define(
'organization-setup',
{ priority: 'high', concurrency: 1 },
this.handler
);
}
/**
* Handle job action.
*/
async handler(job, done: Function): Promise<void> {
const { tenantId, buildDTO, authorizedUser, _id } = job.attrs.data;
const organizationService = Container.get(OrganizationService);
try {
await organizationService.build(tenantId, buildDTO, authorizedUser);
done();
} catch (e) {
// Unlock build status of the tenant.
await organizationService.revertBuildRunJob(tenantId, _id);
console.error(e);
done(e);
}
}
}