diff --git a/.vscode/launch.json b/.vscode/launch.json index 835396d365..c4c9f743e3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,9 @@ "name": "Debug server", "type": "node", "request": "launch", - "args": ["src/__start.ts"], + "args": [ + "src/__start.ts" + ], "env": { "ELASTIC_URL": "http://localhost:9200", "MONGO_URL": "mongodb://localhost:27017", @@ -19,7 +21,11 @@ "MINIO_SECRET_KEY": "minioadmin", "SERVER_SECRET": "secret" }, - "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], "sourceMaps": true, "cwd": "${workspaceRoot}/server/server", "protocol": "inspector" @@ -28,13 +34,19 @@ "name": "Debug Account", "type": "node", "request": "launch", - "args": ["src/index.ts"], + "args": [ + "src/index.ts" + ], "env": { "MONGO_URL": "mongodb://localhost:27017", "SERVER_SECRET": "secret", "TRANSACTOR_URL": "ws:/localhost:3333" }, - "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], "sourceMaps": true, "cwd": "${workspaceRoot}/pods/account", "protocol": "inspector" @@ -45,7 +57,13 @@ "name": "Debug Jest tests", "program": "${fileDirname}/../../node_modules/@rushstack/heft/lib/start.js", "cwd": "${fileDirname}/../../", - "args": ["--debug", "test", "--clean", "--test-path-pattern", "${file}"], + "args": [ + "--debug", + "test", + "--clean", + "--test-path-pattern", + "${file}" + ], "console": "integratedTerminal", "sourceMaps": true, "protocol": "inspector" @@ -54,23 +72,37 @@ "name": "Debug generator", "type": "node", "request": "launch", - "args": ["src/index.ts", "gen-recruit", "ws1", "20"], + "args": [ + "src/index.ts", + "gen-recruit", + "ws1", + "20" + ], "env": { "TRANSACTOR_URL": "ws:/localhost:3333", "MINIO_ACCESS_KEY": "minioadmin", "MINIO_SECRET_KEY": "minioadmin", "MINIO_ENDPOINT": "localhost" }, - "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], "sourceMaps": true, "cwd": "${workspaceRoot}/dev/generator", "protocol": "inspector" }, { - "name": "Debug tool", + "name": "Debug tool import-lead-csv", "type": "node", "request": "launch", - "args": ["src/index.ts", "import-lead-csv", "ws1", "../../../suho/COMPANIES_Agency_of_AlexeyS.csv"], + "args": [ + "src/index.ts", + "import-lead-csv", + "ws1", + "../../../suho/COMPANIES_Agency_of_AlexeyS.csv" + ], "env": { "MINIO_ACCESS_KEY": "minioadmin", "MINIO_SECRET_KEY": "minioadmin", @@ -80,9 +112,40 @@ "TELEGRAM_DATABASE": "telegram-service", "ELASTIC_URL": "http://localhost:9200" }, - "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}/dev/tool" + }, + { + "name": "Debug tool upgrade", + "type": "node", + "request": "launch", + "args": [ + "src/index.ts", + "upgrade" + ], + "env": { + "SERVER_SECRET": "secret", + "MINIO_ACCESS_KEY": "minioadmin", + "MINIO_SECRET_KEY": "minioadmin", + "MINIO_ENDPOINT": "localhost", + "MONGO_URL": "mongodb://localhost:27017", + "TRANSACTOR_URL": "ws:/localhost:3333", + "TELEGRAM_DATABASE": "telegram-service", + "ELASTIC_URL": "http://localhost:9200", + "REKONI_URL": "http://localhost:4004" + }, + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], "sourceMaps": true, "cwd": "${workspaceRoot}/dev/tool" } ] -} +} \ No newline at end of file diff --git a/models/contact/src/migration.ts b/models/contact/src/migration.ts index 02bffbcf02..efad72da81 100644 --- a/models/contact/src/migration.ts +++ b/models/contact/src/migration.ts @@ -17,7 +17,7 @@ import { Employee, EmployeeAccount } from '@hcengineering/contact' import { AccountRole, DOMAIN_TX, TxCreateDoc, TxOperations } from '@hcengineering/core' import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' import core from '@hcengineering/model-core' -import contact, { DOMAIN_CONTACT } from './index' +import contact from './index' async function createSpace (tx: TxOperations): Promise { const current = await tx.findOne(core.class.Space, { @@ -56,19 +56,6 @@ async function createSpace (tx: TxOperations): Promise { } } -async function setActiveEmployee (client: MigrationClient): Promise { - await client.update( - DOMAIN_CONTACT, - { - _class: contact.class.Employee - }, - { - active: true - } - ) - await setActiveEmployeeTx(client) -} - async function setActiveEmployeeTx (client: MigrationClient): Promise { await client.update>( DOMAIN_TX, @@ -99,7 +86,7 @@ async function setRole (client: MigrationClient): Promise { export const contactOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { - await setActiveEmployee(client) + await setActiveEmployeeTx(client) await setRole(client) }, async upgrade (client: MigrationUpgradeClient): Promise { diff --git a/tests/sanity-ws/contact.json b/tests/sanity-ws/contact.json index 1bcf608c74..1f5eba6679 100644 --- a/tests/sanity-ws/contact.json +++ b/tests/sanity-ws/contact.json @@ -7,7 +7,8 @@ "modifiedOn": 1643184924040, "name": "Chen,Rosamund", "city": "Mountain View", - "channels": 0 + "channels": 0, + "active": true }, { "_id": "61f1031cff96c329e8f3d68c", diff --git a/tests/sanity-ws/tx.json b/tests/sanity-ws/tx.json index 84ac91098e..6fa5820921 100644 --- a/tests/sanity-ws/tx.json +++ b/tests/sanity-ws/tx.json @@ -11,7 +11,8 @@ "attributes": { "email": "rosamund@hc.engineering", "employee": "61f1031bff96c329e8f3d61c", - "name": "Chen,Rosamund" + "name": "Chen,Rosamund", + "active": true } }, { @@ -899,7 +900,8 @@ "modifiedBy": "61f1031bff96c329e8f3d61d", "attributes": { "name": "Chen,Rosamund", - "city": "Mountain View" + "city": "Mountain View", + "active": true } }, {