diff --git a/dev/generator/src/issues.ts b/dev/generator/src/issues.ts index 457e287cfb..917a759a71 100644 --- a/dev/generator/src/issues.ts +++ b/dev/generator/src/issues.ts @@ -35,8 +35,7 @@ const object: AttachedData = { reportedTime: 0, estimation: 0, reports: 0, - childInfo: [], - createOn: Date.now() + childInfo: [] } export interface IssueOptions { @@ -98,8 +97,7 @@ async function genIssue (client: TxOperations, statuses: Ref[]): Pr estimation: object.estimation, reports: 0, relations: [], - childInfo: [], - createOn: Date.now() + childInfo: [] } await client.addCollection( tracker.class.Issue, diff --git a/dev/generator/src/recruit.ts b/dev/generator/src/recruit.ts index f6f98beca9..d6a787bdd5 100644 --- a/dev/generator/src/recruit.ts +++ b/dev/generator/src/recruit.ts @@ -2,23 +2,23 @@ import contact, { Channel, Employee, EmployeeAccount, Person } from '@hcengineer import core, { AttachedData, Data, - generateId, MeasureContext, MeasureMetricsContext, - metricsToString, MixinUpdate, Ref, TxOperations, - WorkspaceId + WorkspaceId, + generateId, + metricsToString } from '@hcengineering/core' import { MinioService } from '@hcengineering/minio' import recruit from '@hcengineering/model-recruit' import { Applicant, Candidate, Vacancy } from '@hcengineering/recruit' -import { genRanks, State } from '@hcengineering/task' +import { State, genRanks } from '@hcengineering/task' import faker from 'faker' import jpeg, { BufferRet } from 'jpeg-js' -import { addAttachments, AttachmentOptions } from './attachments' -import { addComments, CommentOptions } from './comments' +import { AttachmentOptions, addAttachments } from './attachments' +import { CommentOptions, addComments } from './comments' import { connect } from './connect' import { createUpdateSpaceKanban } from './kanban' import { findOrUpdate, findOrUpdateAttached } from './utils' @@ -162,8 +162,7 @@ async function genApplicant ( doneState: null, rank: rank as string, startDate: null, - dueDate: null, - createOn: Date.now() + dueDate: null } // Update or create candidate @@ -234,8 +233,7 @@ async function genCandidate ( const candidate: Data = { name: fName + ',' + lName, city: faker.address.city(), - avatar: imgId, - createOn: Date.now() + avatar: imgId } const candidateMixin: MixinUpdate = { diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index 7e3c65bacd..28ba887d57 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -91,10 +91,6 @@ export class TChunterMessage extends TAttachedDoc implements ChunterMessage { @ReadOnly() createBy!: Ref - @Prop(TypeTimestamp(), chunter.string.Create) - @ReadOnly() - createOn!: Timestamp - @Prop(TypeTimestamp(), chunter.string.Edit) editedOn?: Timestamp diff --git a/models/chunter/src/migration.ts b/models/chunter/src/migration.ts index 7220a9643b..7c6fff55c2 100644 --- a/models/chunter/src/migration.ts +++ b/models/chunter/src/migration.ts @@ -14,7 +14,7 @@ // import { Comment, Message, ThreadMessage } from '@hcengineering/chunter' -import core, { Doc, DOMAIN_TX, Ref, TxCreateDoc, TxOperations } from '@hcengineering/core' +import core, { DOMAIN_TX, Doc, Ref, TxCreateDoc, TxOperations } from '@hcengineering/core' import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' import { DOMAIN_CHUNTER, DOMAIN_COMMENT } from './index' import chunter from './plugin' @@ -81,21 +81,6 @@ async function createBacklink (tx: TxOperations): Promise { } } -export async function setCreate (client: TxOperations): Promise { - const messages = (await client.findAll(chunter.class.Message, {})) - .filter((m) => m.createBy === undefined) - .map((m) => m._id) - if (messages.length === 0) return - const txes = await client.findAll(core.class.TxCreateDoc, { objectId: { $in: messages } }) - const promises = txes.map(async (tx) => { - await client.updateDoc(chunter.class.Message, tx.objectSpace, tx.objectId as Ref, { - createBy: tx.modifiedBy, - createOn: tx.modifiedOn - }) - }) - await Promise.all(promises) -} - export async function migrateMessages (client: MigrationClient): Promise { const messages = await client.find(DOMAIN_CHUNTER, { _class: chunter.class.Message, @@ -188,6 +173,5 @@ export const chunterOperation: MigrateOperation = { await createGeneral(tx) await createRandom(tx) await createBacklink(tx) - await setCreate(tx) } } diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 9361f7a1a1..97de8345f0 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -40,7 +40,6 @@ import { Index, Model, Prop, - ReadOnly, TypeDate, TypeRef, TypeString, @@ -103,10 +102,6 @@ export class TContact extends TDoc implements Contact { @Prop(TypeString(), contact.string.Location) @Index(IndexKind.FullText) city!: string - - @Prop(TypeTimestamp(), contact.string.CreatedDate) - @ReadOnly() - createOn!: Timestamp } @Model(contact.class.Channel, core.class.AttachedDoc, DOMAIN_CHANNEL) diff --git a/models/contact/src/migration.ts b/models/contact/src/migration.ts index 7c7b06d940..5495368f3f 100644 --- a/models/contact/src/migration.ts +++ b/models/contact/src/migration.ts @@ -1,10 +1,9 @@ // -import { Contact } from '@hcengineering/contact' -import { DOMAIN_TX, TxCreateDoc, TxOperations } from '@hcengineering/core' +import { 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, { @@ -43,64 +42,6 @@ async function createSpace (tx: TxOperations): Promise { } } -let totalCreateOn = 0 -async function setCreate (client: MigrationClient): Promise { - while (true) { - const docs = await client.find( - DOMAIN_CONTACT, - { - _class: { - $in: [contact.class.Contact, contact.class.Organization, contact.class.Person, contact.class.Employee] - }, - createOn: { $exists: false } - }, - { limit: 500 } - ) - if (docs.length === 0) { - break - } - totalCreateOn += docs.length - console.log('processing createOn migration', totalCreateOn) - const creates = await client.find>(DOMAIN_TX, { - objectId: { $in: docs.map((it) => it._id) }, - _class: core.class.TxCreateDoc - }) - for (const doc of docs) { - const tx = creates.find((it) => it.objectId === doc._id) - if (tx !== undefined) { - await client.update( - DOMAIN_CONTACT, - { - _id: doc._id - }, - { - createOn: tx.modifiedOn - } - ) - await client.update( - DOMAIN_TX, - { - _id: tx._id - }, - { - 'attributes.createOn': tx.modifiedOn - } - ) - } else { - await client.update( - DOMAIN_CONTACT, - { - _id: doc._id - }, - { - createOn: doc.modifiedOn - } - ) - } - } - } -} - async function createEmployeeEmail (client: TxOperations): Promise { const employees = await client.findAll(contact.class.Employee, {}) const channels = await client.findAll(contact.class.Channel, { @@ -133,9 +74,7 @@ async function createEmployeeEmail (client: TxOperations): Promise { } export const contactOperation: MigrateOperation = { - async migrate (client: MigrationClient): Promise { - await setCreate(client) - }, + 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/core/src/core.ts b/models/core/src/core.ts index 31523ed686..467063f2d1 100644 --- a/models/core/src/core.ts +++ b/models/core/src/core.ts @@ -57,6 +57,7 @@ import { Mixin as MMixin, Model, Prop, + ReadOnly, TypeBoolean, TypeIntlString, TypeRecord, @@ -101,6 +102,10 @@ export class TDoc extends TObj implements Doc { @Prop(TypeRef(core.class.Account), core.string.CreatedBy) @Index(IndexKind.Indexed) createdBy!: Ref + + @Prop(TypeTimestamp(), core.string.CreatedDate) + @ReadOnly() + createOn!: Timestamp } @Model(core.class.AttachedDoc, core.class.Doc) diff --git a/models/core/src/migration.ts b/models/core/src/migration.ts index 4b73d9b384..810f238472 100644 --- a/models/core/src/migration.ts +++ b/models/core/src/migration.ts @@ -13,17 +13,17 @@ // limitations under the License. // -import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' import core, { - Doc, + AttachedDoc, DOMAIN_BLOB, DOMAIN_DOC_INDEX_STATE, DOMAIN_MODEL, DOMAIN_TX, - TxCreateDoc, + Doc, TxCollectionCUD, - AttachedDoc + TxCreateDoc } from '@hcengineering/core' +import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' async function fillCreatedBy (client: MigrationClient): Promise { const h = client.hierarchy @@ -87,9 +87,72 @@ async function fillCreatedBy (client: MigrationClient): Promise { } } } +async function fillCreatedOn (client: MigrationClient): Promise { + const h = client.hierarchy + const domains = h.domains() + for (const domain of domains) { + if ( + domain === DOMAIN_TX || + domain === DOMAIN_MODEL || + domain === DOMAIN_BLOB || + domain === DOMAIN_DOC_INDEX_STATE + ) { + continue + } + while (true) { + try { + const objects = await client.find( + domain, + { createdOn: { $exists: false } }, + { projection: { _id: 1, modifiedOn: 1 }, limit: 10000 } + ) + if (objects.length === 0) { + break + } + const txes = await client.find>( + DOMAIN_TX, + { + _class: core.class.TxCreateDoc, + objectId: { $in: Array.from(objects.map((it) => it._id)) } + }, + { projection: { _id: 1, modifiedOn: 1, createOn: 1, objectId: 1 } } + ) + + const txes2 = ( + await client.find>( + DOMAIN_TX, + { + _class: core.class.TxCollectionCUD, + 'tx._class': core.class.TxCreateDoc, + 'tx.objectId': { $in: Array.from(objects.map((it) => it._id)) } + }, + { projection: { _id: 1, modifiedOn: 1, createOn: 1, tx: 1 } } + ) + ).map((it) => it.tx as unknown as TxCreateDoc) + + const txMap = new Map(txes.concat(txes2).map((p) => [p.objectId, p])) + + console.log('migrateCreateOn', domain, objects.length) + await client.bulk( + domain, + objects.map((it) => { + const createTx = txMap.get(it._id) + return { + filter: { _id: it._id }, + update: { + createdOn: createTx?.createOn ?? it.modifiedOn + } + } + }) + ) + } catch (err) {} + } + } +} export const coreOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { await fillCreatedBy(client) + await fillCreatedOn(client) }, async upgrade (client: MigrationUpgradeClient): Promise {} } diff --git a/models/demo/src/migration.ts b/models/demo/src/migration.ts index 527fa0b26c..f3f6e1c32a 100644 --- a/models/demo/src/migration.ts +++ b/models/demo/src/migration.ts @@ -13,11 +13,11 @@ // limitations under the License. // +import contact, { EmployeeAccount } from '@hcengineering/contact' import core, { AccountRole, DOMAIN_TX, TxCreateDoc, TxOperations } from '@hcengineering/core' import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' -import contact, { EmployeeAccount } from '@hcengineering/contact' -import recruit from '@hcengineering/model-recruit' import { DOMAIN_CONTACT } from '@hcengineering/model-contact' +import recruit from '@hcengineering/model-recruit' async function createCandidate ( tx: TxOperations, @@ -33,8 +33,7 @@ async function createCandidate ( if (current !== undefined) return const u1 = await tx.createDoc(contact.class.Person, recruit.space.CandidatesPublic, { name, - city, - createOn: Date.now() + city }) await tx.addCollection(contact.class.Channel, recruit.space.CandidatesPublic, u1, contact.class.Person, 'channels', { provider: contact.channelProvider.Email, @@ -74,8 +73,7 @@ export const demoOperation: MigrateOperation = { const employee = await ops.createDoc(contact.class.Employee, contact.space.Employee, { name: 'Chen,Rosamund', city: 'Mountain View', - active: true, - createOn: Date.now() + active: true }) await ops.createDoc(contact.class.EmployeeAccount, core.space.Model, { diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index b8078b3704..45504c0344 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -270,6 +270,7 @@ export function createModel (builder: Builder): void { orderBy: [ ['state', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], + ['createOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending], ['rank', SortingOrder.Ascending] ], diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 92588e6344..6b69cb30e6 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -29,7 +29,6 @@ import { TypeMarkup, TypeRef, TypeString, - TypeTimestamp, UX } from '@hcengineering/model' import attachment from '@hcengineering/model-attachment' @@ -37,6 +36,7 @@ import calendar from '@hcengineering/model-calendar' import chunter from '@hcengineering/model-chunter' import contact, { TOrganization, TPerson } from '@hcengineering/model-contact' import core, { TAttachedDoc, TSpace } from '@hcengineering/model-core' +import { generateClassNotificationTypes } from '@hcengineering/model-notification' import presentation from '@hcengineering/model-presentation' import tags from '@hcengineering/model-tags' import task, { DOMAIN_TASK, TSpaceWithStates, TTask, actionTemplates } from '@hcengineering/model-task' @@ -59,7 +59,6 @@ import { KeyBinding, ViewOptionsModel } from '@hcengineering/view' import recruit from './plugin' import { createReviewModel, reviewTableConfig, reviewTableOptions } from './review' import { TOpinion, TReview } from './review-model' -import { generateClassNotificationTypes } from '@hcengineering/model-notification' export { recruitId } from '@hcengineering/recruit' export { recruitOperation } from './migration' @@ -167,10 +166,6 @@ export class TApplicant extends TTask implements Applicant { @Prop(TypeRef(contact.class.Employee), recruit.string.AssignedRecruiter) declare assignee: Ref | null - - @Prop(TypeTimestamp(), contact.string.CreatedDate) - @ReadOnly() - createOn!: Timestamp } @Model(recruit.class.ApplicantMatch, core.class.AttachedDoc, DOMAIN_TASK) @@ -629,6 +624,7 @@ export function createModel (builder: Builder): void { orderBy: [ ['state', SortingOrder.Ascending], ['modifiedOn', SortingOrder.Descending], + ['createOn', SortingOrder.Descending], ['dueDate', SortingOrder.Ascending], ['rank', SortingOrder.Ascending] ], diff --git a/models/recruit/src/migration.ts b/models/recruit/src/migration.ts index cde1b41346..535e07240a 100644 --- a/models/recruit/src/migration.ts +++ b/models/recruit/src/migration.ts @@ -20,7 +20,6 @@ import core, { DOMAIN_TX, Ref, Space, - TxCollectionCUD, TxCreateDoc, TxFactory, TxOperations, @@ -31,8 +30,8 @@ import { DOMAIN_CALENDAR } from '@hcengineering/model-calendar' import contact, { DOMAIN_CONTACT } from '@hcengineering/model-contact' import { DOMAIN_SPACE } from '@hcengineering/model-core' import tags, { TagCategory } from '@hcengineering/model-tags' -import { createKanbanTemplate, createSequence, DOMAIN_KANBAN, DOMAIN_TASK } from '@hcengineering/model-task' -import { Applicant, Candidate, Vacancy } from '@hcengineering/recruit' +import { createKanbanTemplate, createSequence, DOMAIN_KANBAN } from '@hcengineering/model-task' +import { Vacancy } from '@hcengineering/recruit' import task, { KanbanTemplate, Sequence } from '@hcengineering/task' import recruit from './plugin' @@ -48,47 +47,6 @@ async function fixImportedTitle (client: MigrationClient): Promise { ) } -async function setCreate (client: MigrationClient): Promise { - while (true) { - const docs = await client.find( - DOMAIN_TASK, - { - _class: recruit.class.Applicant, - createOn: { $exists: false } - }, - { limit: 500 } - ) - if (docs.length === 0) break - const txex = await client.find>(DOMAIN_TX, { - 'tx.objectId': { $in: docs.map((it) => it._id) }, - 'tx._class': core.class.TxCreateDoc - }) - for (const doc of docs) { - const tx = txex.find((it) => it.tx.objectId === doc._id) - if (tx !== undefined) { - await client.update( - DOMAIN_TASK, - { - _id: doc._id - }, - { - createOn: tx.modifiedOn - } - ) - await client.update( - DOMAIN_TX, - { - _id: tx._id - }, - { - 'tx.attributes.createOn': tx.modifiedOn - } - ) - } - } - } -} - async function fillVacancyNumbers (client: MigrationClient): Promise { const docs = await client.find(DOMAIN_SPACE, { _class: recruit.class.Vacancy, @@ -142,7 +100,6 @@ async function fillVacancyNumbers (client: MigrationClient): Promise { export const recruitOperation: MigrateOperation = { async migrate (client: MigrationClient): Promise { - await setCreate(client) await fixImportedTitle(client) await fillVacancyNumbers(client) await client.update( diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 20e970bbfe..c5a2eb44de 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -257,10 +257,6 @@ export class TIssue extends TAttachedDoc implements Issue { @Prop(Collection(tracker.class.TimeSpendReport), tracker.string.TimeSpendReports) reports!: number - @Prop(TypeTimestamp(), tracker.string.CreatedDate) - @ReadOnly() - createOn!: Timestamp - declare childInfo: IssueChildInfo[] } @@ -1780,7 +1776,8 @@ export function createModel (builder: Builder): void { groupBy: ['status'], orderBy: [ ['modifiedOn', SortingOrder.Descending], - ['targetDate', SortingOrder.Descending] + ['targetDate', SortingOrder.Descending], + ['createOn', SortingOrder.Descending] ], other: [] } @@ -1852,7 +1849,8 @@ export function createModel (builder: Builder): void { groupBy: ['lead'], orderBy: [ ['startDate', SortingOrder.Descending], - ['modifiedOn', SortingOrder.Descending] + ['modifiedOn', SortingOrder.Descending], + ['createOn', SortingOrder.Descending] ], other: [] } @@ -1919,7 +1917,8 @@ export function createModel (builder: Builder): void { groupBy: [], orderBy: [ ['startDate', SortingOrder.Descending], - ['modifiedOn', SortingOrder.Descending] + ['modifiedOn', SortingOrder.Descending], + ['createOn', SortingOrder.Descending] ], other: [], groupDepth: 1 diff --git a/models/tracker/src/migration.ts b/models/tracker/src/migration.ts index 4350c73c17..26cd3caaf5 100644 --- a/models/tracker/src/migration.ts +++ b/models/tracker/src/migration.ts @@ -15,34 +15,33 @@ import core, { Class, + DOMAIN_STATUS, + DOMAIN_TX, Doc, DocumentUpdate, - DOMAIN_TX, - generateId, Ref, SortingOrder, StatusCategory, - TxCollectionCUD, TxCreateDoc, TxOperations, TxResult, TxUpdateDoc, - DOMAIN_STATUS + generateId } from '@hcengineering/core' -import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model' +import { MigrateOperation, MigrationClient, MigrationUpgradeClient, createOrUpdate } from '@hcengineering/model' import { DOMAIN_SPACE } from '@hcengineering/model-core' import tags from '@hcengineering/tags' import { - calcRank, - genRanks, Issue, IssueStatus, IssueTemplate, IssueTemplateChild, - Project, Milestone, MilestoneStatus, - TimeReportDayType + Project, + TimeReportDayType, + calcRank, + genRanks } from '@hcengineering/tracker' import { DOMAIN_TRACKER } from '.' import tracker from './plugin' @@ -851,59 +850,6 @@ async function renameProject (client: MigrationClient): Promise { ) } -async function setCreate (client: MigrationClient): Promise { - while (true) { - const docs = await client.find( - DOMAIN_TRACKER, - { - _class: tracker.class.Issue, - createOn: { $exists: false } - }, - { limit: 500 } - ) - if (docs.length === 0) { - break - } - const creates = await client.find>(DOMAIN_TX, { - 'tx.objectId': { $in: docs.map((it) => it._id) }, - 'tx._class': core.class.TxCreateDoc - }) - for (const doc of docs) { - const tx = creates.find((it) => it.tx.objectId === doc._id) - if (tx !== undefined) { - await client.update( - DOMAIN_TRACKER, - { - _id: doc._id - }, - { - createOn: tx.modifiedOn - } - ) - await client.update( - DOMAIN_TX, - { - _id: tx._id - }, - { - 'tx.attributes.createOn': tx.modifiedOn - } - ) - } else { - await client.update( - DOMAIN_TRACKER, - { - _id: doc._id - }, - { - createOn: doc.modifiedOn - } - ) - } - } - } -} - async function fixMilestoneEmptyStatuses (client: MigrationClient): Promise { await client.update( DOMAIN_TRACKER, @@ -928,7 +874,6 @@ export const trackerOperation: MigrateOperation = { await fillRank(client) await renameSprintToMilestone(client) await renameProject(client) - await setCreate(client) // Move all status objects into status domain await client.move( diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index b9379dec2b..165a445b41 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -56,7 +56,8 @@ export interface Doc extends Obj { space: Ref modifiedOn: Timestamp modifiedBy: Ref - createdBy?: Ref + createdBy?: Ref // Marked as optional since it will be filled by platform. + createOn?: Timestamp // Marked as optional since it will be filled by platform. } /** diff --git a/packages/core/src/client.ts b/packages/core/src/client.ts index f6ba56dab5..5791a59f39 100644 --- a/packages/core/src/client.ts +++ b/packages/core/src/client.ts @@ -259,7 +259,16 @@ async function loadModel ( ): Promise { const t = Date.now() - const atxes = await conn.loadModel(lastTxTime) + let atxes = [] + try { + atxes = await conn.loadModel(lastTxTime) + } catch (err: any) { + atxes = await conn.findAll( + core.class.Tx, + { objectSpace: core.space.Model }, + { sort: { _id: SortingOrder.Ascending, modifiedOn: SortingOrder.Ascending } } + ) + } if (reload && atxes.length > modelTransactionThreshold) { return -1 diff --git a/packages/core/src/component.ts b/packages/core/src/component.ts index d12cb22065..dfaa9c62b3 100644 --- a/packages/core/src/component.ts +++ b/packages/core/src/component.ts @@ -172,6 +172,7 @@ export default plugin(coreId, { Object: '' as IntlString, System: '' as IntlString, CreatedBy: '' as IntlString, + CreatedDate: '' as IntlString, Status: '' as IntlString, Account: '' as IntlString, StatusCategory: '' as IntlString diff --git a/packages/core/src/lang/en.json b/packages/core/src/lang/en.json index 01d590eab7..4df0182a32 100644 --- a/packages/core/src/lang/en.json +++ b/packages/core/src/lang/en.json @@ -30,6 +30,7 @@ "Object": "Object", "System": "System", "CreatedBy": "Created by", + "CreatedDate": "Created date", "Status": "Status", "StatusCategory": "Status category", "Account": "Account" diff --git a/packages/core/src/lang/ru.json b/packages/core/src/lang/ru.json index 20e4025de2..eca5f476ca 100644 --- a/packages/core/src/lang/ru.json +++ b/packages/core/src/lang/ru.json @@ -30,6 +30,7 @@ "Object": "Объект", "System": "Система", "CreatedBy": "Создан", + "CreatedDate": "Дата создания", "Status": "Статус", "StatusCategory": "Категория статуса", "Account": "Аккаунт" diff --git a/packages/core/src/tx.ts b/packages/core/src/tx.ts index 115f1a95c1..75fd03b9cd 100644 --- a/packages/core/src/tx.ts +++ b/packages/core/src/tx.ts @@ -353,7 +353,8 @@ export abstract class TxProcessor implements WithTx { space: tx.objectSpace, modifiedBy: tx.modifiedBy, modifiedOn: tx.modifiedOn, - createdBy: tx.createdBy ?? tx.modifiedBy + createdBy: tx.createdBy ?? tx.modifiedBy, + createOn: tx.createOn ?? tx.modifiedBy } as T } diff --git a/plugins/bitrix/src/hr.ts b/plugins/bitrix/src/hr.ts index 9e345f42a3..844a18587a 100644 --- a/plugins/bitrix/src/hr.ts +++ b/plugins/bitrix/src/hr.ts @@ -64,7 +64,6 @@ export async function createApplication ( ...data, state: state._id, number: (incResult as any).object.sequence, - rank: calcRank(lastOne, undefined), - createOn: Date.now() + rank: calcRank(lastOne, undefined) }) } diff --git a/plugins/bitrix/src/sync.ts b/plugins/bitrix/src/sync.ts index 5e4abeb70b..88d6479798 100644 --- a/plugins/bitrix/src/sync.ts +++ b/plugins/bitrix/src/sync.ts @@ -940,8 +940,7 @@ async function synchronizeUsers ( name: combineName(u.NAME, u.LAST_NAME), avatar: u.PERSONAL_PHOTO, active: u.ACTIVE, - city: u.PERSONAL_CITY, - createOn: Date.now() + city: u.PERSONAL_CITY }) accountId = await ops.client.createDoc(contact.class.EmployeeAccount, core.space.Model, { email: u.EMAIL, diff --git a/plugins/chunter-resources/src/components/Channel.svelte b/plugins/chunter-resources/src/components/Channel.svelte index 7dcf6b42a1..91e9d1d895 100644 --- a/plugins/chunter-resources/src/components/Channel.svelte +++ b/plugins/chunter-resources/src/components/Channel.svelte @@ -109,7 +109,7 @@ if (docUpdate === undefined || lastView === undefined) return -1 for (let index = 0; index < messages.length; index++) { const message = messages[index] - if (message.createOn >= lastView) return index + if ((message.createOn ?? 0) >= lastView) return index } return -1 } @@ -209,7 +209,7 @@ {#if newMessagesPos === i} {/if} - {#if i === 0 || isOtherDay(message.createOn, messages[i - 1].createOn)} + {#if i === 0 || isOtherDay(message.createOn ?? 0, messages[i - 1].createOn ?? 0)} {/if} {/if} - {getTime(message.createOn)} + {getTime(message.createOn ?? 0)} {#if message.editedOn}