From 5e38409a88cc0fb74b2a54fa0f631b21c5622e8b Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Mon, 20 Jun 2022 10:24:08 +0600 Subject: [PATCH] Hr (#2100) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- common/config/rush/pnpm-lock.yaml | 202 +++++++++++++++++- dev/prod/package.json | 7 +- dev/prod/src/platform-dev.ts | 3 +- dev/prod/src/platform.ts | 3 + dev/tool/package.json | 2 + dev/tool/src/elastic.ts | 2 + models/all/package.json | 4 +- models/all/src/index.ts | 4 + models/all/src/migration.ts | 4 +- models/hr/.eslintrc.js | 7 + models/hr/.npmignore | 4 + models/hr/config/rig.json | 18 ++ models/hr/package.json | 41 ++++ models/hr/src/index.ts | 137 ++++++++++++ models/hr/src/migration.ts | 48 +++++ models/hr/src/plugin.ts | 43 ++++ models/hr/tsconfig.json | 8 + models/server-hr/.eslintrc.js | 7 + models/server-hr/.npmignore | 4 + models/server-hr/config/rig.json | 18 ++ models/server-hr/package.json | 34 +++ models/server-hr/src/index.ts | 26 +++ models/server-hr/tsconfig.json | 8 + packages/core/src/memdb.ts | 24 ++- packages/core/src/operator.ts | 6 + .../src/components/EditableAvatar.svelte | 6 +- .../src/components/SpaceSelect.svelte | 13 +- .../src/components/SpaceSelector.svelte | 21 +- packages/query/src/index.ts | 65 +++--- packages/ui/src/components/ActionIcon.svelte | 2 +- plugins/hr-assets/.eslintrc.js | 7 + plugins/hr-assets/assets/icons.svg | 13 ++ plugins/hr-assets/config/rig.json | 5 + plugins/hr-assets/lang/en.json | 21 ++ plugins/hr-assets/lang/ru.json | 21 ++ plugins/hr-assets/package.json | 34 +++ plugins/hr-assets/src/index.ts | 26 +++ plugins/hr-assets/tsconfig.json | 16 ++ plugins/hr-resources/.eslintrc.js | 7 + plugins/hr-resources/config/rig.json | 5 + plugins/hr-resources/package.json | 46 ++++ plugins/hr-resources/postcss.config.js | 5 + .../src/components/CreateDepartment.svelte | 89 ++++++++ .../src/components/DepartmentCard.svelte | 151 +++++++++++++ .../src/components/DepartmentEditor.svelte | 41 ++++ .../src/components/DepartmentStaff.svelte | 162 ++++++++++++++ .../src/components/EditDepartment.svelte | 164 ++++++++++++++ .../src/components/StaffPresenter.svelte | 36 ++++ .../src/components/Structure.svelte | 85 ++++++++ plugins/hr-resources/src/index.ts | 29 +++ plugins/hr-resources/src/plugin.ts | 36 ++++ plugins/hr-resources/svelte.config.js | 5 + plugins/hr-resources/tsconfig.json | 16 ++ plugins/hr/.eslintrc.js | 7 + plugins/hr/.npmignore | 4 + plugins/hr/config/rig.json | 18 ++ plugins/hr/package.json | 33 +++ plugins/hr/src/index.ts | 68 ++++++ plugins/hr/tsconfig.json | 9 + rush.json | 35 +++ server-plugins/hr-resources/.eslintrc.js | 7 + server-plugins/hr-resources/.npmignore | 4 + server-plugins/hr-resources/config/rig.json | 18 ++ server-plugins/hr-resources/package.json | 35 +++ server-plugins/hr-resources/src/index.ts | 132 ++++++++++++ server-plugins/hr-resources/tsconfig.json | 8 + server-plugins/hr/.eslintrc.js | 7 + server-plugins/hr/.npmignore | 4 + server-plugins/hr/config/rig.json | 18 ++ server-plugins/hr/package.json | 34 +++ server-plugins/hr/src/index.ts | 32 +++ server-plugins/hr/tsconfig.json | 9 + server/server/package.json | 2 + server/server/src/server.ts | 2 + 74 files changed, 2222 insertions(+), 55 deletions(-) create mode 100644 models/hr/.eslintrc.js create mode 100644 models/hr/.npmignore create mode 100644 models/hr/config/rig.json create mode 100644 models/hr/package.json create mode 100644 models/hr/src/index.ts create mode 100644 models/hr/src/migration.ts create mode 100644 models/hr/src/plugin.ts create mode 100644 models/hr/tsconfig.json create mode 100644 models/server-hr/.eslintrc.js create mode 100644 models/server-hr/.npmignore create mode 100644 models/server-hr/config/rig.json create mode 100644 models/server-hr/package.json create mode 100644 models/server-hr/src/index.ts create mode 100644 models/server-hr/tsconfig.json create mode 100644 plugins/hr-assets/.eslintrc.js create mode 100644 plugins/hr-assets/assets/icons.svg create mode 100644 plugins/hr-assets/config/rig.json create mode 100644 plugins/hr-assets/lang/en.json create mode 100644 plugins/hr-assets/lang/ru.json create mode 100644 plugins/hr-assets/package.json create mode 100644 plugins/hr-assets/src/index.ts create mode 100644 plugins/hr-assets/tsconfig.json create mode 100644 plugins/hr-resources/.eslintrc.js create mode 100644 plugins/hr-resources/config/rig.json create mode 100644 plugins/hr-resources/package.json create mode 100644 plugins/hr-resources/postcss.config.js create mode 100644 plugins/hr-resources/src/components/CreateDepartment.svelte create mode 100644 plugins/hr-resources/src/components/DepartmentCard.svelte create mode 100644 plugins/hr-resources/src/components/DepartmentEditor.svelte create mode 100644 plugins/hr-resources/src/components/DepartmentStaff.svelte create mode 100644 plugins/hr-resources/src/components/EditDepartment.svelte create mode 100644 plugins/hr-resources/src/components/StaffPresenter.svelte create mode 100644 plugins/hr-resources/src/components/Structure.svelte create mode 100644 plugins/hr-resources/src/index.ts create mode 100644 plugins/hr-resources/src/plugin.ts create mode 100644 plugins/hr-resources/svelte.config.js create mode 100644 plugins/hr-resources/tsconfig.json create mode 100644 plugins/hr/.eslintrc.js create mode 100644 plugins/hr/.npmignore create mode 100644 plugins/hr/config/rig.json create mode 100644 plugins/hr/package.json create mode 100644 plugins/hr/src/index.ts create mode 100644 plugins/hr/tsconfig.json create mode 100644 server-plugins/hr-resources/.eslintrc.js create mode 100644 server-plugins/hr-resources/.npmignore create mode 100644 server-plugins/hr-resources/config/rig.json create mode 100644 server-plugins/hr-resources/package.json create mode 100644 server-plugins/hr-resources/src/index.ts create mode 100644 server-plugins/hr-resources/tsconfig.json create mode 100644 server-plugins/hr/.eslintrc.js create mode 100644 server-plugins/hr/.npmignore create mode 100644 server-plugins/hr/config/rig.json create mode 100644 server-plugins/hr/package.json create mode 100644 server-plugins/hr/src/index.ts create mode 100644 server-plugins/hr/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 34d419f067..ad8f9537ae 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -41,6 +41,9 @@ specifiers: '@rush-temp/gmail': file:./projects/gmail.tgz '@rush-temp/gmail-assets': file:./projects/gmail-assets.tgz '@rush-temp/gmail-resources': file:./projects/gmail-resources.tgz + '@rush-temp/hr': file:./projects/hr.tgz + '@rush-temp/hr-assets': file:./projects/hr-assets.tgz + '@rush-temp/hr-resources': file:./projects/hr-resources.tgz '@rush-temp/image-cropper': file:./projects/image-cropper.tgz '@rush-temp/image-cropper-resources': file:./projects/image-cropper-resources.tgz '@rush-temp/inventory': file:./projects/inventory.tgz @@ -65,6 +68,7 @@ specifiers: '@rush-temp/model-core': file:./projects/model-core.tgz '@rush-temp/model-demo': file:./projects/model-demo.tgz '@rush-temp/model-gmail': file:./projects/model-gmail.tgz + '@rush-temp/model-hr': file:./projects/model-hr.tgz '@rush-temp/model-inventory': file:./projects/model-inventory.tgz '@rush-temp/model-lead': file:./projects/model-lead.tgz '@rush-temp/model-notification': file:./projects/model-notification.tgz @@ -79,6 +83,7 @@ specifiers: '@rush-temp/model-server-contact': file:./projects/model-server-contact.tgz '@rush-temp/model-server-core': file:./projects/model-server-core.tgz '@rush-temp/model-server-gmail': file:./projects/model-server-gmail.tgz + '@rush-temp/model-server-hr': file:./projects/model-server-hr.tgz '@rush-temp/model-server-inventory': file:./projects/model-server-inventory.tgz '@rush-temp/model-server-lead': file:./projects/model-server-lead.tgz '@rush-temp/model-server-notification': file:./projects/model-server-notification.tgz @@ -131,6 +136,8 @@ specifiers: '@rush-temp/server-core': file:./projects/server-core.tgz '@rush-temp/server-gmail': file:./projects/server-gmail.tgz '@rush-temp/server-gmail-resources': file:./projects/server-gmail-resources.tgz + '@rush-temp/server-hr': file:./projects/server-hr.tgz + '@rush-temp/server-hr-resources': file:./projects/server-hr-resources.tgz '@rush-temp/server-inventory': file:./projects/server-inventory.tgz '@rush-temp/server-inventory-resources': file:./projects/server-inventory-resources.tgz '@rush-temp/server-lead': file:./projects/server-lead.tgz @@ -331,6 +338,9 @@ dependencies: '@rush-temp/gmail': file:projects/gmail.tgz '@rush-temp/gmail-assets': file:projects/gmail-assets.tgz '@rush-temp/gmail-resources': file:projects/gmail-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c + '@rush-temp/hr': file:projects/hr.tgz + '@rush-temp/hr-assets': file:projects/hr-assets.tgz_typescript@4.7.2 + '@rush-temp/hr-resources': file:projects/hr-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c '@rush-temp/image-cropper': file:projects/image-cropper.tgz '@rush-temp/image-cropper-resources': file:projects/image-cropper-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c '@rush-temp/inventory': file:projects/inventory.tgz @@ -355,6 +365,7 @@ dependencies: '@rush-temp/model-core': file:projects/model-core.tgz_typescript@4.7.2 '@rush-temp/model-demo': file:projects/model-demo.tgz_typescript@4.7.2 '@rush-temp/model-gmail': file:projects/model-gmail.tgz_typescript@4.7.2 + '@rush-temp/model-hr': file:projects/model-hr.tgz_typescript@4.7.2 '@rush-temp/model-inventory': file:projects/model-inventory.tgz_typescript@4.7.2 '@rush-temp/model-lead': file:projects/model-lead.tgz_typescript@4.7.2 '@rush-temp/model-notification': file:projects/model-notification.tgz_typescript@4.7.2 @@ -369,6 +380,7 @@ dependencies: '@rush-temp/model-server-contact': file:projects/model-server-contact.tgz_typescript@4.7.2 '@rush-temp/model-server-core': file:projects/model-server-core.tgz_typescript@4.7.2 '@rush-temp/model-server-gmail': file:projects/model-server-gmail.tgz_typescript@4.7.2 + '@rush-temp/model-server-hr': file:projects/model-server-hr.tgz_typescript@4.7.2 '@rush-temp/model-server-inventory': file:projects/model-server-inventory.tgz_typescript@4.7.2 '@rush-temp/model-server-lead': file:projects/model-server-lead.tgz_typescript@4.7.2 '@rush-temp/model-server-notification': file:projects/model-server-notification.tgz_typescript@4.7.2 @@ -421,6 +433,8 @@ dependencies: '@rush-temp/server-core': file:projects/server-core.tgz '@rush-temp/server-gmail': file:projects/server-gmail.tgz '@rush-temp/server-gmail-resources': file:projects/server-gmail-resources.tgz + '@rush-temp/server-hr': file:projects/server-hr.tgz + '@rush-temp/server-hr-resources': file:projects/server-hr-resources.tgz '@rush-temp/server-inventory': file:projects/server-inventory.tgz '@rush-temp/server-inventory-resources': file:projects/server-inventory-resources.tgz '@rush-temp/server-lead': file:projects/server-lead.tgz @@ -10925,6 +10939,89 @@ packages: - supports-color dev: false + file:projects/hr-assets.tgz_typescript@4.7.2: + resolution: {integrity: sha512-Or7JUoPjJeVKIbJt6RExTLlWhvCJxWe1dZBA0332S7HIUgWDnev8Qx0EzBxV1FKXne/XV1w8ZEusJXPReGz3mw==, tarball: file:projects/hr-assets.tgz} + id: file:projects/hr-assets.tgz + name: '@rush-temp/hr-assets' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@types/node': 16.11.38 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + - typescript + dev: false + + file:projects/hr-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c: + resolution: {integrity: sha512-sYnkYAs2h/gH6VD8c6+QBHMemRZfIMVthpYzi1+TXliv/EmebzxdFyPCPjLbxgQxpq4mUwuMLlAusMIrmpVNrg==, tarball: file:projects/hr-resources.tgz} + id: file:projects/hr-resources.tgz + name: '@rush-temp/hr-resources' + version: 0.0.0 + dependencies: + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + eslint-plugin-svelte3: 4.0.0_eslint@7.32.0+svelte@3.48.0 + prettier: 2.6.2 + prettier-plugin-svelte: 2.7.0_prettier@2.6.2+svelte@3.48.0 + sass: 1.52.2 + svelte: 3.48.0 + svelte-check: 2.7.2_c1788f0bf13b393830d6c30602bd01af + svelte-loader: 3.1.3_svelte@3.48.0 + svelte-preprocess: 4.10.6_0757fe126296bf9639251bcd13609b29 + typescript: 4.7.2 + transitivePeerDependencies: + - '@babel/core' + - coffeescript + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - less + - node-sass + - postcss + - postcss-load-config + - pug + - stylus + - sugarss + - supports-color + dev: false + + file:projects/hr.tgz: + resolution: {integrity: sha512-8jSKJNCIhxfPjP8hislK8NLocwO4VwDJ/jjYzq6tlRwgiI3pMAuftX/NsZEKARgHcHebssy63acqJNImdp2ALQ==, tarball: file:projects/hr.tgz} + name: '@rush-temp/hr' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + typescript: 4.7.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: false + file:projects/image-cropper-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c: resolution: {integrity: sha512-8whE1ZAsPDruwYl6MT6HEWi5zFPGLg3fsYmvdDL2cx1KmDH421bm+M5kkq+Ok5HUV8jYoQRK00zvX8Awz4e+lQ==, tarball: file:projects/image-cropper-resources.tgz} id: file:projects/image-cropper-resources.tgz @@ -11318,7 +11415,7 @@ packages: dev: false file:projects/model-all.tgz_typescript@4.7.2: - resolution: {integrity: sha512-3KLZ8VdyN6qL7q5SOOeD9sU9xUoDeqJRxAbyLtFhAgaTU1tX9n3C+cnmlDZhXq8kcK/Ss/xK2hrHfq0kOI7ILw==, tarball: file:projects/model-all.tgz} + resolution: {integrity: sha512-VrR3QpQKo2qizq7xi/uS9Jj+OyrB/mPDLnAc8/pvwEx8jF5PwySSsP63uSNGcO3fwv7ZjZvAiuvEnaIHUZ5Ivg==, tarball: file:projects/model-all.tgz} id: file:projects/model-all.tgz name: '@rush-temp/model-all' version: 0.0.0 @@ -11528,6 +11625,29 @@ packages: - typescript dev: false + file:projects/model-hr.tgz_typescript@4.7.2: + resolution: {integrity: sha512-HtAgUigvoyvjSpGUHwcRfTqM+RpMKyvDrieHpRBIvFans/2Kg3FPlacTHa9vhBilcze0pNBDrlSXyGuKMBLl8g==, tarball: file:projects/model-hr.tgz} + id: file:projects/model-hr.tgz + name: '@rush-temp/model-hr' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + - typescript + dev: false + file:projects/model-inventory.tgz_typescript@4.7.2: resolution: {integrity: sha512-ZrDM3hzsPJZPI1EGZpP4sEkEnJmmfzW77c2g7JejOCROBy6gd7237XN/SPjPk85CcSg7iHyueJiG9QGgoRB5SQ==, tarball: file:projects/model-inventory.tgz} id: file:projects/model-inventory.tgz @@ -11847,6 +11967,29 @@ packages: - typescript dev: false + file:projects/model-server-hr.tgz_typescript@4.7.2: + resolution: {integrity: sha512-jSk/2YD9iHX6gPWUlc+RstSQVCpJGeoEsRNyaI3MMPtwytRCNa6Bdp1FjwFr3WId2wFQ+eHdpg9EtGr5ooGhUg==, tarball: file:projects/model-server-hr.tgz} + id: file:projects/model-server-hr.tgz + name: '@rush-temp/model-server-hr' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + - typescript + dev: false + file:projects/model-server-inventory.tgz_typescript@4.7.2: resolution: {integrity: sha512-fEZjpHFjw7k95RXySO8e9RpoaicF9jI2fVN9SSDEFUSmBsUKz3yR1wa1JrALrsH0YjcKzL1dWQK6AIJj4PuMCA==, tarball: file:projects/model-server-inventory.tgz} id: file:projects/model-server-inventory.tgz @@ -12193,7 +12336,7 @@ packages: dev: false file:projects/model-tracker.tgz_typescript@4.7.2: - resolution: {integrity: sha512-3giT5Ql8N6I6UaeU038P16HSmmhnQdy2eIYaKok1cF+AX0Z/0dXcR/bSvgQ88WJxMrtAsusZkOkF+PyvUUJOYg==, tarball: file:projects/model-tracker.tgz} + resolution: {integrity: sha512-3NvQ5qG0MQi1q/7nydGTluAJYjDlwLDG+AZXSG3I0tMEG5YpQguM399GXlGlWZzhFAc++KUK1nDR7JWtaPmXcA==, tarball: file:projects/model-tracker.tgz} id: file:projects/model-tracker.tgz name: '@rush-temp/model-tracker' version: 0.0.0 @@ -12679,7 +12822,7 @@ packages: dev: false file:projects/prod.tgz_d1c3762ecb2c185353d3f02936f6ec22: - resolution: {integrity: sha512-PehFsaG21mA1q8ou+ldHAfMX0O+nPv2zVXTuj/K5TPMZ/DEkCtQHZtaVElryGq4xD1PlMyaID/1mqppbYEpbPQ==, tarball: file:projects/prod.tgz} + resolution: {integrity: sha512-Ruj8noHdrzO1bGVEYxLSgza5VdloFea3VbtIutq8UnZThqIzyBmJRsEo1lLmN5WAKBW50oEBKsKDZxuXB/ZuYQ==, tarball: file:projects/prod.tgz} id: file:projects/prod.tgz name: '@rush-temp/prod' version: 0.0.0 @@ -13182,6 +13325,51 @@ packages: - supports-color dev: false + file:projects/server-hr-resources.tgz: + resolution: {integrity: sha512-D073FS8B1EjB1D7fFgFm1Tdq6u69DaNcLVx65szIypERkUyFKyNr5KXqSyHSeDbwPWwz7nyOw2ecN8rlCPHnJg==, tarball: file:projects/server-hr-resources.tgz} + name: '@rush-temp/server-hr-resources' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + typescript: 4.7.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: false + + file:projects/server-hr.tgz: + resolution: {integrity: sha512-VPn9I/49Q/15y/R3yinhsKHb5CwTxzHZFemEfj0b/sALUamdf3S3sJpdMorZkNI44hFOns6LzHRRKUf/ka9zOA==, tarball: file:projects/server-hr.tgz} + name: '@rush-temp/server-hr' + version: 0.0.0 + dependencies: + '@rushstack/heft': 0.45.5 + '@types/heft-jest': 1.0.2 + '@types/node': 16.11.38 + '@typescript-eslint/eslint-plugin': 5.27.0_738fa17fa57f8a69ace69c90e5cfa1d5 + '@typescript-eslint/parser': 5.27.0_eslint@7.32.0+typescript@4.7.2 + eslint: 7.32.0 + eslint-config-standard-with-typescript: 21.0.1_99a5fe2f2ae1dc64d6b59974c931eb2a + eslint-plugin-import: 2.26.0_c21022bc9feaeb7b200d3d631eeae46c + eslint-plugin-node: 11.1.0_eslint@7.32.0 + eslint-plugin-promise: 5.2.0_eslint@7.32.0 + prettier: 2.6.2 + typescript: 4.7.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: false + file:projects/server-inventory-resources.tgz: resolution: {integrity: sha512-QXv09ktLX1fL3VlWS5ofrZxuL21p9T0IWM0X+hLCpoqmxPA/Bhpi52CtRM/89DsgohhEPPpWNG9byQci8A5vOw==, tarball: file:projects/server-inventory-resources.tgz} name: '@rush-temp/server-inventory-resources' @@ -13693,7 +13881,7 @@ packages: dev: false file:projects/server.tgz: - resolution: {integrity: sha512-YMw6QleaQlQlzkQhIncun4YVr77XcZSRLy8xzfJiy6X1PaBSve9WY9mGkKiiw119bo2/72HEHEHMnsHQU3VtSQ==, tarball: file:projects/server.tgz} + resolution: {integrity: sha512-xJg2GMws1k8PADTrUVUbp6eEynFM+iEVYmsaU5lWpPk2nz4MrDTnirbDITNKPbmKlTdODDWJSaT6zIjhi+GRMg==, tarball: file:projects/server.tgz} name: '@rush-temp/server' version: 0.0.0 dependencies: @@ -14252,7 +14440,7 @@ packages: dev: false file:projects/tool.tgz: - resolution: {integrity: sha512-cLyyAtdkGqG4pxA7QhbNhoNwhIoxpUktmo6OA8kJzcjisF23dXsuuDv097gM6Y0IOdIRGWET8XRaM1sIE/4ogQ==, tarball: file:projects/tool.tgz} + resolution: {integrity: sha512-gvdRnHRhzst5gkHEFg9GVc3D04b+BAks8qPdrVxHQSWvWiiUmh3kG+uNWQKklSa9rtRzlSHUrf6NvUvgEg2c5w==, tarball: file:projects/tool.tgz} name: '@rush-temp/tool' version: 0.0.0 dependencies: @@ -14321,7 +14509,7 @@ packages: dev: false file:projects/tracker-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c: - resolution: {integrity: sha512-z3TfQ4BzAQK48+svzVwLJMfJP8kF7Skk6XgUYiW6NGYmWTsauxTAO43pbnH0+zrx112vGahLduOnBsYNURRLXQ==, tarball: file:projects/tracker-resources.tgz} + resolution: {integrity: sha512-bNqQvwzdPa61s2z+M0xrwW5bSvv46yBY8BXt6cqKEHwp1Zv78P5NHU/ScAgVRuJSvwknhrykBK1mK7zghMr3Hg==, tarball: file:projects/tracker-resources.tgz} id: file:projects/tracker-resources.tgz name: '@rush-temp/tracker-resources' version: 0.0.0 @@ -14358,7 +14546,7 @@ packages: dev: false file:projects/tracker.tgz: - resolution: {integrity: sha512-fj497PawVB5mdi7yIw96vQs81XXIcJ3SzrQe0UHyb4IqTbFCoN4/HHGnZ6JXrUY/wdPLHfJzUVMlZKZVKcjD6A==, tarball: file:projects/tracker.tgz} + resolution: {integrity: sha512-wGhZrDr9Vkg1fm9mUcBfkmQXKQlFpiUUOVIa3WEzoIlCzuAzSs4RiAk5XtVeryvQziu6G0dAzbOka9lV9Fxa+A==, tarball: file:projects/tracker.tgz} name: '@rush-temp/tracker' version: 0.0.0 dependencies: diff --git a/dev/prod/package.json b/dev/prod/package.json index 9cb30c9369..72fa30ab6c 100644 --- a/dev/prod/package.json +++ b/dev/prod/package.json @@ -144,6 +144,11 @@ "@anticrm/text-editor": "~0.6.0", "@anticrm/board": "~0.6.0", "@anticrm/board-assets": "~0.6.0", - "@anticrm/board-resources": "~0.6.0" + "@anticrm/board-resources": "~0.6.0", + "@anticrm/hr": "~0.6.0", + "@anticrm/hr-assets": "~0.6.0", + "@anticrm/hr-resources": "~0.6.0", + "@anticrm/server-hr": "~0.6.0", + "@anticrm/server-hr-resources": "~0.6.0" } } diff --git a/dev/prod/src/platform-dev.ts b/dev/prod/src/platform-dev.ts index ea726f597a..4f4c5b6d5e 100644 --- a/dev/prod/src/platform-dev.ts +++ b/dev/prod/src/platform-dev.ts @@ -32,7 +32,7 @@ import { serverTagsId } from '@anticrm/server-tags' import { serverCalendarId } from '@anticrm/server-calendar' import { serverGmailId } from '@anticrm/server-gmail' import { serverTelegramId } from '@anticrm/server-telegram' - +import { serverHrId } from '@anticrm/server-hr' import { setMetadata } from '@anticrm/platform' @@ -60,6 +60,7 @@ export function configurePlatformDev() { addLocation(serverCalendarId, () => import/* webpackChunkName: "server-calendar" */ ('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import/* webpackChunkName: "server-gmail" */ ('@anticrm/server-gmail-resources')) addLocation(serverTelegramId, () => import/* webpackChunkName: "server-telegram" */ ('@anticrm/server-telegram-resources')) + addLocation(serverHrId, () => import(/* webpackChunkName: "server-attachment" */ '@anticrm/server-hr-resources')) // Set devmodel to hook client to be able to present all activity enableDevModel() } diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index 345d13564f..207a722277 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -39,6 +39,7 @@ import { tagsId } from '@anticrm/tags' import { calendarId } from '@anticrm/calendar' import { trackerId } from '@anticrm/tracker' import { boardId } from '@anticrm/board' +import { hrId } from '@anticrm/hr' import rekoni from '@anticrm/rekoni' import '@anticrm/login-assets' @@ -62,6 +63,7 @@ import '@anticrm/calendar-assets' import '@anticrm/tracker-assets' import '@anticrm/board-assets' import '@anticrm/preference-assets' +import '@anticrm/hr-assets' import presentation, { presentationId } from '@anticrm/presentation' import { coreId } from '@anticrm/core' import { textEditorId } from '@anticrm/text-editor' @@ -115,6 +117,7 @@ export async function configurePlatform() { addLocation(trackerId, () => import(/* webpackChunkName: "tracker" */ '@anticrm/tracker-resources')) addLocation(boardId, () => import(/* webpackChunkName: "board" */ '@anticrm/board-resources')) + addLocation(hrId, () => import(/* webpackChunkName: "hr" */ '@anticrm/hr-resources')) setMetadata(workbench.metadata.PlatformTitle, 'Platform') } diff --git a/dev/tool/package.json b/dev/tool/package.json index b2d8e1fdc4..5a3acbe242 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -103,6 +103,8 @@ "@anticrm/server-gmail-resources": "~0.6.0", "@anticrm/server-telegram": "~0.6.0", "@anticrm/server-telegram-resources": "~0.6.0", + "@anticrm/server-hr": "~0.6.0", + "@anticrm/server-hr-resources": "~0.6.0", "@anticrm/rekoni": "~0.6.0", "got": "^11.8.3", "@anticrm/tags": "~0.6.2", diff --git a/dev/tool/src/elastic.ts b/dev/tool/src/elastic.ts index 5909458f37..f314c934e0 100644 --- a/dev/tool/src/elastic.ts +++ b/dev/tool/src/elastic.ts @@ -70,6 +70,7 @@ import { serverTagsId } from '@anticrm/server-tags' import { serverTaskId } from '@anticrm/server-task' import { serverTrackerId } from '@anticrm/server-tracker' import { serverTelegramId } from '@anticrm/server-telegram' +import { serverHrId } from '@anticrm/server-hr' import { Client as ElasticClient } from '@elastic/elasticsearch' import { Client } from 'minio' import { Db, MongoClient } from 'mongodb' @@ -139,6 +140,7 @@ export class ElasticTool { addLocation(serverCalendarId, () => import('@anticrm/server-calendar-resources')) addLocation(serverGmailId, () => import('@anticrm/server-gmail-resources')) addLocation(serverTelegramId, () => import('@anticrm/server-telegram-resources')) + addLocation(serverHrId, () => import('@anticrm/server-hr-resources')) this.mongoClient = new MongoClient(mongoUrl) } diff --git a/models/all/package.json b/models/all/package.json index b7af3a299d..4edbef3314 100644 --- a/models/all/package.json +++ b/models/all/package.json @@ -71,6 +71,8 @@ "@anticrm/model-server-telegram": "~0.6.0", "@anticrm/model-tracker": "~0.6.0", "@anticrm/model-board": "~0.6.0", - "@anticrm/model-preference": "~0.6.0" + "@anticrm/model-preference": "~0.6.0", + "@anticrm/model-hr": "~0.6.0", + "@anticrm/model-server-hr": "~0.6.0" } } diff --git a/models/all/src/index.ts b/models/all/src/index.ts index 4b14f3ef06..752856c83d 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -56,6 +56,8 @@ import { createModel as serverTelegramModel } from '@anticrm/model-server-telegr import { createModel as trackerModel } from '@anticrm/model-tracker' import { createModel as boardModel } from '@anticrm/model-board' import { createModel as preferenceModel } from '@anticrm/model-preference' +import { createModel as hrModel } from '@anticrm/model-hr' +import { createModel as serverHrModel } from '@anticrm/model-server-hr' export const version: Data = jsonVersion as Data @@ -82,6 +84,7 @@ const builders: [(b: Builder) => void, string][] = [ [textEditorModel, 'text-editor'], [notificationModel, 'notification'], [preferenceModel, 'preference'], + [hrModel, 'hr'], [serverCoreModel, 'server-core'], [serverAttachmentModel, 'server-attachment'], @@ -99,6 +102,7 @@ const builders: [(b: Builder) => void, string][] = [ [serverCalendarModel, 'server-calendar'], [serverGmailModel, 'server-gmail'], [serverTelegramModel, 'server-telegram'], + [serverHrModel, 'server-hr'], [trackerModel, 'tracker'], [boardModel, 'board'], [calendarModel, 'calendar'] diff --git a/models/all/src/migration.ts b/models/all/src/migration.ts index a43473e25a..87647317ed 100644 --- a/models/all/src/migration.ts +++ b/models/all/src/migration.ts @@ -32,6 +32,7 @@ import { viewOperation } from '@anticrm/model-view' import { trackerOperation } from '@anticrm/model-tracker' import { boardOperation } from '@anticrm/model-board' import { demoOperation } from '@anticrm/model-demo' +import { hrOperation } from '@anticrm/model-hr' export const migrateOperations: MigrateOperation[] = [ coreOperation, @@ -50,5 +51,6 @@ export const migrateOperations: MigrateOperation[] = [ notificationOperation, settingOperation, trackerOperation, - boardOperation + boardOperation, + hrOperation ] diff --git a/models/hr/.eslintrc.js b/models/hr/.eslintrc.js new file mode 100644 index 0000000000..c3c2c49417 --- /dev/null +++ b/models/hr/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/hr/.npmignore b/models/hr/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/hr/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/hr/config/rig.json b/models/hr/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/hr/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/model-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/models/hr/package.json b/models/hr/package.json new file mode 100644 index 0000000000..a4d3d0b9d4 --- /dev/null +++ b/models/hr/package.json @@ -0,0 +1,41 @@ +{ + "name": "@anticrm/model-hr", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.45.5" + }, + "dependencies": { + "@anticrm/core": "~0.6.16", + "@anticrm/model": "~0.6.0", + "@anticrm/ui": "~0.6.0", + "@anticrm/contact": "~0.6.5", + "@anticrm/platform": "~0.6.6", + "@anticrm/model-core": "~0.6.0", + "@anticrm/model-view": "~0.6.0", + "@anticrm/model-workbench": "~0.6.1", + "@anticrm/model-contact": "~0.6.1", + "@anticrm/hr": "~0.6.0", + "@anticrm/hr-resources": "~0.6.0", + "@anticrm/view": "~0.6.0" + } +} diff --git a/models/hr/src/index.ts b/models/hr/src/index.ts new file mode 100644 index 0000000000..b356a7870d --- /dev/null +++ b/models/hr/src/index.ts @@ -0,0 +1,137 @@ +// +// Copyright © 2022 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 { Employee } from '@anticrm/contact' +import contact, { TEmployee } from '@anticrm/model-contact' +import { IndexKind, Ref } from '@anticrm/core' +import type { Department, Staff } from '@anticrm/hr' +import { Builder, Index, Mixin, Model, Prop, TypeRef, TypeString, UX } from '@anticrm/model' +import core, { TSpace } from '@anticrm/model-core' +import workbench from '@anticrm/model-workbench' +import hr from './plugin' +import view, { createAction } from '@anticrm/model-view' + +@Model(hr.class.Department, core.class.Space) +@UX(hr.string.Department, hr.icon.Department) +export class TDepartment extends TSpace implements Department { + @Prop(TypeRef(hr.class.Department), hr.string.ParentDepartmentLabel) + declare space: Ref + + @Prop(TypeString(), core.string.Name) + @Index(IndexKind.FullText) + name!: string + + avatar?: string | null + + @Prop(TypeRef(contact.class.Employee), hr.string.TeamLead) + teamLead!: Ref | null +} + +@Mixin(hr.mixin.Staff, contact.class.Employee) +@UX(contact.string.Employee, hr.icon.HR) +export class TStaff extends TEmployee implements Staff { + @Prop(TypeRef(hr.class.Department), hr.string.Department) + department!: Ref +} + +export function createModel (builder: Builder): void { + builder.createModel(TDepartment, TStaff) + + builder.createDoc( + workbench.class.Application, + core.space.Model, + { + label: hr.string.HRApplication, + icon: hr.icon.HR, + hidden: false, + navigatorModel: { + specials: [ + { + id: 'structure', + component: hr.component.Structure, + icon: hr.icon.Structure, + label: hr.string.Structure, + position: 'top' + } + ], + spaces: [] + } + }, + hr.app.HR + ) + + builder.mixin(hr.class.Department, core.class.Class, view.mixin.AttributeEditor, { + inlineEditor: hr.component.DepartmentEditor + }) + + createAction( + builder, + { + action: view.actionImpl.ShowPanel, + actionProps: { + component: hr.component.EditDepartment + }, + label: view.string.Open, + icon: view.icon.Open, + keyBinding: ['e'], + input: 'any', + category: hr.category.HR, + target: hr.class.Department, + context: { mode: 'context', application: hr.app.HR, group: 'top' } + }, + hr.action.EditDepartment + ) + + createAction( + builder, + { + action: view.actionImpl.ShowPopup, + actionProps: { + component: hr.component.DepartmentStaff, + element: 'float' + }, + label: hr.string.ShowEmployees, + icon: contact.icon.Person, + keyBinding: ['m'], + input: 'any', + category: hr.category.HR, + target: hr.class.Department, + context: { mode: 'context', application: hr.app.HR, group: 'top' } + }, + hr.action.ShowEmployees + ) + + createAction( + builder, + { + action: view.actionImpl.Delete, + label: view.string.Delete, + icon: view.icon.Delete, + input: 'any', + category: hr.category.HR, + keyBinding: ['Meta + Backspace', 'Ctrl + Backspace'], + query: { + 'members.length': 0, + _id: { $nin: [hr.ids.Head] } + }, + target: hr.class.Department, + context: { mode: 'context', application: hr.app.HR, group: 'top' } + }, + hr.action.DeleteDepartment + ) +} + +export { hrOperation } from './migration' +export { default } from './plugin' diff --git a/models/hr/src/migration.ts b/models/hr/src/migration.ts new file mode 100644 index 0000000000..ca398eda87 --- /dev/null +++ b/models/hr/src/migration.ts @@ -0,0 +1,48 @@ +// +// Copyright © 2022 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 { TxOperations } from '@anticrm/core' +import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@anticrm/model' +import core from '@anticrm/model-core' +import hr from './index' + +async function createSpace (tx: TxOperations): Promise { + const current = await tx.findOne(core.class.Space, { + _id: hr.ids.Head + }) + if (current === undefined) { + await tx.createDoc( + hr.class.Department, + core.space.Space, + { + name: 'Organization', + description: '', + private: false, + archived: false, + members: [], + teamLead: null + }, + hr.ids.Head + ) + } +} + +export const hrOperation: MigrateOperation = { + async migrate (client: MigrationClient): Promise {}, + async upgrade (client: MigrationUpgradeClient): Promise { + const tx = new TxOperations(client, core.account.System) + await createSpace(tx) + } +} diff --git a/models/hr/src/plugin.ts b/models/hr/src/plugin.ts new file mode 100644 index 0000000000..7ef3afc093 --- /dev/null +++ b/models/hr/src/plugin.ts @@ -0,0 +1,43 @@ +// +// Copyright © 2022 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 { Ref } from '@anticrm/core' +import { hrId } from '@anticrm/hr' +import hr from '@anticrm/hr-resources/src/plugin' +import { IntlString, mergeIds } from '@anticrm/platform' +import { AnyComponent } from '@anticrm/ui' +import { Action, ActionCategory } from '@anticrm/view' + +export default mergeIds(hrId, hr, { + string: { + HRApplication: '' as IntlString, + Departments: '' as IntlString, + ShowEmployees: '' as IntlString + }, + component: { + Structure: '' as AnyComponent, + EditDepartment: '' as AnyComponent, + DepartmentStaff: '' as AnyComponent, + DepartmentEditor: '' as AnyComponent + }, + category: { + HR: '' as Ref + }, + action: { + EditDepartment: '' as Ref, + ShowEmployees: '' as Ref, + DeleteDepartment: '' as Ref + } +}) diff --git a/models/hr/tsconfig.json b/models/hr/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/hr/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/models/server-hr/.eslintrc.js b/models/server-hr/.eslintrc.js new file mode 100644 index 0000000000..c3c2c49417 --- /dev/null +++ b/models/server-hr/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json' + } +} diff --git a/models/server-hr/.npmignore b/models/server-hr/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/server-hr/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/server-hr/config/rig.json b/models/server-hr/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/server-hr/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/model-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/models/server-hr/package.json b/models/server-hr/package.json new file mode 100644 index 0000000000..7c52aa09a3 --- /dev/null +++ b/models/server-hr/package.json @@ -0,0 +1,34 @@ +{ + "name": "@anticrm/model-server-hr", + "version": "0.6.0", + "main": "lib/index.js", + "author": "Anticrm Platform Contributors", + "license": "EPL-2.0", + "scripts": { + "build": "heft build", + "build:watch": "tsc", + "lint:fix": "eslint --fix src", + "lint": "eslint src", + "format": "prettier --write src && eslint --fix src" + }, + "devDependencies": { + "@anticrm/model-rig": "~0.6.0", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-node": "^11.1.0", + "eslint": "^7.32.0", + "@types/heft-jest": "^1.0.2", + "@typescript-eslint/parser": "^5.4.0", + "eslint-config-standard-with-typescript": "^21.0.1", + "prettier": "^2.4.1", + "@rushstack/heft": "^0.45.5" + }, + "dependencies": { + "@anticrm/core": "~0.6.16", + "@anticrm/model": "~0.6.0", + "@anticrm/platform": "~0.6.6", + "@anticrm/server-hr": "~0.6.0", + "@anticrm/server-core": "~0.6.1" + } +} diff --git a/models/server-hr/src/index.ts b/models/server-hr/src/index.ts new file mode 100644 index 0000000000..7e4c5ef94a --- /dev/null +++ b/models/server-hr/src/index.ts @@ -0,0 +1,26 @@ +// +// Copyright © 2022 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 { Builder } from '@anticrm/model' + +import serverCore from '@anticrm/server-core' +import core from '@anticrm/core' +import serverHr from '@anticrm/server-hr' + +export function createModel (builder: Builder): void { + builder.createDoc(serverCore.class.Trigger, core.space.Model, { + trigger: serverHr.trigger.OnDepartmentStaff + }) +} diff --git a/models/server-hr/tsconfig.json b/models/server-hr/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/server-hr/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/packages/core/src/memdb.ts b/packages/core/src/memdb.ts index fab310007a..f52bdd62c6 100644 --- a/packages/core/src/memdb.ts +++ b/packages/core/src/memdb.ts @@ -14,11 +14,11 @@ // import { PlatformError, Severity, Status } from '@anticrm/platform' -import { Lookup, ReverseLookups } from '.' +import { getObjectValue, Lookup, ReverseLookups } from '.' import type { Class, Doc, Ref } from './classes' import core from './component' import { Hierarchy } from './hierarchy' -import { matchQuery, resultSort } from './query' +import { matchQuery, resultSort, checkMixinKey } from './query' import type { DocumentQuery, FindOptions, FindResult, LookupData, Storage, TxResult, WithLookup } from './storage' import type { Tx, TxCreateDoc, TxMixin, TxPutBag, TxRemoveDoc, TxUpdateDoc } from './tx' import { TxProcessor } from './tx' @@ -77,25 +77,31 @@ export abstract class MemDb extends TxProcessor { return doc as T } - private async getLookupValue(doc: T, lookup: Lookup, result: LookupData): Promise { + private async getLookupValue( + _class: Ref>, + doc: T, + lookup: Lookup, + result: LookupData + ): Promise { for (const key in lookup) { if (key === '_id') { await this.getReverseLookupValue(doc, lookup, result) continue } const value = (lookup as any)[key] + const tkey = checkMixinKey(key, _class, this.hierarchy) if (Array.isArray(value)) { const [_class, nested] = value - const objects = await this.findAll(_class, { _id: (doc as any)[key] }) + const objects = await this.findAll(_class, { _id: getObjectValue(tkey, doc) }) ;(result as any)[key] = objects[0] const nestedResult = {} const parent = (result as any)[key] - await this.getLookupValue(parent, nested, nestedResult) + await this.getLookupValue(_class, parent, nested, nestedResult) Object.assign(parent, { $lookup: nestedResult }) } else { - const objects = await this.findAll(value, { _id: (doc as any)[key] }) + const objects = await this.findAll(value, { _id: getObjectValue(tkey, doc) }) ;(result as any)[key] = objects[0] } } @@ -118,11 +124,11 @@ export abstract class MemDb extends TxProcessor { } } - private async lookup(docs: T[], lookup: Lookup): Promise[]> { + private async lookup(_class: Ref>, docs: T[], lookup: Lookup): Promise[]> { const withLookup: WithLookup[] = [] for (const doc of docs) { const result: LookupData = {} - await this.getLookupValue(doc, lookup, result) + await this.getLookupValue(_class, doc, lookup, result) withLookup.push(Object.assign({}, doc, { $lookup: result })) } return withLookup @@ -152,7 +158,7 @@ export abstract class MemDb extends TxProcessor { } if (options?.lookup !== undefined) { - result = await this.lookup(result as T[], options.lookup) + result = await this.lookup(_class, result as T[], options.lookup) result = matchQuery(result, query, _class, this.hierarchy) } diff --git a/packages/core/src/operator.ts b/packages/core/src/operator.ts index 74465b099a..7663e23085 100644 --- a/packages/core/src/operator.ts +++ b/packages/core/src/operator.ts @@ -42,6 +42,9 @@ function $push (document: Doc, keyval: Record): void { function $pull (document: Doc, keyval: Record): void { const doc = document as any for (const key in keyval) { + if (doc[key] === undefined) { + doc[key] = [] + } const arr = doc[key] as Array if (typeof keyval[key] === 'object') { const { $in } = keyval[key] as PullArray @@ -55,6 +58,9 @@ function $pull (document: Doc, keyval: Record): void { function $move (document: Doc, keyval: Record): void { const doc = document as any for (const key in keyval) { + if (doc[key] === undefined) { + doc[key] = [] + } const arr = doc[key] as Array const desc = keyval[key] doc[key] = arr.filter((val) => val !== desc.$value) diff --git a/packages/presentation/src/components/EditableAvatar.svelte b/packages/presentation/src/components/EditableAvatar.svelte index c608b1c763..d4e039742a 100644 --- a/packages/presentation/src/components/EditableAvatar.svelte +++ b/packages/presentation/src/components/EditableAvatar.svelte @@ -14,15 +14,17 @@ -->
- +
diff --git a/packages/presentation/src/components/SpaceSelect.svelte b/packages/presentation/src/components/SpaceSelect.svelte index 3c76b3606d..ce1ac85709 100644 --- a/packages/presentation/src/components/SpaceSelect.svelte +++ b/packages/presentation/src/components/SpaceSelect.svelte @@ -25,11 +25,14 @@ getFocusManager, AnyComponent, Tooltip, - TooltipAlignment + TooltipAlignment, + ButtonKind, + ButtonSize } from '@anticrm/ui' import SpacesPopup from './SpacesPopup.svelte' import type { Ref, Class, Space, DocumentQuery } from '@anticrm/core' + import { createEventDispatcher } from 'svelte' export let _class: Ref> export let spaceQuery: DocumentQuery | undefined = { archived: false } @@ -44,10 +47,15 @@ } | undefined = undefined export let labelDirection: TooltipAlignment | undefined = undefined + export let kind: ButtonKind = 'no-border' + export let size: ButtonSize = 'small' + export let justify: 'left' | 'center' = 'center' + export let width: string | undefined = undefined let selected: Space | undefined const client = getClient() + const dispatch = createEventDispatcher() const mgr = getFocusManager() async function updateSelected (value: Ref | undefined) { @@ -71,6 +79,7 @@ (result) => { if (result) { value = result._id + dispatch('change', value) mgr?.setFocusPos(focusIndex) } } @@ -79,7 +88,7 @@ -