From 4f757fbcadcdc4bd96182e83de7d0e9cbc0157ed Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Wed, 10 Apr 2024 19:01:13 +0530 Subject: [PATCH 1/6] feat(plugin): job proposal template plugin basic structure --- .../job-proposal-template/.dockerignore | 25 +++++++++++ .../plugins/job-proposal-template/README.md | 15 +++++++ .../job-proposal-template/jest.config.js | 9 ++++ .../job-proposal-template/package.json | 43 +++++++++++++++++++ .../job-proposal-template/tsconfig.build.json | 3 ++ .../job-proposal-template/tsconfig.json | 13 ++++++ .../job-proposal-template/tsconfig.spec.json | 15 +++++++ .../plugins/job-proposal-template/tslint.json | 4 ++ 8 files changed, 127 insertions(+) create mode 100644 packages/plugins/job-proposal-template/.dockerignore create mode 100644 packages/plugins/job-proposal-template/README.md create mode 100644 packages/plugins/job-proposal-template/jest.config.js create mode 100644 packages/plugins/job-proposal-template/package.json create mode 100644 packages/plugins/job-proposal-template/tsconfig.build.json create mode 100644 packages/plugins/job-proposal-template/tsconfig.json create mode 100644 packages/plugins/job-proposal-template/tsconfig.spec.json create mode 100644 packages/plugins/job-proposal-template/tslint.json diff --git a/packages/plugins/job-proposal-template/.dockerignore b/packages/plugins/job-proposal-template/.dockerignore new file mode 100644 index 00000000000..b88b16df035 --- /dev/null +++ b/packages/plugins/job-proposal-template/.dockerignore @@ -0,0 +1,25 @@ +# Git +.git +.gitmodules +.gitignore + +# README file containing information about the project +README.md + +# Directory containing Docker-related files and configurations +docker + +# Directory containing installed Node.js modules, managed by npm or yarn +node_modules + +# Directory for temporary files +tmp + +# Directory for build-related files +build + +# Directory for distribution files, typically production-ready code +dist + +# Environment variables configuration file (dotenv file) +.env diff --git a/packages/plugins/job-proposal-template/README.md b/packages/plugins/job-proposal-template/README.md new file mode 100644 index 00000000000..9b7302da361 --- /dev/null +++ b/packages/plugins/job-proposal-template/README.md @@ -0,0 +1,15 @@ +# Job Proposal Template Plugin + +## Overview + +## Features + +## Installation + +To install the Job Proposal Template Plugin, simply run the following command in your terminal: + +```bash +npm install @gauzy/job-proposal-template-plugin +# or +yarn add @gauzy/job-proposal-template-plugin +``` diff --git a/packages/plugins/job-proposal-template/jest.config.js b/packages/plugins/job-proposal-template/jest.config.js new file mode 100644 index 00000000000..ed8a3723f2f --- /dev/null +++ b/packages/plugins/job-proposal-template/jest.config.js @@ -0,0 +1,9 @@ +module.exports = { + name: 'job-proposal-template', + preset: '../../../jest.config.js', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest' + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], + coverageDirectory: '../../coverage/plugins/job-proposal-template' +}; diff --git a/packages/plugins/job-proposal-template/package.json b/packages/plugins/job-proposal-template/package.json new file mode 100644 index 00000000000..2e16d7d6526 --- /dev/null +++ b/packages/plugins/job-proposal-template/package.json @@ -0,0 +1,43 @@ +{ + "name": "@gauzy/job-proposal-template-plugin", + "version": "0.1.0", + "description": "Ever Gauzy Platform Job Post Plugin", + "author": { + "name": "Ever Co. LTD", + "email": "ever@ever.co", + "url": "https://ever.co" + }, + "license": "AGPL-3.0", + "private": true, + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "directories": { + "lib": "dist", + "test": "__test__" + }, + "publishConfig": { + "access": "restricted" + }, + "scripts": { + "test:e2e": "jest --config ./jest.config.js", + "build": "rimraf dist && yarn run compile", + "compile": "tsc -p tsconfig.build.json" + }, + "keywords": [], + "dependencies": { + "@gauzy/contracts": "^0.1.0", + "@gauzy/core": "^0.1.0", + "@gauzy/plugin": "^0.1.0", + "@nestjs/common": "^10.3.7", + "@nestjs/swagger": "^7.3.0", + "typeorm": "^0.3.20" + }, + "devDependencies": { + "@types/node": "^17.0.33", + "rimraf": "^3.0.2", + "typescript": "5.1.6" + } +} diff --git a/packages/plugins/job-proposal-template/tsconfig.build.json b/packages/plugins/job-proposal-template/tsconfig.build.json new file mode 100644 index 00000000000..ea6be8e9a50 --- /dev/null +++ b/packages/plugins/job-proposal-template/tsconfig.build.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json" +} diff --git a/packages/plugins/job-proposal-template/tsconfig.json b/packages/plugins/job-proposal-template/tsconfig.json new file mode 100644 index 00000000000..999d1cb59b2 --- /dev/null +++ b/packages/plugins/job-proposal-template/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "sourceMap": true, + "baseUrl": "./src", + "rootDir": "./src", + "outDir": "./dist", + "types": ["node", "jest"] + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/plugins/job-proposal-template/tsconfig.spec.json b/packages/plugins/job-proposal-template/tsconfig.spec.json new file mode 100644 index 00000000000..9f405553401 --- /dev/null +++ b/packages/plugins/job-proposal-template/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/packages/plugins/job-proposal-template/tslint.json b/packages/plugins/job-proposal-template/tslint.json new file mode 100644 index 00000000000..74516cfb290 --- /dev/null +++ b/packages/plugins/job-proposal-template/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../tslint.json", + "rules": [] +} From d8c7624d249a6db8f284780852b33f16919ade0b Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:34:19 +0530 Subject: [PATCH 2/6] feat: moved employee proposal template to plugins folder --- packages/core/src/app.module.ts | 2 - packages/core/src/core/dto/index.ts | 6 +-- packages/core/src/core/entities/index.ts | 2 - packages/core/src/core/entities/internal.ts | 1 - packages/core/src/core/index.ts | 1 + .../employee-proposal-template.module.ts | 23 ----------- .../src/employee/dto/employee-feature.dto.ts | 2 +- packages/core/src/employee/index.ts | 1 + .../export-import/export/export.service.ts | 11 ----- .../export-import/import/import.service.ts | 26 ++++-------- .../factory-reset/factory-reset.service.ts | 11 +---- packages/core/tsconfig.json | 4 +- .../src}/dto/create-proposal-template.dto.ts | 4 +- .../job-proposal-template/src}/dto/index.ts | 0 .../src}/dto/proposal-template.dto.ts | 10 ++--- .../src}/dto/update-proposal-template.dto.ts | 3 +- ...loyee-proposal-template.controller.spec.ts | 0 .../employee-proposal-template.controller.ts | 14 ++----- .../src}/employee-proposal-template.entity.ts | 10 ++--- ...employee-proposal-template.service.spec.ts | 0 .../employee-proposal-template.service.ts | 23 +++++------ .../job-proposal-template/src/index.ts | 1 + .../src/job-proposal-template.plugin.ts | 40 +++++++++++++++++++ .../src/repository/index.ts | 2 + ...m-employee-proposal-template.repository.ts | 2 +- ...m-employee-proposal-template.repository.ts | 0 26 files changed, 86 insertions(+), 113 deletions(-) delete mode 100644 packages/core/src/employee-proposal-template/employee-proposal-template.module.ts rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/dto/create-proposal-template.dto.ts (78%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/dto/index.ts (100%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/dto/proposal-template.dto.ts (68%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/dto/update-proposal-template.dto.ts (84%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/employee-proposal-template.controller.spec.ts (100%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/employee-proposal-template.controller.ts (86%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/employee-proposal-template.entity.ts (84%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/employee-proposal-template.service.spec.ts (100%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/employee-proposal-template.service.ts (62%) create mode 100644 packages/plugins/job-proposal-template/src/index.ts create mode 100644 packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts create mode 100644 packages/plugins/job-proposal-template/src/repository/index.ts rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/repository/mikro-orm-employee-proposal-template.repository.ts (66%) rename packages/{core/src/employee-proposal-template => plugins/job-proposal-template/src}/repository/type-orm-employee-proposal-template.repository.ts (100%) diff --git a/packages/core/src/app.module.ts b/packages/core/src/app.module.ts index 5569ebe64cc..0cc7a350262 100644 --- a/packages/core/src/app.module.ts +++ b/packages/core/src/app.module.ts @@ -126,7 +126,6 @@ import { GoalKpiTemplateModule } from './goal-kpi-template/goal-kpi-template.mod import { TenantSettingModule } from './tenant/tenant-setting/tenant-setting.module'; import { EmployeeJobPresetModule } from './employee-job-preset/employee-job-preset.module'; import { ReportModule } from './reports/report.module'; -import { EmployeeProposalTemplateModule } from './employee-proposal-template/employee-proposal-template.module'; import { CustomSmtpModule } from './custom-smtp/custom-smtp.module'; import { FeatureModule } from './feature/feature.module'; import { ImageAssetModule } from './image-asset/image-asset.module'; @@ -363,7 +362,6 @@ if (environment.THROTTLE_ENABLED) { ImportModule, EmployeeSettingModule, EmployeeJobPresetModule, - EmployeeProposalTemplateModule, EmployeeStatisticsModule, EmployeeAppointmentModule, AppointmentEmployeesModule, diff --git a/packages/core/src/core/dto/index.ts b/packages/core/src/core/dto/index.ts index 4d56416f4fd..7d1f8c6ee94 100644 --- a/packages/core/src/core/dto/index.ts +++ b/packages/core/src/core/dto/index.ts @@ -1,3 +1,3 @@ -export { TenantBaseDTO } from './tenant-base.dto'; -export { TenantOrganizationBaseDTO } from './tenant-organization-base.dto'; -export { TranslatableBaseDTO } from './translate-base-dto'; \ No newline at end of file +export * from './tenant-base.dto'; +export * from './tenant-organization-base.dto'; +export * from './translate-base-dto'; diff --git a/packages/core/src/core/entities/index.ts b/packages/core/src/core/entities/index.ts index 212c2a456d1..afe389a30c7 100644 --- a/packages/core/src/core/entities/index.ts +++ b/packages/core/src/core/entities/index.ts @@ -29,7 +29,6 @@ import { EmployeeAward, EmployeeLevel, EmployeePhone, - EmployeeProposalTemplate, EmployeeRecurringExpense, EmployeeSetting, EmployeeUpworkJobsSearchCriterion, @@ -174,7 +173,6 @@ export const coreEntities = [ EmployeeAward, EmployeeLevel, EmployeePhone, - EmployeeProposalTemplate, EmployeeRecurringExpense, EmployeeSetting, EmployeeUpworkJobsSearchCriterion, diff --git a/packages/core/src/core/entities/internal.ts b/packages/core/src/core/entities/internal.ts index fbdafe64052..5872738f521 100644 --- a/packages/core/src/core/entities/internal.ts +++ b/packages/core/src/core/entities/internal.ts @@ -38,7 +38,6 @@ export * from '../../employee-job-preset/job-search-category/job-search-category export * from '../../employee-job-preset/job-search-occupation/job-search-occupation.entity'; export * from '../../employee-level/employee-level.entity'; export * from '../../employee-phone/employee-phone.entity'; -export * from '../../employee-proposal-template/employee-proposal-template.entity'; export * from '../../employee-recurring-expense/employee-recurring-expense.entity'; export * from '../../employee-setting/employee-setting.entity'; export * from '../../employee/employee.entity'; diff --git a/packages/core/src/core/index.ts b/packages/core/src/core/index.ts index 9fef4528ecf..461a0c71d34 100644 --- a/packages/core/src/core/index.ts +++ b/packages/core/src/core/index.ts @@ -7,5 +7,6 @@ export * from './repository'; export * from './entities/internal'; export * from './entities/subscribers'; export * from './decorators'; +export * from './dto'; export * from './orm-type'; export * from './plugin-common.module'; diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.module.ts b/packages/core/src/employee-proposal-template/employee-proposal-template.module.ts deleted file mode 100644 index d873ecb6807..00000000000 --- a/packages/core/src/employee-proposal-template/employee-proposal-template.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { forwardRef, Module } from '@nestjs/common'; -import { CqrsModule } from '@nestjs/cqrs'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { RouterModule } from '@nestjs/core'; -import { MikroOrmModule } from '@mikro-orm/nestjs'; -import { RolePermissionModule } from '../role-permission/role-permission.module'; -import { EmployeeProposalTemplateController } from './employee-proposal-template.controller'; -import { EmployeeProposalTemplate } from './employee-proposal-template.entity'; -import { EmployeeProposalTemplateService } from './employee-proposal-template.service'; - -@Module({ - imports: [ - RouterModule.register([{ path: '/employee-proposal-template', module: EmployeeProposalTemplateModule }]), - TypeOrmModule.forFeature([EmployeeProposalTemplate]), - MikroOrmModule.forFeature([EmployeeProposalTemplate]), - forwardRef(() => RolePermissionModule), - CqrsModule - ], - controllers: [EmployeeProposalTemplateController], - providers: [EmployeeProposalTemplateService], - exports: [TypeOrmModule, MikroOrmModule, EmployeeProposalTemplateService] -}) -export class EmployeeProposalTemplateModule { } diff --git a/packages/core/src/employee/dto/employee-feature.dto.ts b/packages/core/src/employee/dto/employee-feature.dto.ts index 617afdeec3c..da940ba67d6 100644 --- a/packages/core/src/employee/dto/employee-feature.dto.ts +++ b/packages/core/src/employee/dto/employee-feature.dto.ts @@ -1,6 +1,6 @@ -import { IEmployee, IRelationalEmployee } from "@gauzy/contracts"; import { ApiPropertyOptional } from "@nestjs/swagger"; import { IsObject, IsString, ValidateIf } from "class-validator"; +import { IEmployee, IRelationalEmployee } from "@gauzy/contracts"; import { Employee } from "./../employee.entity"; import { IsEmployeeBelongsToOrganization } from "./../../shared/validators"; diff --git a/packages/core/src/employee/index.ts b/packages/core/src/employee/index.ts index f2d733473ae..b3a6d251d59 100644 --- a/packages/core/src/employee/index.ts +++ b/packages/core/src/employee/index.ts @@ -4,3 +4,4 @@ export * from './employee.entity'; export * from './employee.module'; export * from './employee.service'; export * from './employee.seed'; +export * from './dto/employee-feature.dto'; diff --git a/packages/core/src/export-import/export/export.service.ts b/packages/core/src/export-import/export/export.service.ts index 2414bc6ac04..a5919209e6d 100644 --- a/packages/core/src/export-import/export/export.service.ts +++ b/packages/core/src/export-import/export/export.service.ts @@ -42,7 +42,6 @@ import { EmployeeAppointment, EmployeeAward, EmployeeLevel, - EmployeeProposalTemplate, EmployeeRecurringExpense, EmployeeSetting, EmployeeUpworkJobsSearchCriterion, @@ -203,8 +202,6 @@ import { TypeOrmJobPresetRepository } from '../../employee-job-preset/repository import { TypeOrmEmployeeUpworkJobsSearchCriterionRepository } from '../../employee-job-preset/repository/typeorm-orm-employee-upwork-jobs-search-criterion.entity.repository'; import { MikroOrmEmployeeLevelRepository } from '../../employee-level/repository/mikro-orm-employee-level.repository'; import { TypeOrmEmployeeLevelRepository } from '../../employee-level/repository/type-orm-employee-level.repository'; -import { MikroOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository'; -import { TypeOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/type-orm-employee-proposal-template.repository'; import { MikroOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/mikro-orm-employee-recurring-expense.repository'; import { TypeOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/type-orm-employee-recurring-expense.repository'; import { MikroOrmEmployeeSettingRepository } from '../../employee-setting/repository/mikro-orm-employee-setting.repository'; @@ -550,11 +547,6 @@ export class ExportService implements OnModuleInit { mikroOrmEmployeeAwardRepository: MikroOrmEmployeeAwardRepository, - @InjectRepository(EmployeeProposalTemplate) - private typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, - - mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository, - @InjectRepository(EmployeeRecurringExpense) private typeOrmEmployeeRecurringExpenseRepository: TypeOrmEmployeeRecurringExpenseRepository, @@ -1506,9 +1498,6 @@ export class ExportService implements OnModuleInit { { joinTableName: 'tag_organization_employee_level' } ] }, - { - repository: this.typeOrmEmployeeProposalTemplateRepository - }, { repository: this.typeOrmEmployeeRecurringExpenseRepository }, diff --git a/packages/core/src/export-import/import/import.service.ts b/packages/core/src/export-import/import/import.service.ts index 8b38146a24b..5ccfaeb2a30 100644 --- a/packages/core/src/export-import/import/import.service.ts +++ b/packages/core/src/export-import/import/import.service.ts @@ -42,7 +42,6 @@ import { EmployeeAppointment, EmployeeAward, EmployeeLevel, - EmployeeProposalTemplate, EmployeeRecurringExpense, EmployeeSetting, EmployeeUpworkJobsSearchCriterion, @@ -200,8 +199,6 @@ import { TypeOrmJobPresetRepository } from '../../employee-job-preset/repository import { TypeOrmEmployeeUpworkJobsSearchCriterionRepository } from '../../employee-job-preset/repository/typeorm-orm-employee-upwork-jobs-search-criterion.entity.repository'; import { MikroOrmEmployeeLevelRepository } from '../../employee-level/repository/mikro-orm-employee-level.repository'; import { TypeOrmEmployeeLevelRepository } from '../../employee-level/repository/type-orm-employee-level.repository'; -import { MikroOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository'; -import { TypeOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/type-orm-employee-proposal-template.repository'; import { MikroOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/mikro-orm-employee-recurring-expense.repository'; import { TypeOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/type-orm-employee-recurring-expense.repository'; import { MikroOrmEmployeeSettingRepository } from '../../employee-setting/repository/mikro-orm-employee-setting.repository'; @@ -544,11 +541,6 @@ export class ImportService implements OnModuleInit { mikroOrmEmployeeAwardRepository: MikroOrmEmployeeAwardRepository, - @InjectRepository(EmployeeProposalTemplate) - private typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, - - mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository, - @InjectRepository(EmployeeRecurringExpense) private typeOrmEmployeeRecurringExpenseRepository: TypeOrmEmployeeRecurringExpenseRepository, @@ -1369,9 +1361,7 @@ export class ImportService implements OnModuleInit { const repository = this.dataSource.getRepository(entity); this[className] = repository; - this.dynamicEntitiesClassMap.push({ - repository - }); + this.dynamicEntitiesClassMap.push({ repository }); } } @@ -1767,13 +1757,13 @@ export class ImportService implements OnModuleInit { { column: 'employeeId', repository: this.typeOrmEmployeeRepository } ] }, - { - repository: this.typeOrmEmployeeProposalTemplateRepository, - isCheckRelation: true, - foreignKeys: [ - { column: 'employeeId', repository: this.typeOrmEmployeeRepository } - ] - }, + // { + // repository: this.typeOrmEmployeeProposalTemplateRepository, + // isCheckRelation: true, + // foreignKeys: [ + // { column: 'employeeId', repository: this.typeOrmEmployeeRepository } + // ] + // }, { repository: this.typeOrmEmployeeRecurringExpenseRepository, isCheckRelation: true, diff --git a/packages/core/src/user/factory-reset/factory-reset.service.ts b/packages/core/src/user/factory-reset/factory-reset.service.ts index c6282846ccd..8a18fa1afad 100644 --- a/packages/core/src/user/factory-reset/factory-reset.service.ts +++ b/packages/core/src/user/factory-reset/factory-reset.service.ts @@ -31,7 +31,6 @@ import { EmployeeAppointment, EmployeeAward, EmployeeLevel, - EmployeeProposalTemplate, EmployeeRecurringExpense, EmployeeSetting, Equipment, @@ -148,8 +147,6 @@ import { MikroOrmJobPresetRepository } from '../../employee-job-preset/repositor import { TypeOrmJobPresetRepository } from '../../employee-job-preset/repository/type-orm-job-preset.repository'; import { MikroOrmEmployeeLevelRepository } from '../../employee-level/repository/mikro-orm-employee-level.repository'; import { TypeOrmEmployeeLevelRepository } from '../../employee-level/repository/type-orm-employee-level.repository'; -import { MikroOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository'; -import { TypeOrmEmployeeProposalTemplateRepository } from '../../employee-proposal-template/repository/type-orm-employee-proposal-template.repository'; import { MikroOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/mikro-orm-employee-recurring-expense.repository'; import { TypeOrmEmployeeRecurringExpenseRepository } from '../../employee-recurring-expense/repository/type-orm-employee-recurring-expense.repository'; import { MikroOrmEmployeeSettingRepository } from '../../employee-setting/repository/mikro-orm-employee-setting.repository'; @@ -391,11 +388,6 @@ export class FactoryResetService { mikroOrmEmployeeAwardRepository: MikroOrmEmployeeAwardRepository, - @InjectRepository(EmployeeProposalTemplate) - private typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, - - mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository, - @InjectRepository(EmployeeRecurringExpense) private typeOrmEmployeeRecurringExpenseRepository: TypeOrmEmployeeRecurringExpenseRepository, @@ -737,7 +729,7 @@ export class FactoryResetService { mikroOrmUserOrganizationRepository: MikroOrmUserOrganizationRepository, private configService: ConfigService - ) {} + ) { } async onModuleInit() { this.registerCoreRepositories(); @@ -887,7 +879,6 @@ export class FactoryResetService { this.typeOrmEmployeeAppointmentRepository, this.typeOrmEmployeeAwardRepository, this.typeOrmEmployeeLevelRepository, - this.typeOrmEmployeeProposalTemplateRepository, this.typeOrmEmployeeRecurringExpenseRepository, this.typeOrmEmployeeRepository, this.typeOrmEmployeeSettingRepository, diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 1c073a3f982..a9a8be629da 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -9,7 +9,9 @@ "types": ["node", "jest"], "paths": { "rxjs": ["node_modules/rxjs"], - "rxjs/*": ["node_modules/rxjs/*"] + "rxjs/*": ["node_modules/rxjs/*"], + "@core/*": ["./core/*"], + "@shared/*": ["./shared/*"], } }, "include": ["./src/**/*"] diff --git a/packages/core/src/employee-proposal-template/dto/create-proposal-template.dto.ts b/packages/plugins/job-proposal-template/src/dto/create-proposal-template.dto.ts similarity index 78% rename from packages/core/src/employee-proposal-template/dto/create-proposal-template.dto.ts rename to packages/plugins/job-proposal-template/src/dto/create-proposal-template.dto.ts index e6a12b94d44..d0a272c945b 100644 --- a/packages/core/src/employee-proposal-template/dto/create-proposal-template.dto.ts +++ b/packages/plugins/job-proposal-template/src/dto/create-proposal-template.dto.ts @@ -1,6 +1,6 @@ import { IEmployeeProposalTemplate } from "@gauzy/contracts"; import { IntersectionType } from "@nestjs/mapped-types"; -import { EmployeeFeatureDTO } from "./../../employee/dto"; +import { EmployeeFeatureDTO } from "@gauzy/core"; import { ProposalTemplateDTO } from "./proposal-template.dto"; /** @@ -10,4 +10,4 @@ import { ProposalTemplateDTO } from "./proposal-template.dto"; export class CreateProposalTemplateDTO extends IntersectionType( ProposalTemplateDTO, EmployeeFeatureDTO -) implements IEmployeeProposalTemplate {} \ No newline at end of file +) implements IEmployeeProposalTemplate { } diff --git a/packages/core/src/employee-proposal-template/dto/index.ts b/packages/plugins/job-proposal-template/src/dto/index.ts similarity index 100% rename from packages/core/src/employee-proposal-template/dto/index.ts rename to packages/plugins/job-proposal-template/src/dto/index.ts diff --git a/packages/core/src/employee-proposal-template/dto/proposal-template.dto.ts b/packages/plugins/job-proposal-template/src/dto/proposal-template.dto.ts similarity index 68% rename from packages/core/src/employee-proposal-template/dto/proposal-template.dto.ts rename to packages/plugins/job-proposal-template/src/dto/proposal-template.dto.ts index e174e164527..14dfdbed900 100644 --- a/packages/core/src/employee-proposal-template/dto/proposal-template.dto.ts +++ b/packages/plugins/job-proposal-template/src/dto/proposal-template.dto.ts @@ -1,7 +1,7 @@ import { IEmployeeProposalTemplate } from "@gauzy/contracts"; import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { IsBoolean, IsNotEmpty, IsOptional, IsString } from "class-validator"; -import { TenantOrganizationBaseDTO } from "./../../core/dto"; +import { TenantOrganizationBaseDTO } from "@gauzy/core"; /** * Proposal template common request DTO validation @@ -9,18 +9,18 @@ import { TenantOrganizationBaseDTO } from "./../../core/dto"; */ export class ProposalTemplateDTO extends TenantOrganizationBaseDTO implements IEmployeeProposalTemplate { - @ApiProperty({ type: () => String, readOnly: true }) + @ApiProperty({ type: () => String }) @IsNotEmpty() @IsString() readonly name: string; - @ApiPropertyOptional({ type: () => String, readOnly: true }) + @ApiPropertyOptional({ type: () => String }) @IsOptional() @IsString() readonly content: string; - @ApiPropertyOptional({ type: () => Boolean, readOnly: true }) + @ApiPropertyOptional({ type: () => Boolean }) @IsOptional() @IsBoolean() readonly isDefault: boolean; -} \ No newline at end of file +} diff --git a/packages/core/src/employee-proposal-template/dto/update-proposal-template.dto.ts b/packages/plugins/job-proposal-template/src/dto/update-proposal-template.dto.ts similarity index 84% rename from packages/core/src/employee-proposal-template/dto/update-proposal-template.dto.ts rename to packages/plugins/job-proposal-template/src/dto/update-proposal-template.dto.ts index c5e6a01b0b8..794c3ebd1ed 100644 --- a/packages/core/src/employee-proposal-template/dto/update-proposal-template.dto.ts +++ b/packages/plugins/job-proposal-template/src/dto/update-proposal-template.dto.ts @@ -5,5 +5,4 @@ import { ProposalTemplateDTO } from "./proposal-template.dto"; * Update proposal template request DTO validation * */ -export class UpdateProposalTemplateDTO extends ProposalTemplateDTO - implements IEmployeeProposalTemplate {} +export class UpdateProposalTemplateDTO extends ProposalTemplateDTO implements IEmployeeProposalTemplate { } diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.controller.spec.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.controller.spec.ts similarity index 100% rename from packages/core/src/employee-proposal-template/employee-proposal-template.controller.spec.ts rename to packages/plugins/job-proposal-template/src/employee-proposal-template.controller.spec.ts diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.controller.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.controller.ts similarity index 86% rename from packages/core/src/employee-proposal-template/employee-proposal-template.controller.ts rename to packages/plugins/job-proposal-template/src/employee-proposal-template.controller.ts index caa5585a599..a034e39b273 100644 --- a/packages/core/src/employee-proposal-template/employee-proposal-template.controller.ts +++ b/packages/plugins/job-proposal-template/src/employee-proposal-template.controller.ts @@ -1,5 +1,4 @@ import { - BadRequestException, Body, Controller, Get, @@ -13,10 +12,7 @@ import { import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { UpdateResult } from 'typeorm'; import { IEmployeeProposalTemplate, IPagination, PermissionsEnum } from '@gauzy/contracts'; -import { UUIDValidationPipe, UseValidationPipe } from './../shared/pipes'; -import { PermissionGuard, TenantPermissionGuard } from './../shared/guards'; -import { Permissions } from './../shared/decorators'; -import { CrudController, PaginationParams } from './../core/crud'; +import { CrudController, Permissions, PermissionGuard, TenantPermissionGuard, UUIDValidationPipe, UseValidationPipe, PaginationParams } from '@gauzy/core'; import { EmployeeProposalTemplate } from './employee-proposal-template.entity'; import { EmployeeProposalTemplateService } from './employee-proposal-template.service'; import { CreateProposalTemplateDTO, UpdateProposalTemplateDTO } from './dto'; @@ -24,7 +20,7 @@ import { CreateProposalTemplateDTO, UpdateProposalTemplateDTO } from './dto'; @ApiTags('EmployeeProposalTemplate') @UseGuards(TenantPermissionGuard, PermissionGuard) @Permissions(PermissionsEnum.ORG_PROPOSAL_TEMPLATES_EDIT) -@Controller() +@Controller('/employee-proposal-template') export class EmployeeProposalTemplateController extends CrudController { constructor(private readonly employeeProposalTemplateService: EmployeeProposalTemplateService) { super(employeeProposalTemplateService); @@ -78,11 +74,7 @@ export class EmployeeProposalTemplateController extends CrudController ): Promise> { - try { - return await this.employeeProposalTemplateService.findAll(params); - } catch (error) { - throw new BadRequestException(error); - } + return await this.employeeProposalTemplateService.findAll(params); } /** diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.entity.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.entity.ts similarity index 84% rename from packages/core/src/employee-proposal-template/employee-proposal-template.entity.ts rename to packages/plugins/job-proposal-template/src/employee-proposal-template.entity.ts index d135655a100..70f61a45f8b 100644 --- a/packages/core/src/employee-proposal-template/employee-proposal-template.entity.ts +++ b/packages/plugins/job-proposal-template/src/employee-proposal-template.entity.ts @@ -1,11 +1,7 @@ -import { RelationId } from 'typeorm'; import { ApiProperty } from '@nestjs/swagger'; +import { RelationId } from 'typeorm'; import { IEmployee, IEmployeeProposalTemplate } from '@gauzy/contracts'; -import { - Employee, - TenantOrganizationBaseEntity -} from '../core/entities/internal'; -import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToOne } from './../core/decorators/entity'; +import { ColumnIndex, Employee, MultiORMColumn, MultiORMEntity, MultiORMManyToOne, TenantOrganizationBaseEntity } from '@gauzy/core'; import { MikroOrmEmployeeProposalTemplateRepository } from './repository/mikro-orm-employee-proposal-template.repository'; @MultiORMEntity('employee_proposal_template', { mikroOrmRepository: () => MikroOrmEmployeeProposalTemplateRepository }) @@ -32,8 +28,8 @@ export class EmployeeProposalTemplate extends TenantOrganizationBaseEntity | @ManyToOne |-------------------------------------------------------------------------- */ - @ApiProperty({ type: () => Employee }) @MultiORMManyToOne(() => Employee, { + /** Database cascade action on delete. */ onDelete: 'CASCADE' }) employee?: IEmployee; diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.service.spec.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.service.spec.ts similarity index 100% rename from packages/core/src/employee-proposal-template/employee-proposal-template.service.spec.ts rename to packages/plugins/job-proposal-template/src/employee-proposal-template.service.spec.ts diff --git a/packages/core/src/employee-proposal-template/employee-proposal-template.service.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts similarity index 62% rename from packages/core/src/employee-proposal-template/employee-proposal-template.service.ts rename to packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts index e0021720c76..4a7eeaaa54a 100644 --- a/packages/core/src/employee-proposal-template/employee-proposal-template.service.ts +++ b/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts @@ -1,29 +1,26 @@ import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; import { IEmployeeProposalTemplate } from '@gauzy/contracts'; -import { PaginationParams, TenantAwareCrudService } from './../core/crud'; +import { PaginationParams, TenantAwareCrudService } from '@gauzy/core'; import { EmployeeProposalTemplate } from './employee-proposal-template.entity'; -import { TypeOrmEmployeeProposalTemplateRepository } from './repository/type-orm-employee-proposal-template.repository'; -import { MikroOrmEmployeeProposalTemplateRepository } from './repository/mikro-orm-employee-proposal-template.repository'; +import { MikroOrmEmployeeProposalTemplateRepository, TypeOrmEmployeeProposalTemplateRepository } from './repository'; @Injectable() export class EmployeeProposalTemplateService extends TenantAwareCrudService { constructor( - @InjectRepository(EmployeeProposalTemplate) typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, - mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository ) { super(typeOrmEmployeeProposalTemplateRepository, mikroOrmEmployeeProposalTemplateRepository); } /** + * Toggles the default status of a proposal template. * - * @param id - * @returns + * @param id - The ID of the proposal template. + * @returns The updated proposal template. */ async makeDefault(id: IEmployeeProposalTemplate['id']): Promise { - const proposalTemplate: IEmployeeProposalTemplate = await this.findOneByIdString(id); + const proposalTemplate = await this.findOneByIdString(id); proposalTemplate.isDefault = !proposalTemplate.isDefault; const { organizationId, tenantId, employeeId } = proposalTemplate; @@ -32,16 +29,16 @@ export class EmployeeProposalTemplateService extends TenantAwareCrudService) { - return await super.findAll(params); + return super.findAll(params); } } diff --git a/packages/plugins/job-proposal-template/src/index.ts b/packages/plugins/job-proposal-template/src/index.ts new file mode 100644 index 00000000000..2d1eda9580e --- /dev/null +++ b/packages/plugins/job-proposal-template/src/index.ts @@ -0,0 +1 @@ +export * from './job-proposal-template.plugin'; diff --git a/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts b/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts new file mode 100644 index 00000000000..d9c13f4de36 --- /dev/null +++ b/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts @@ -0,0 +1,40 @@ + +import { CqrsModule } from '@nestjs/cqrs'; +import { GauzyCorePlugin, IOnPluginBootstrap, IOnPluginDestroy } from '@gauzy/plugin'; +import { RolePermissionModule } from '@gauzy/core'; +import { EmployeeProposalTemplate } from './employee-proposal-template.entity'; +import { EmployeeProposalTemplateController } from './employee-proposal-template.controller'; +import { EmployeeProposalTemplateService } from './employee-proposal-template.service'; +import { TypeOrmEmployeeProposalTemplateRepository } from './repository/type-orm-employee-proposal-template.repository'; + +@GauzyCorePlugin({ + imports: [RolePermissionModule, CqrsModule], + entities: [EmployeeProposalTemplate], + controllers: [EmployeeProposalTemplateController], + providers: [EmployeeProposalTemplateService, TypeOrmEmployeeProposalTemplateRepository] +}) +export class JobProposalTemplatePlugin implements IOnPluginBootstrap, IOnPluginDestroy { + + // We disable by default additional logging for each event to avoid cluttering the logs + private logEnabled = true; + + constructor() { } + + /** + * Called when the plugin is being initialized. + */ + onPluginBootstrap(): void | Promise { + if (this.logEnabled) { + console.log(`${JobProposalTemplatePlugin.name} is being bootstrapped...`); + } + } + + /** + * Called when the plugin is being destroyed. + */ + onPluginDestroy(): void | Promise { + if (this.logEnabled) { + console.log(`${JobProposalTemplatePlugin.name} is being destroyed...`); + } + } +} diff --git a/packages/plugins/job-proposal-template/src/repository/index.ts b/packages/plugins/job-proposal-template/src/repository/index.ts new file mode 100644 index 00000000000..bf3f1a64d50 --- /dev/null +++ b/packages/plugins/job-proposal-template/src/repository/index.ts @@ -0,0 +1,2 @@ +export * from './mikro-orm-employee-proposal-template.repository'; +export * from './type-orm-employee-proposal-template.repository'; diff --git a/packages/core/src/employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository.ts b/packages/plugins/job-proposal-template/src/repository/mikro-orm-employee-proposal-template.repository.ts similarity index 66% rename from packages/core/src/employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository.ts rename to packages/plugins/job-proposal-template/src/repository/mikro-orm-employee-proposal-template.repository.ts index 07212d02392..ae4b10b077a 100644 --- a/packages/core/src/employee-proposal-template/repository/mikro-orm-employee-proposal-template.repository.ts +++ b/packages/plugins/job-proposal-template/src/repository/mikro-orm-employee-proposal-template.repository.ts @@ -1,4 +1,4 @@ -import { MikroOrmBaseEntityRepository } from '../../core/repository/mikro-orm-base-entity.repository'; +import { MikroOrmBaseEntityRepository } from '@gauzy/core'; import { EmployeeProposalTemplate } from '../employee-proposal-template.entity'; export class MikroOrmEmployeeProposalTemplateRepository extends MikroOrmBaseEntityRepository { } diff --git a/packages/core/src/employee-proposal-template/repository/type-orm-employee-proposal-template.repository.ts b/packages/plugins/job-proposal-template/src/repository/type-orm-employee-proposal-template.repository.ts similarity index 100% rename from packages/core/src/employee-proposal-template/repository/type-orm-employee-proposal-template.repository.ts rename to packages/plugins/job-proposal-template/src/repository/type-orm-employee-proposal-template.repository.ts From f307cd3f71d1b5fc9ae55585a8ef73e5c5eb5cf2 Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:04:51 +0530 Subject: [PATCH 3/6] feat: inclusion of job proposal template plugin in APIs --- apps/api/package.json | 7 ++++--- apps/api/src/plugins.ts | 17 +++++++++++------ package.json | 4 +++- .../plugins/job-proposal-template/package.json | 2 ++ .../src/job-proposal-template.plugin.ts | 9 ++++++++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/apps/api/package.json b/apps/api/package.json index 883e1ed066a..fd819334c72 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -40,12 +40,13 @@ "seed:prod:build": "yarn ng run api:seed -c=production" }, "dependencies": { - "@gauzy/core": "^0.1.0", "@gauzy/changelog-plugin": "^0.1.0", - "@gauzy/knowledge-base-plugin": "^0.1.0", + "@gauzy/core": "^0.1.0", "@gauzy/jitsu-analytics-plugin": "^0.1.0", - "@gauzy/sentry-plugin": "^0.1.0", + "@gauzy/job-proposal-template-plugin": "^0.1.0", "@gauzy/job-search-plugin": "^0.1.0", + "@gauzy/knowledge-base-plugin": "^0.1.0", + "@gauzy/sentry-plugin": "^0.1.0", "dotenv": "^16.0.3", "yargs": "^17.5.0" }, diff --git a/apps/api/src/plugins.ts b/apps/api/src/plugins.ts index bd71d65b568..5d92394a37b 100644 --- a/apps/api/src/plugins.ts +++ b/apps/api/src/plugins.ts @@ -3,6 +3,7 @@ import { ChangelogPlugin } from '@gauzy/changelog-plugin'; import { JitsuAnalyticsPlugin } from '@gauzy/jitsu-analytics-plugin'; import { KnowledgeBasePlugin } from '@gauzy/knowledge-base-plugin'; import { JobSearchPlugin } from '@gauzy/job-search-plugin'; +import { JobProposalTemplatePlugin } from '@gauzy/job-proposal-template-plugin'; import { SentryTracing as SentryPlugin } from './sentry'; const { jitsu, sentry } = environment; @@ -11,12 +12,6 @@ const { jitsu, sentry } = environment; * An array of plugins to be included or used in the codebase. */ export const plugins = [ - // Indicates the inclusion or intention to use the JobSearchPlugin in the codebase. - JobSearchPlugin, - // Indicates the inclusion or intention to use the ChangelogPlugin in the codebase. - ChangelogPlugin, - // Indicates the inclusion or intention to use the KnowledgeBasePlugin in the codebase. - KnowledgeBasePlugin, // Initializes the Jitsu Analytics Plugin by providing a configuration object. JitsuAnalyticsPlugin.init({ config: { @@ -28,4 +23,14 @@ export const plugins = [ }), // Includes the SentryPlugin based on the presence of Sentry configuration. ...(sentry && sentry.dsn ? [SentryPlugin] : []), + // Indicates the inclusion or intention to use the ChangelogPlugin in the codebase. + ChangelogPlugin, + // Indicates the inclusion or intention to use the KnowledgeBasePlugin in the codebase. + KnowledgeBasePlugin, + // Indicates the inclusion or intention to use the JobSearchPlugin in the codebase. + JobSearchPlugin, + // Indicates the inclusion or intention to use the JobSearchPlugin in the codebase. + JobSearchPlugin, + // Indicates the inclusion or intention to use the JobProposalTemplatePlugin in the codebase. + JobProposalTemplatePlugin ]; diff --git a/package.json b/package.json index 29dadbaf565..4cfca94924c 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "build:package:plugin:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugin build", "build:package:plugins:pre": "yarn run build:package:plugin:integration-ai && yarn run build:package:plugin:integration-hubstaff && yarn run build:package:plugin:integration-upwork && yarn run build:package:plugin:integration-github && yarn run build:package:plugin:integration-jira", "build:package:plugins:pre:prod": "yarn run build:package:plugin:integration-ai:prod && yarn run build:package:plugin:integration-hubstaff:prod && yarn run build:package:plugin:integration-upwork:prod && yarn run build:package:plugin:integration-github:prod && yarn run build:package:plugin:integration-jira:prod", - "build:package:plugins:post": "yarn run build:package:plugin:sentry && yarn run build:package:plugin:jitsu-analytic && yarn run build:package:plugin:product-reviews && yarn run build:package:plugin:job-search && yarn run build:package:plugin:knowledge-base && yarn run build:package:plugin:changelog", + "build:package:plugins:post": "yarn run build:package:plugin:sentry && yarn run build:package:plugin:jitsu-analytic && yarn run build:package:plugin:product-reviews && yarn run build:package:plugin:job-search && yarn run build:package:plugin:job-proposal-template && yarn run build:package:plugin:knowledge-base && yarn run build:package:plugin:changelog", "build:package:plugins:post:prod": "yarn run build:package:plugin:sentry:prod && yarn run build:package:plugin:jitsu-analytic:prod && yarn run build:package:plugin:product-reviews:prod && yarn run build:package:plugin:job-search:prod && yarn run build:package:plugin:knowledge-base:prod && yarn run build:package:plugin:changelog:prod", "build:package:plugin:integration-ai": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-ai build", "build:package:plugin:integration-ai:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-ai build", @@ -153,6 +153,8 @@ "build:package:plugin:product-reviews:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/product-reviews build", "build:package:plugin:job-search": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/job-search build", "build:package:plugin:job-search:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/job-search build", + "build:package:plugin:job-proposal-template": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/job-proposal-template build", + "build:package:plugin:job-proposal-template:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/job-proposal-template build", "build:package:plugin:knowledge-base": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/knowledge-base build", "build:package:plugin:knowledge-base:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/knowledge-base build", "build:package:plugin:changelog": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/changelog build", diff --git a/packages/plugins/job-proposal-template/package.json b/packages/plugins/job-proposal-template/package.json index 2e16d7d6526..01dd8325aff 100644 --- a/packages/plugins/job-proposal-template/package.json +++ b/packages/plugins/job-proposal-template/package.json @@ -31,8 +31,10 @@ "@gauzy/contracts": "^0.1.0", "@gauzy/core": "^0.1.0", "@gauzy/plugin": "^0.1.0", + "@mikro-orm/nestjs": "^5.2.3", "@nestjs/common": "^10.3.7", "@nestjs/swagger": "^7.3.0", + "@nestjs/typeorm": "^10.0.2", "typeorm": "^0.3.20" }, "devDependencies": { diff --git a/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts b/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts index d9c13f4de36..100d811f3a2 100644 --- a/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts +++ b/packages/plugins/job-proposal-template/src/job-proposal-template.plugin.ts @@ -1,4 +1,6 @@ +import { TypeOrmModule } from '@nestjs/typeorm'; +import { MikroOrmModule } from '@mikro-orm/nestjs'; import { CqrsModule } from '@nestjs/cqrs'; import { GauzyCorePlugin, IOnPluginBootstrap, IOnPluginDestroy } from '@gauzy/plugin'; import { RolePermissionModule } from '@gauzy/core'; @@ -8,7 +10,12 @@ import { EmployeeProposalTemplateService } from './employee-proposal-template.se import { TypeOrmEmployeeProposalTemplateRepository } from './repository/type-orm-employee-proposal-template.repository'; @GauzyCorePlugin({ - imports: [RolePermissionModule, CqrsModule], + imports: [ + TypeOrmModule.forFeature([EmployeeProposalTemplate]), + MikroOrmModule.forFeature([EmployeeProposalTemplate]), + RolePermissionModule, + CqrsModule + ], entities: [EmployeeProposalTemplate], controllers: [EmployeeProposalTemplateController], providers: [EmployeeProposalTemplateService, TypeOrmEmployeeProposalTemplateRepository] From f44692687914f2d21fa5e4ffd48df77bb50546b9 Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:10:38 +0530 Subject: [PATCH 4/6] fix: docker build --- .deploy/api/Dockerfile | 2 ++ .deploy/webapp/Dockerfile | 1 + apps/desktop/src/package.json | 14 ++++++++------ apps/server/src/package.json | 8 +++++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.deploy/api/Dockerfile b/.deploy/api/Dockerfile index ac1e6d59e92..b018a588141 100644 --- a/.deploy/api/Dockerfile +++ b/.deploy/api/Dockerfile @@ -160,6 +160,7 @@ COPY --chown=node:node packages/plugins/product-reviews/package.json ./packages/ COPY --chown=node:node packages/plugins/knowledge-base/package.json ./packages/plugins/knowledge-base/ COPY --chown=node:node packages/plugins/changelog/package.json ./packages/plugins/changelog/ COPY --chown=node:node packages/plugins/job-search/package.json ./packages/plugins/job-search/ +COPY --chown=node:node packages/plugins/job-proposal-template/package.json ./packages/plugins/job-proposal-template/ # We do not build here Wakatime plugin, because it used in Desktop Apps for now # COPY --chown=node:node packages/plugins/integration-wakatime/package.json ./packages/plugins/integration-wakatime/ @@ -217,6 +218,7 @@ COPY --chown=node:node packages/plugins/product-reviews/package.json ./packages/ COPY --chown=node:node packages/plugins/knowledge-base/package.json ./packages/plugins/knowledge-base/ COPY --chown=node:node packages/plugins/changelog/package.json ./packages/plugins/changelog/ COPY --chown=node:node packages/plugins/job-search/package.json ./packages/plugins/job-search/ +COPY --chown=node:node packages/plugins/job-proposal-template/package.json ./packages/plugins/job-proposal-template/ # We do not build here Wakatime plugin, because it used in Desktop Apps for now # COPY --chown=node:node packages/plugins/integration-wakatime/package.json ./packages/plugins/integration-wakatime/ diff --git a/.deploy/webapp/Dockerfile b/.deploy/webapp/Dockerfile index e186f54476d..fbec6d93875 100644 --- a/.deploy/webapp/Dockerfile +++ b/.deploy/webapp/Dockerfile @@ -75,6 +75,7 @@ COPY --chown=node:node packages/plugins/job-search/package.json ./packages/plugi COPY --chown=node:node packages/plugins/product-reviews/package.json ./packages/plugins/product-reviews/ COPY --chown=node:node packages/plugins/knowledge-base/package.json ./packages/plugins/knowledge-base/ COPY --chown=node:node packages/plugins/changelog/package.json ./packages/plugins/changelog/ +COPY --chown=node:node packages/plugins/job-proposal-template/package.json ./packages/plugins/job-proposal-template/ # We do not build here Wakatime plugin, because it used in Desktop Apps for now # COPY --chown=node:node packages/plugins/integration-wakatime/package.json ./packages/plugins/integration-wakatime/ diff --git a/apps/desktop/src/package.json b/apps/desktop/src/package.json index 06d9bf4a38a..bcda857080c 100644 --- a/apps/desktop/src/package.json +++ b/apps/desktop/src/package.json @@ -38,7 +38,8 @@ "../../../packages/plugins/changelog", "../../../packages/plugins/jitsu-analytics", "../../../packages/plugins/sentry-tracing", - "../../../packages/plugins/job-search" + "../../../packages/plugins/job-search", + "../../../packages/plugins/job-proposal-template" ] }, "build": { @@ -144,8 +145,9 @@ "@gauzy/desktop-libs": "^0.1.0", "@gauzy/desktop-window": "^0.1.0", "@gauzy/jitsu-analytics-plugin": "^0.1.0", - "@gauzy/knowledge-base-plugin": "^0.1.0", + "@gauzy/job-proposal-template-plugin": "^0.1.0", "@gauzy/job-search-plugin": "^0.1.0", + "@gauzy/knowledge-base-plugin": "^0.1.0", "@gauzy/sentry-plugin": "^0.1.0", "@nestjs/platform-express": "^10.3.7", "@sentry/electron": "^4.18.0", @@ -160,11 +162,14 @@ "electron-store": "^8.1.0", "electron-updater": "^6.1.7", "electron-util": "^0.17.2", + "embedded-queue": "^0.0.11", "ffi-napi": "^4.0.3", "form-data": "^3.0.0", "htmlparser2": "^8.0.2", "iconv": "^3.0.1", "knex": "^3.1.0", + "locutus": "^2.0.30", + "mac-screen-capture-permissions": "^2.1.0", "moment": "^2.29.4", "node-fetch": "^2.6.7", "node-notifier": "^8.0.0", @@ -172,16 +177,13 @@ "pdfmake": "^0.2.0", "pg-query-stream": "^4.5.4", "pg": "^8.11.4", + "screenshot-desktop": "^1.15.0", "sound-play": "1.1.0", "sqlite3": "^5.1.7", "squirrelly": "^8.0.8", "tslib": "^2.3.0", "twing": "^5.0.2", - "locutus": "^2.0.30", "underscore": "^1.13.3", - "screenshot-desktop": "^1.15.0", - "mac-screen-capture-permissions": "^2.1.0", - "embedded-queue": "^0.0.11", "undici": "^6.10.2" }, "optionalDependencies": { diff --git a/apps/server/src/package.json b/apps/server/src/package.json index ff0a89f0c15..7f9ecafeb4c 100755 --- a/apps/server/src/package.json +++ b/apps/server/src/package.json @@ -39,7 +39,8 @@ "../../../packages/plugins/changelog", "../../../packages/plugins/jitsu-analytics", "../../../packages/plugins/sentry-tracing", - "../../../packages/plugins/job-search" + "../../../packages/plugins/job-search", + "../../../packages/plugins/job-proposal-template" ] }, "build": { @@ -142,8 +143,9 @@ "@gauzy/desktop-libs": "^0.1.0", "@gauzy/desktop-window": "^0.1.0", "@gauzy/jitsu-analytics-plugin": "^0.1.0", - "@gauzy/knowledge-base-plugin": "^0.1.0", + "@gauzy/job-proposal-template-plugin": "^0.1.0", "@gauzy/job-search-plugin": "^0.1.0", + "@gauzy/knowledge-base-plugin": "^0.1.0", "@gauzy/sentry-plugin": "^0.1.0", "@nestjs/platform-express": "^10.3.7", "@sentry/electron": "^4.18.0", @@ -163,6 +165,7 @@ "htmlparser2": "^8.0.2", "iconv": "^3.0.1", "knex": "^3.1.0", + "locutus": "^2.0.30", "moment": "^2.29.4", "node-fetch": "^2.6.7", "node-notifier": "^8.0.0", @@ -175,7 +178,6 @@ "squirrelly": "^8.0.8", "tslib": "^2.3.0", "twing": "^5.0.2", - "locutus": "^2.0.30", "underscore": "^1.13.3", "undici": "^6.10.2" }, From 5cc56797d255fbcd494e03f4d80fd19688a4f8b5 Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:19:05 +0530 Subject: [PATCH 5/6] fix: added missing await/async --- apps/server/src/package.json | 2 +- .../src/employee-proposal-template.service.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/server/src/package.json b/apps/server/src/package.json index 7f9ecafeb4c..b43c25243c0 100755 --- a/apps/server/src/package.json +++ b/apps/server/src/package.json @@ -198,4 +198,4 @@ "node16-win-x64" ] } -} +} \ No newline at end of file diff --git a/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts b/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts index 4a7eeaaa54a..08bb03574e0 100644 --- a/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts +++ b/packages/plugins/job-proposal-template/src/employee-proposal-template.service.ts @@ -7,8 +7,8 @@ import { MikroOrmEmployeeProposalTemplateRepository, TypeOrmEmployeeProposalTemp @Injectable() export class EmployeeProposalTemplateService extends TenantAwareCrudService { constructor( - typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, - mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository + readonly typeOrmEmployeeProposalTemplateRepository: TypeOrmEmployeeProposalTemplateRepository, + readonly mikroOrmEmployeeProposalTemplateRepository: MikroOrmEmployeeProposalTemplateRepository ) { super(typeOrmEmployeeProposalTemplateRepository, mikroOrmEmployeeProposalTemplateRepository); } @@ -20,7 +20,7 @@ export class EmployeeProposalTemplateService extends TenantAwareCrudService { - const proposalTemplate = await this.findOneByIdString(id); + const proposalTemplate: IEmployeeProposalTemplate = await this.findOneByIdString(id); proposalTemplate.isDefault = !proposalTemplate.isDefault; const { organizationId, tenantId, employeeId } = proposalTemplate; @@ -29,7 +29,7 @@ export class EmployeeProposalTemplateService extends TenantAwareCrudService) { - return super.findAll(params); + return await super.findAll(params); } } From 2539558ff25f737a83334368f981580f5dfc5673 Mon Sep 17 00:00:00 2001 From: RAHUL RATHORE <41804588+rahul-rocket@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:23:45 +0530 Subject: [PATCH 6/6] fix: removed duplicate plugins --- apps/api/src/plugins.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/api/src/plugins.ts b/apps/api/src/plugins.ts index 5d92394a37b..80e5afaacd4 100644 --- a/apps/api/src/plugins.ts +++ b/apps/api/src/plugins.ts @@ -12,6 +12,8 @@ const { jitsu, sentry } = environment; * An array of plugins to be included or used in the codebase. */ export const plugins = [ + // Includes the SentryPlugin based on the presence of Sentry configuration. + ...(sentry && sentry.dsn ? [SentryPlugin] : []), // Initializes the Jitsu Analytics Plugin by providing a configuration object. JitsuAnalyticsPlugin.init({ config: { @@ -21,16 +23,12 @@ export const plugins = [ echoEvents: jitsu.echoEvents } }), - // Includes the SentryPlugin based on the presence of Sentry configuration. - ...(sentry && sentry.dsn ? [SentryPlugin] : []), // Indicates the inclusion or intention to use the ChangelogPlugin in the codebase. ChangelogPlugin, // Indicates the inclusion or intention to use the KnowledgeBasePlugin in the codebase. KnowledgeBasePlugin, // Indicates the inclusion or intention to use the JobSearchPlugin in the codebase. JobSearchPlugin, - // Indicates the inclusion or intention to use the JobSearchPlugin in the codebase. - JobSearchPlugin, // Indicates the inclusion or intention to use the JobProposalTemplatePlugin in the codebase. JobProposalTemplatePlugin ];