mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 21:35:10 +00:00
UBERF-4840 (#4308)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
b0bc0bc566
commit
800f846228
@ -15,17 +15,16 @@
|
|||||||
|
|
||||||
import core, {
|
import core, {
|
||||||
DOMAIN_STATUS,
|
DOMAIN_STATUS,
|
||||||
SortingOrder,
|
DOMAIN_TX,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
|
TxProcessor,
|
||||||
generateId,
|
generateId,
|
||||||
|
toIdMap,
|
||||||
type Data,
|
type Data,
|
||||||
type Ref,
|
type Ref,
|
||||||
type Status,
|
type Status,
|
||||||
toIdMap,
|
type Tx,
|
||||||
DOMAIN_TX,
|
type TxCreateDoc
|
||||||
type TxCreateDoc,
|
|
||||||
TxProcessor,
|
|
||||||
type Tx
|
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import {
|
import {
|
||||||
createOrUpdate,
|
createOrUpdate,
|
||||||
@ -39,14 +38,14 @@ import { DOMAIN_TASK, createProjectType, fixTaskTypes } from '@hcengineering/mod
|
|||||||
import tags from '@hcengineering/tags'
|
import tags from '@hcengineering/tags'
|
||||||
import task, { type ProjectType, type TaskType } from '@hcengineering/task'
|
import task, { type ProjectType, type TaskType } from '@hcengineering/task'
|
||||||
import {
|
import {
|
||||||
type IssueStatus,
|
|
||||||
TimeReportDayType,
|
TimeReportDayType,
|
||||||
baseIssueTaskStatuses,
|
baseIssueTaskStatuses,
|
||||||
classicIssueTaskStatuses,
|
classicIssueTaskStatuses,
|
||||||
createStatesData
|
createStatesData,
|
||||||
|
type IssueStatus
|
||||||
} from '@hcengineering/tracker'
|
} from '@hcengineering/tracker'
|
||||||
import tracker from './plugin'
|
|
||||||
import { PaletteColorIndexes } from '@hcengineering/ui/src/colors'
|
import { PaletteColorIndexes } from '@hcengineering/ui/src/colors'
|
||||||
|
import tracker from './plugin'
|
||||||
|
|
||||||
async function createDefaultProject (tx: TxOperations): Promise<void> {
|
async function createDefaultProject (tx: TxOperations): Promise<void> {
|
||||||
const current = await tx.findOne(tracker.class.Project, {
|
const current = await tx.findOne(tracker.class.Project, {
|
||||||
@ -119,30 +118,31 @@ async function createDefaultProject (tx: TxOperations): Promise<void> {
|
|||||||
|
|
||||||
// Create new if not deleted by customers.
|
// Create new if not deleted by customers.
|
||||||
if (current === undefined && currentDeleted === undefined) {
|
if (current === undefined && currentDeleted === undefined) {
|
||||||
const state = await tx.findOne(
|
const taskType = await tx.findOne(task.class.TaskType, {
|
||||||
tracker.class.IssueStatus,
|
_id: tracker.taskTypes.Issue
|
||||||
{ space: tracker.ids.DefaultProjectType },
|
})
|
||||||
{ sort: { rank: SortingOrder.Ascending } }
|
if (taskType !== undefined) {
|
||||||
)
|
const state = await tx.findOne(core.class.Status, { _id: taskType.statuses[0] })
|
||||||
if (state !== undefined) {
|
if (state !== undefined) {
|
||||||
await tx.createDoc(
|
await tx.createDoc(
|
||||||
tracker.class.Project,
|
tracker.class.Project,
|
||||||
core.space.Space,
|
core.space.Space,
|
||||||
{
|
{
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
description: 'Default project',
|
description: 'Default project',
|
||||||
private: false,
|
private: false,
|
||||||
members: [],
|
members: [],
|
||||||
archived: false,
|
archived: false,
|
||||||
identifier: 'TSK',
|
identifier: 'TSK',
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
defaultIssueStatus: state._id,
|
defaultIssueStatus: state._id,
|
||||||
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay,
|
defaultTimeReportDay: TimeReportDayType.PreviousWorkDay,
|
||||||
defaultAssignee: undefined,
|
defaultAssignee: undefined,
|
||||||
type: tracker.ids.ClassingProjectType
|
type: tracker.ids.ClassingProjectType
|
||||||
},
|
},
|
||||||
tracker.project.DefaultProject
|
tracker.project.DefaultProject
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user