Skip to content

Commit 3efa841

Browse files
committed
feat: add typing for manual approval type, user approval config and payload
1 parent 273604d commit 3efa841

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/Common/Types.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Placement } from 'tippy.js'
1919
import { ImageComment, ReleaseTag } from './ImageTags.Types'
2020
import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.'
2121
import { RegistryType } from '../Shared'
22+
import { UserGroupDTO } from '@Pages/GlobalConfigurations'
2223

2324
/**
2425
* Generic response type object with support for overriding the result type
@@ -319,9 +320,34 @@ export enum DeploymentNodeType {
319320
APPROVAL = 'APPROVAL',
320321
}
321322

323+
export enum ManualApprovalType {
324+
specific = 'SPECIFIC',
325+
any = 'ANY',
326+
notConfigured = 'NOT_CONFIGURED',
327+
}
328+
329+
// TODO: Need to verify this change for all impacting areas
322330
export interface UserApprovalConfigType {
331+
type: ManualApprovalType
323332
requiredCount: number
324-
}
333+
specificUsers: {
334+
identifiers: string[]
335+
}
336+
userGroups: (Pick<UserGroupDTO, 'identifier'> & {
337+
requiredCount: number
338+
})[]
339+
}
340+
341+
export type UserApprovalConfigPayloadType =
342+
| ({
343+
type: ManualApprovalType.any
344+
} & Pick<UserApprovalConfigType, 'requiredCount'>)
345+
| ({
346+
type: ManualApprovalType.specific
347+
} & Pick<UserApprovalConfigType, 'userGroups' | 'specificUsers'>)
348+
| {
349+
type: ManualApprovalType.notConfigured
350+
}
325351

326352
interface ApprovalUserDataType {
327353
dataId: number

0 commit comments

Comments
 (0)