mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 05:55:09 +02:00
EQMS-1650: External approvers (#9987)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
@@ -20,7 +20,10 @@ import documentsPlugin, {
|
||||
documentsId,
|
||||
DocumentState,
|
||||
type Document,
|
||||
type DocumentSpace
|
||||
type DocumentSpace,
|
||||
type ProjectDocument,
|
||||
type ChangeControl,
|
||||
type DocumentRequest
|
||||
} from '@hcengineering/controlled-documents'
|
||||
import { type Builder } from '@hcengineering/model'
|
||||
import chunter from '@hcengineering/model-chunter'
|
||||
@@ -977,9 +980,38 @@ export function defineNotifications (builder: Builder): void {
|
||||
components: { input: { component: chunter.component.ChatMessageInput } }
|
||||
})
|
||||
|
||||
builder.createDoc<ClassCollaborators<Document>>(core.class.ClassCollaborators, core.space.Model, {
|
||||
attachedTo: documents.class.Document,
|
||||
fields: ['author', 'owner'],
|
||||
provideSecurity: true
|
||||
})
|
||||
|
||||
builder.createDoc<ClassCollaborators<ProjectDocument>>(core.class.ClassCollaborators, core.space.Model, {
|
||||
attachedTo: documents.class.ProjectDocument,
|
||||
fields: [],
|
||||
provideSecurity: true
|
||||
})
|
||||
|
||||
builder.createDoc<ClassCollaborators<ChangeControl>>(core.class.ClassCollaborators, core.space.Model, {
|
||||
attachedTo: documents.class.ChangeControl,
|
||||
fields: [],
|
||||
provideSecurity: true
|
||||
})
|
||||
|
||||
builder.createDoc<ClassCollaborators<DocumentRequest>>(core.class.ClassCollaborators, core.space.Model, {
|
||||
attachedTo: documents.class.DocumentRequest,
|
||||
fields: ['requested', 'createdBy'],
|
||||
provideSecurity: true
|
||||
})
|
||||
|
||||
builder.mixin(documents.class.DocumentApprovalRequest, core.class.Class, core.mixin.TxAccessLevel, {
|
||||
updateAccessLevel: AccountRole.Guest
|
||||
})
|
||||
|
||||
builder.createDoc<ClassCollaborators<ControlledDocument>>(core.class.ClassCollaborators, core.space.Model, {
|
||||
attachedTo: documents.class.ControlledDocument,
|
||||
fields: ['author', 'owner', 'reviewers', 'approvers', 'coAuthors']
|
||||
fields: ['author', 'owner', 'reviewers', 'approvers', 'coAuthors', 'externalApprovers'],
|
||||
provideSecurity: true
|
||||
})
|
||||
|
||||
builder.createDoc(
|
||||
|
||||
@@ -145,6 +145,7 @@ async function createProductChangeControlTemplate (tx: TxOperations): Promise<vo
|
||||
requests: 0,
|
||||
reviewers: [],
|
||||
approvers: [],
|
||||
externalApprovers: [],
|
||||
coAuthors: [],
|
||||
code: `TMPL-${seq.sequence + 1}`,
|
||||
seqNumber: 0,
|
||||
@@ -513,6 +514,19 @@ async function migrateCancelDuplicateActiveRequests (client: MigrationClient): P
|
||||
await client.bulk(DOMAIN_REQUEST, operations)
|
||||
}
|
||||
|
||||
async function migrateExternalApprovers (client: MigrationClient): Promise<void> {
|
||||
await client.update(
|
||||
DOMAIN_DOCUMENTS,
|
||||
{
|
||||
_class: documents.class.ControlledDocument,
|
||||
externalApprovers: { $exists: false }
|
||||
},
|
||||
{
|
||||
externalApprovers: []
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export const documentsOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||
await tryMigrate(mode, client, documentsId, [
|
||||
@@ -550,6 +564,10 @@ export const documentsOperation: MigrateOperation = {
|
||||
{
|
||||
state: 'migrateCancelDuplicateActiveRequests',
|
||||
func: migrateCancelDuplicateActiveRequests
|
||||
},
|
||||
{
|
||||
state: 'migrateExternalApprovers',
|
||||
func: migrateExternalApprovers
|
||||
}
|
||||
])
|
||||
},
|
||||
|
||||
@@ -382,6 +382,9 @@ export class TControlledDocument extends THierarchyDocument implements Controlle
|
||||
@Prop(ArrOf(TypeRef(contact.mixin.Employee)), documents.string.Approvers)
|
||||
approvers!: Ref<Employee>[]
|
||||
|
||||
@Prop(ArrOf(TypeRef(contact.mixin.Employee)), documents.string.ExternalApprovers)
|
||||
externalApprovers!: Ref<Employee>[]
|
||||
|
||||
@Prop(ArrOf(TypeRef(contact.mixin.Employee)), documents.string.CoAuthors)
|
||||
coAuthors!: Ref<Employee>[]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user