From e2632a5d14928b7b502df06f100ea0d05347152d Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Sun, 26 Sep 2021 11:16:55 +0200 Subject: [PATCH] initial `server-recruit-resources` Signed-off-by: Andrey Platov --- common/config/rush/pnpm-lock.yaml | 56 ++++++++++-------------- plugins/recruit-resources/src/plugin.ts | 3 +- plugins/recruit/src/index.ts | 5 ++- rush.json | 5 +++ server/recruit-resources/.eslintrc.js | 6 +++ server/recruit-resources/.npmignore | 4 ++ server/recruit-resources/config/rig.json | 18 ++++++++ server/recruit-resources/package.json | 26 +++++++++++ server/recruit-resources/src/index.ts | 43 ++++++++++++++++++ server/recruit-resources/tsconfig.json | 8 ++++ 10 files changed, 138 insertions(+), 36 deletions(-) create mode 100644 server/recruit-resources/.eslintrc.js create mode 100644 server/recruit-resources/.npmignore create mode 100644 server/recruit-resources/config/rig.json create mode 100644 server/recruit-resources/package.json create mode 100644 server/recruit-resources/src/index.ts create mode 100644 server/recruit-resources/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 5f83e38166..edfbe3c0c7 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -53,6 +53,7 @@ specifiers: '@rush-temp/server-chunter': file:./projects/server-chunter.tgz '@rush-temp/server-chunter-resources': file:./projects/server-chunter-resources.tgz '@rush-temp/server-core': file:./projects/server-core.tgz + '@rush-temp/server-recruit-resources': file:./projects/server-recruit-resources.tgz '@rush-temp/server-ws': file:./projects/server-ws.tgz '@rush-temp/task': file:./projects/task.tgz '@rush-temp/task-assets': file:./projects/task-assets.tgz @@ -120,7 +121,6 @@ specifiers: sass-loader: ^12.1.0 simplytyped: ^3.3.0 style-loader: ^3.2.1 - svelte-check: ^2.2.5 svelte-preprocess: ^4.7.4 svgo-loader: ^3.0.0 toposort: ^2.0.2 @@ -185,6 +185,7 @@ dependencies: '@rush-temp/server-chunter': file:projects/server-chunter.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/server-chunter-resources': file:projects/server-chunter-resources.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/server-core': file:projects/server-core.tgz_6c259fadfeb3a4b20890aefe87070b8b + '@rush-temp/server-recruit-resources': file:projects/server-recruit-resources.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/server-ws': file:projects/server-ws.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/task': file:projects/task.tgz_6c259fadfeb3a4b20890aefe87070b8b '@rush-temp/task-assets': file:projects/task-assets.tgz @@ -252,7 +253,6 @@ dependencies: sass-loader: 12.1.0_sass@1.37.5+webpack@5.48.0 simplytyped: 3.3.0_typescript@4.3.5 style-loader: 3.2.1_webpack@5.48.0 - svelte-check: 2.2.5_8d5e7d8774dfc5d41599a7408187eba0 svelte-preprocess: 4.7.4_50400bf9937d80c38e5edf397791f1b6 svgo-loader: 3.0.0 toposort: 2.0.2 @@ -8171,34 +8171,6 @@ packages: supports-color: 7.2.0 dev: false - /svelte-check/2.2.5_8d5e7d8774dfc5d41599a7408187eba0: - resolution: {integrity: sha512-EstDoqxjqWStWELh7Z0qytqUDl/ikdNEr21dveNc4fUDnhnqO2F2jHEufqoNnC3GfBji3GIUHvoXsp/I5lMbCg==} - hasBin: true - peerDependencies: - svelte: ^3.24.0 - dependencies: - chalk: 4.1.2 - chokidar: 3.4.3 - glob: 7.1.7 - import-fresh: 3.3.0 - minimist: 1.2.5 - sade: 1.7.4 - source-map: 0.7.3 - svelte-preprocess: 4.7.4_50400bf9937d80c38e5edf397791f1b6 - typescript: 4.3.5 - transitivePeerDependencies: - - '@babel/core' - - coffeescript - - less - - node-sass - - postcss - - postcss-load-config - - pug - - sass - - stylus - - sugarss - dev: false - /svelte-check/2.2.6_635b56cd8c077c5dd126b6e20db90d4b: resolution: {integrity: sha512-oJux/afbmcZO+N+ADXB88h6XANLie8Y2rh2qBlhgfkpr2c3t/q/T0w2JWrHqagaDL8zeNwO8a8RVFBkrRox8gg==} hasBin: true @@ -9908,7 +9880,7 @@ packages: dev: false file:projects/model-recruit.tgz_6c259fadfeb3a4b20890aefe87070b8b: - resolution: {integrity: sha512-ylv971t0n3lj8VGA0t6gjli0YgZ/JGfIYq0sEHEz6eiStCzNU/0JmvuNBVXNkzikP082v92hFoqTM5YSOp5b9g==, tarball: file:projects/model-recruit.tgz} + resolution: {integrity: sha512-KMPiYvEBiBkv3eI+7SoWS9T517ad6A+UX665xJq9qW3Woit47y2EdKpapWps2Pgb91Z33q3sfVY/bXC/y7sQ4A==, tarball: file:projects/model-recruit.tgz} id: file:projects/model-recruit.tgz name: '@rush-temp/model-recruit' version: 0.0.0 @@ -10069,7 +10041,7 @@ packages: dev: false file:projects/panel.tgz_c38cf1a7a413db8918b0b4754c21e4c5: - resolution: {integrity: sha512-qi/4kQnD9wGgk340sL69M3J1yRd6ffnE1khsB3cHG9csUoI1GiCYiP5pXsi1292rRhO7aEjuJfuylHhYbvdLdw==, tarball: file:projects/panel.tgz} + resolution: {integrity: sha512-5z0G2tL0kPAetlvgPy7DuUV65vgcUvDVrr4L5dxztgbWxCp6v6zR2QfWKoPKHCtj/szm+s1XwbLKcF0ETmZU/w==, tarball: file:projects/panel.tgz} id: file:projects/panel.tgz name: '@rush-temp/panel' version: 0.0.0 @@ -10166,7 +10138,7 @@ packages: dev: false file:projects/presentation.tgz_c38cf1a7a413db8918b0b4754c21e4c5: - resolution: {integrity: sha512-40ahmahal+a+1hgyBS7oEkNiw/KUOxVlUjK/lT3isHWjdrjkU81GiX6Bs1MQqpptXh+HImYoJ8TLCRPryCztJA==, tarball: file:projects/presentation.tgz} + resolution: {integrity: sha512-mX/Fwzm3x155pv36+PFu0pFe2fVU6bKwBV9GvEJtuVKlyaTL1QIyQ0QRt+/qHKVQcDkwtZ5RqS0hQsP2FoseNw==, tarball: file:projects/presentation.tgz} id: file:projects/presentation.tgz name: '@rush-temp/presentation' version: 0.0.0 @@ -10356,6 +10328,24 @@ packages: - typescript dev: false + file:projects/server-recruit-resources.tgz_6c259fadfeb3a4b20890aefe87070b8b: + resolution: {integrity: sha512-NpUKAVVdcoS+8SN0/6ZFQABo2NvkgGBC77SOdmXEU6kt5xXHIZK0HzE6LNNbY3GRtjLgh/JSEWlYigYPTp8uiA==, tarball: file:projects/server-recruit-resources.tgz} + id: file:projects/server-recruit-resources.tgz + name: '@rush-temp/server-recruit-resources' + version: 0.0.0 + dependencies: + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea + eslint: 7.32.0 + eslint-plugin-import: 2.23.4_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 4.3.1 + transitivePeerDependencies: + - '@typescript-eslint/parser' + - supports-color + - typescript + dev: false + file:projects/server-ws.tgz_6c259fadfeb3a4b20890aefe87070b8b: resolution: {integrity: sha512-2g/EdTVTXnGA98667Tow9pXEthXzrp4PnkDiic31vMJHuEMTdQ4CUBdF2N+lDz6OiFXDP8/Ak0MfSKNawXY3Ug==, tarball: file:projects/server-ws.tgz} id: file:projects/server-ws.tgz diff --git a/plugins/recruit-resources/src/plugin.ts b/plugins/recruit-resources/src/plugin.ts index 6d85a65c88..ccaadfbfcd 100644 --- a/plugins/recruit-resources/src/plugin.ts +++ b/plugins/recruit-resources/src/plugin.ts @@ -29,8 +29,7 @@ export default mergeIds(recruitId, recruit, { class: { Vacancy: '' as Ref>, Candidates: '' as Ref>, - Candidate: '' as Ref>, - Applicant: '' as Ref>, + Candidate: '' as Ref> }, string: { CreateVacancy: '' as IntlString, diff --git a/plugins/recruit/src/index.ts b/plugins/recruit/src/index.ts index b095c3e211..2dca69fd14 100644 --- a/plugins/recruit/src/index.ts +++ b/plugins/recruit/src/index.ts @@ -15,7 +15,7 @@ import { plugin } from '@anticrm/platform' import type { Plugin, Asset } from '@anticrm/platform' -import type { Space, SpaceWithStates, Doc, Ref, State, Bag } from '@anticrm/core' +import type { Space, SpaceWithStates, Doc, Ref, State, Bag, Class } from '@anticrm/core' import type { Person } from '@anticrm/contact' import type { Attachment } from '@anticrm/chunter' @@ -51,6 +51,9 @@ export interface Applicant extends Doc { export const recruitId = 'recruit' as Plugin export default plugin(recruitId, { + class: { + Applicant: '' as Ref> + }, icon: { RecruitApplication: '' as Asset, Vacancy: '' as Asset diff --git a/rush.json b/rush.json index e9b5275d9c..8239906c73 100644 --- a/rush.json +++ b/rush.json @@ -721,6 +721,11 @@ "projectFolder": "server/chunter-resources", "shouldPublish": true }, + { + "packageName": "@anticrm/server-recruit-resources", + "projectFolder": "server/recruit-resources", + "shouldPublish": true + }, { "packageName": "@anticrm/mongo", "projectFolder": "server/mongo", diff --git a/server/recruit-resources/.eslintrc.js b/server/recruit-resources/.eslintrc.js new file mode 100644 index 0000000000..89f8151bd4 --- /dev/null +++ b/server/recruit-resources/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + project: './tsconfig.json' + } +} \ No newline at end of file diff --git a/server/recruit-resources/.npmignore b/server/recruit-resources/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/server/recruit-resources/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/server/recruit-resources/config/rig.json b/server/recruit-resources/config/rig.json new file mode 100644 index 0000000000..af1257a896 --- /dev/null +++ b/server/recruit-resources/config/rig.json @@ -0,0 +1,18 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + + /** + * (Required) The name of the rig package to inherit from. + * It should be an NPM package name with the "-rig" suffix. + */ + "rigPackageName": "@anticrm/platform-rig" + + /** + * (Optional) Selects a config profile from the rig package. The name must consist of + * lowercase alphanumeric words separated by hyphens, for example "sample-profile". + * If omitted, then the "default" profile will be used." + */ + // "rigProfile": "your-profile-name" +} diff --git a/server/recruit-resources/package.json b/server/recruit-resources/package.json new file mode 100644 index 0000000000..7e59578bb9 --- /dev/null +++ b/server/recruit-resources/package.json @@ -0,0 +1,26 @@ +{ + "name": "@anticrm/server-recruit-resources", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "lint:fix": "eslint --fix src" + }, + "devDependencies": { + "@anticrm/platform-rig":"~0.6.0", + "@types/heft-jest":"^1.0.2", + "@typescript-eslint/eslint-plugin":"4", + "eslint-plugin-import":"2", + "eslint-plugin-promise":"4", + "eslint-plugin-node":"11", + "eslint":"^7.32.0" + }, + "dependencies": { + "@anticrm/core": "~0.6.11", + "@anticrm/platform": "~0.6.5", + "@anticrm/server-core": "~0.6.0", + "@anticrm/recruit": "~0.6.0" + } +} diff --git a/server/recruit-resources/src/index.ts b/server/recruit-resources/src/index.ts new file mode 100644 index 0000000000..6a602a14fa --- /dev/null +++ b/server/recruit-resources/src/index.ts @@ -0,0 +1,43 @@ +// +// Copyright © 2020, 2021 Anticrm Platform Contributors. +// Copyright © 2021 Hardcore Engineering Inc. +// +// Licensed under the Eclipse Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may +// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import type { Tx, TxCreateDoc, TxFactory } from '@anticrm/core' +import type { Applicant } from '@anticrm/recruit' + +import recruit from '@anticrm/recruit' +import core from '@anticrm/core' + +/** + * @public + */ +export async function OnApplication (tx: Tx, txFactory: TxFactory): Promise { + if (tx._class === core.class.TxCreateDoc) { + const createTx = tx as TxCreateDoc + if (createTx.objectClass === recruit.class.Applicant) { + // const candidate = createTx.attributes.candidate + // return txFactory.createTxUpdateDoc(recruit.class.Candidate) + return [] + } + } + return [] +} + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export default async () => ({ + trigger: { + OnApplication + } +}) diff --git a/server/recruit-resources/tsconfig.json b/server/recruit-resources/tsconfig.json new file mode 100644 index 0000000000..aeb0517b13 --- /dev/null +++ b/server/recruit-resources/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + } +} \ No newline at end of file