mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-23 01:55:00 +02:00
Approve requests (#10486)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -643,6 +643,26 @@ export function eventCheck (
|
||||
return context.eventType === params.eventType
|
||||
}
|
||||
|
||||
export async function approveRequestApproved (
|
||||
client: Client,
|
||||
execution: Execution,
|
||||
params: Record<string, any>,
|
||||
context: Record<string, any>
|
||||
): Promise<boolean> {
|
||||
if (params._id === undefined) return false
|
||||
return context.todo?.group === params._id && context.todo?.approved === true
|
||||
}
|
||||
|
||||
export async function approveRequestRejected (
|
||||
client: Client,
|
||||
execution: Execution,
|
||||
params: Record<string, any>,
|
||||
context: Record<string, any>
|
||||
): Promise<boolean> {
|
||||
if (params._id === undefined) return false
|
||||
return context.todo?.group === params._id && context.todo?.approved === false
|
||||
}
|
||||
|
||||
export function matchCardCheck (
|
||||
client: Client,
|
||||
execution: Execution,
|
||||
@@ -756,3 +776,9 @@ export async function checkProcessSectionVisibility (doc: Card): Promise<boolean
|
||||
const processes = client.getModel().findAllSync(process.class.Process, { masterTag: { $in: anc } })
|
||||
return processes.length > 0
|
||||
}
|
||||
|
||||
export async function checkRequestsSectionVisibility (doc: Card): Promise<boolean> {
|
||||
const client = getClient()
|
||||
const requests = await client.findOne(process.class.ApproveRequest, { card: doc._id })
|
||||
return requests !== undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user