mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
Fix kicked accounts could become active after upgrade (#2314)
* remove force contact reactivation * add active attribute for contact in tests add debug launch for dev/tool upgrade Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
2c1f088735
commit
986c22332b
85
.vscode/launch.json
vendored
85
.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -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<void> {
|
||||
const current = await tx.findOne(core.class.Space, {
|
||||
@ -56,19 +56,6 @@ async function createSpace (tx: TxOperations): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function setActiveEmployee (client: MigrationClient): Promise<void> {
|
||||
await client.update(
|
||||
DOMAIN_CONTACT,
|
||||
{
|
||||
_class: contact.class.Employee
|
||||
},
|
||||
{
|
||||
active: true
|
||||
}
|
||||
)
|
||||
await setActiveEmployeeTx(client)
|
||||
}
|
||||
|
||||
async function setActiveEmployeeTx (client: MigrationClient): Promise<void> {
|
||||
await client.update<TxCreateDoc<Employee>>(
|
||||
DOMAIN_TX,
|
||||
@ -99,7 +86,7 @@ async function setRole (client: MigrationClient): Promise<void> {
|
||||
|
||||
export const contactOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
await setActiveEmployee(client)
|
||||
await setActiveEmployeeTx(client)
|
||||
await setRole(client)
|
||||
},
|
||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||
|
@ -7,7 +7,8 @@
|
||||
"modifiedOn": 1643184924040,
|
||||
"name": "Chen,Rosamund",
|
||||
"city": "Mountain View",
|
||||
"channels": 0
|
||||
"channels": 0,
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"_id": "61f1031cff96c329e8f3d68c",
|
||||
|
@ -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
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user