From 89baa98767c95d062634afc56575f33043a75db5 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Wed, 29 Nov 2023 21:44:10 +0500 Subject: [PATCH] UBERF-4405: empty Vacancies' members (#4105) Signed-off-by: Vyacheslav Tumanov --- models/recruit/src/migration.ts | 10 ++++++++++ .../src/components/CreateVacancy.svelte | 12 ++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/models/recruit/src/migration.ts b/models/recruit/src/migration.ts index cbd698df51..b0bc111a33 100644 --- a/models/recruit/src/migration.ts +++ b/models/recruit/src/migration.ts @@ -77,6 +77,16 @@ export const recruitOperation: MigrateOperation = { } } } + }, + { + state: 'remove-members', + func: async (client): Promise => { + const ops = new TxOperations(client, core.account.System) + const docs = await ops.findAll(recruit.class.Vacancy, { members: { $exists: true, $ne: [] } }) + for (const d of docs) { + await ops.update(d, { members: [] }) + } + } } ]) } diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte index 5621a5c6d6..d0faffe4ee 100644 --- a/plugins/recruit-resources/src/components/CreateVacancy.svelte +++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte @@ -16,15 +16,7 @@ import { AttachmentStyledBox } from '@hcengineering/attachment-resources' import contact, { Organization } from '@hcengineering/contact' import { UserBox } from '@hcengineering/contact-resources' - import core, { - Data, - fillDefaults, - FindResult, - generateId, - getCurrentAccount, - Ref, - SortingOrder - } from '@hcengineering/core' + import core, { Data, fillDefaults, FindResult, generateId, Ref, SortingOrder } from '@hcengineering/core' import { Card, createQuery, getClient, InlineAttributeBar, MessageBox } from '@hcengineering/presentation' import { Vacancy as VacancyClass } from '@hcengineering/recruit' import tags from '@hcengineering/tags' @@ -176,7 +168,7 @@ archived: false, number: (incResult as any).object.sequence, company, - members: [getCurrentAccount()._id], + members: [], type: typeId }, objectId