Issue created on (#2768)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-03-18 23:14:49 +06:00 committed by GitHub
parent f9c4775579
commit 1fe73b588e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 84 additions and 20 deletions

View File

@ -35,7 +35,8 @@ const object: AttachedData<Issue> = {
reportedTime: 0,
estimation: 0,
reports: 0,
childInfo: []
childInfo: [],
createOn: Date.now()
}
export interface IssueOptions {
@ -97,7 +98,8 @@ async function genIssue (client: TxOperations, statuses: Ref<IssueStatus>[]): Pr
estimation: object.estimation,
reports: 0,
relations: [],
childInfo: []
childInfo: [],
createOn: Date.now()
}
await client.addCollection(
tracker.class.Issue,

View File

@ -37,6 +37,7 @@ import {
Index,
Model,
Prop,
ReadOnly,
TypeMarkup,
TypeRef,
TypeString,
@ -88,6 +89,7 @@ export class TChunterMessage extends TAttachedDoc implements ChunterMessage {
createBy!: Ref<Account>
@Prop(TypeTimestamp(), chunter.string.Create)
@ReadOnly()
createOn!: Timestamp
@Prop(TypeTimestamp(), chunter.string.Edit)

View File

@ -273,6 +273,10 @@ export class TIssue extends TAttachedDoc implements Issue {
@Prop(Collection(tracker.class.TimeSpendReport), tracker.string.TimeSpendReports)
reports!: number
@Prop(TypeTimestamp(), tracker.string.CreatedOn)
@ReadOnly()
createOn!: Timestamp
declare childInfo: IssueChildInfo[]
}

View File

@ -21,6 +21,7 @@ import core, {
generateId,
Ref,
SortingOrder,
TxCollectionCUD,
TxCreateDoc,
TxOperations,
TxResult,
@ -710,6 +711,59 @@ async function renameProject (client: MigrationClient): Promise<void> {
)
}
async function setCreate (client: MigrationClient): Promise<void> {
while (true) {
const docs = await client.find<Issue>(
DOMAIN_TRACKER,
{
_class: tracker.class.Issue,
createOn: { $exists: false }
},
{ limit: 500 }
)
if (docs.length === 0) {
break
}
const creates = await client.find<TxCollectionCUD<Issue, Issue>>(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
}
)
}
}
}
}
export const trackerOperation: MigrateOperation = {
async migrate (client: MigrationClient): Promise<void> {
await client.update(
@ -725,6 +779,7 @@ export const trackerOperation: MigrateOperation = {
await migrateIssueParentInfo(client)
await fillRank(client)
await renameProject(client)
await setCreate(client)
},
async upgrade (client: MigrationUpgradeClient): Promise<void> {
const tx = new TxOperations(client, core.account.System)

View File

@ -34,7 +34,8 @@ export default mergeIds(trackerId, tracker, {
GotoComponents: '' as IntlString,
GotoTrackerApplication: '' as IntlString,
SearchIssue: '' as IntlString,
Parent: '' as IntlString
Parent: '' as IntlString,
CreatedOn: '' as IntlString
},
component: {
// Required to pass build without errorsF

View File

@ -282,7 +282,8 @@
"WorkDayLength": "Select length of working day",
"SevenHoursLength": "Seven Hours",
"EightHoursLength": "Eight Hours"
"EightHoursLength": "Eight Hours",
"CreatedOn": "Created on"
},
"status": {}
}

View File

@ -282,7 +282,8 @@
"WorkDayLength": "Выберите длину рабочего дня",
"SevenHoursLength": "Семь Часов",
"EightHoursLength": "Восемь Часов"
"EightHoursLength": "Восемь Часов",
"CreatedOn": "Создана"
},
"status": {}
}

View File

@ -115,7 +115,7 @@
const defaultIssue = {
title: '',
description: '',
assignee: '' as Ref<Employee>,
assignee,
component,
sprint,
number: 0,
@ -130,7 +130,8 @@
reportedTime: 0,
estimation: 0,
reports: 0,
childInfo: []
childInfo: [],
createOn: Date.now()
}
let object = originalIssue
@ -166,7 +167,7 @@
$: if (templateId !== undefined) {
templateQuery.query(tracker.class.IssueTemplate, { _id: templateId }, (res) => {
template = res.shift()
template = res[0]
})
} else {
template = undefined
@ -455,7 +456,8 @@
estimation: object.estimation,
reports: 0,
relations: relatedTo !== undefined ? [{ _id: relatedTo._id, _class: relatedTo._class }] : [],
childInfo: []
childInfo: [],
createOn: Date.now()
}
await client.addCollection(

View File

@ -93,7 +93,8 @@
estimation: subIssue.estimation,
reports: 0,
relations: [],
childInfo: []
childInfo: [],
createOn: Date.now()
}
await client.addCollection(

View File

@ -65,7 +65,8 @@
estimation: 0,
reportedTime: 0,
reports: 0,
childInfo: []
childInfo: [],
createOn: Date.now()
}
}

View File

@ -66,7 +66,6 @@
}
$: _space = space
let spaceRef: Project | undefined
$: canSave = getTitle(object.title ?? '').length > 0
@ -136,14 +135,7 @@
createMore={false}
>
<svelte:fragment slot="header">
<SpaceSelector
_class={tracker.class.Project}
label={tracker.string.Project}
bind:space={_space}
on:space={(evt) => {
spaceRef = evt.detail
}}
/>
<SpaceSelector _class={tracker.class.Project} label={tracker.string.Project} bind:space={_space} />
</svelte:fragment>
<svelte:fragment slot="title" let:label>
<Label {label} />

View File

@ -194,6 +194,8 @@ export interface Issue extends AttachedDoc {
childInfo: IssueChildInfo[]
createOn: Timestamp
template?: {
// A template issue is based on
template: Ref<IssueTemplate>