|
1 | 1 | const dayjs = require('dayjs')
|
2 | 2 | const { get } = require('lodash')
|
3 | 3 |
|
4 |
| -const { getById, getByCondition } = require('@open-condo/keystone/schema') |
| 4 | +const { getByCondition } = require('@open-condo/keystone/schema') |
5 | 5 | const { i18n } = require('@open-condo/locales/loader')
|
6 | 6 |
|
7 | 7 | const { buildExportFile, DOCX_FILE_META } = require('@condo/domains/common/utils/createExportFile')
|
@@ -40,17 +40,25 @@ const generateTicketDocumentOfCompletionWorks = async ({ task, baseAttrs, contex
|
40 | 40 | const timeZone = normalizeTimeZone(timeZoneFromUser) || DEFAULT_ORGANIZATION_TIMEZONE
|
41 | 41 | const printDate = dayjs().tz(timeZone).locale(locale)
|
42 | 42 |
|
43 |
| - const property = await getById('Property', ticket.property) |
| 43 | + const property = await getByCondition('Property', { |
| 44 | + id: ticket.property, |
| 45 | + deletedAt: null, |
| 46 | + }) |
| 47 | + |
44 | 48 | const { renderData, streetPart, settlement, cityType, cityName, houseName, block } = getAddressDetails(get(property, 'addressMeta', ticket.propertyAddressMeta))
|
45 | 49 |
|
46 | 50 | const contact = ticket.contact
|
47 |
| - ? await getById('Contact', ticket.contact) |
| 51 | + ? await getByCondition('Contact', { |
| 52 | + id: ticket.contact, |
| 53 | + deletedAt: null, |
| 54 | + }) |
48 | 55 | : null
|
49 | 56 |
|
50 | 57 | const employee = organization.id && ticket.executor
|
51 | 58 | ? await getByCondition('OrganizationEmployee', {
|
52 |
| - organization: { id: organization.id }, |
53 |
| - user: { id: ticket.executor }, |
| 59 | + organization: { id: organization.id, deletedAt: null }, |
| 60 | + user: { id: ticket.executor, deletedAt: null }, |
| 61 | + deletedAt: null, |
54 | 62 | })
|
55 | 63 | : null
|
56 | 64 |
|
|
0 commit comments