SeedCompany / cord-api-v3

Bible translation project management API
MIT License
18 stars 4 forks source link

Engagement Workflow v2 #3245

Open atGit2021 opened 3 weeks ago

atGit2021 commented 3 weeks ago

Monday

atGit2021 commented 3 weeks ago

Todo: commented out StepHistoryToWorkflowEventsMigration file for now

atGit2021 commented 1 week ago

@CarsonF I thought I would have you review before starting to dig into the migration file.

github-actions[bot] commented 1 week ago

🗞 GraphQL Summary

View schema changes ```diff @@ -1463,8 +1463,9 @@ status: SecuredEngagementStatus! """The last time the engagement status was modified""" statusModifiedAt: SecuredDateTime! + workflowEvents: [EngagementWorkflowEvent!]! } input EngagementFilters { language: LanguageFilters @@ -1558,18 +1559,39 @@ """@order 14""" Unapproved @deprecated(reason: "Legacy. Only used in historic data.") } -type EngagementStatusTransition { - label: String! +type EngagementWorkflowEvent { + at: DateTime! + id: ID! + notes: SecuredRichTextNullable! to: EngagementStatus! - type: EngagementTransitionType! + + """The transition taken, null if workflow was bypassed""" + transition: EngagementWorkflowTransition + who: SecuredActor! } -enum EngagementTransitionType { - Approve - Neutral - Reject +""" +A transition for the engagement workflow. + +This is not a normalized entity. +A transition represented by its `key` can have different field values +based on the workflow's state. +""" +type EngagementWorkflowTransition { + disabled: Boolean! + disabledReason: String + + """ + An local identifier for this transition. + It cannot be used to globally identify a transition. + It is passed to the transition mutation. + """ + key: ID! + label: String! + to: EngagementStatus! + type: TransitionType! } type EthnoArt implements Producible & Resource { """Whether the requesting user can delete this resource""" @@ -1632,8 +1654,28 @@ name: String provisionalCode: String } +input ExecuteEngagementTransitionInput { + """ + Bypass the workflow, and go straight to this state. + `transition` is not required and ignored when using this. + """ + bypassTo: EngagementStatus + + """The engagement ID to transition""" + engagement: ID! + + """Any additional user notes related to this transition""" + notes: RichText + + """ + The transition `key` to execute. + This is required unless specifying bypassing the workflow with a `step` input. + """ + transition: ID +} + input ExecuteProgressReportTransitionInput { """Any additional user notes related to this transition""" notes: RichText @@ -2162,8 +2204,9 @@ status: SecuredEngagementStatus! """The last time the engagement status was modified""" statusModifiedAt: SecuredDateTime! + workflowEvents: [EngagementWorkflowEvent!]! } enum InternshipPosition { Administration @@ -2494,8 +2537,9 @@ status: SecuredEngagementStatus! """The last time the engagement status was modified""" statusModifiedAt: SecuredDateTime! + workflowEvents: [EngagementWorkflowEvent!]! } type LanguageEngagementListOutput implements PaginatedList { """Whether the next page exists""" @@ -3187,8 +3231,9 @@ Whether the item should be pinned or not. Omit to toggle the current state. """ pinned: Boolean ): Boolean! + transitionEngagement(input: ExecuteEngagementTransitionInput!): Engagement! transitionProgressReport(input: ExecuteProgressReportTransitionInput!): ProgressReport! transitionProject(input: ExecuteProjectTransitionInput!): Project! """Update a budget""" @@ -4968,8 +5013,9 @@ educations(input: EducationListInput = {count: 25, order: ASC, page: 1, sort: "institution"}): EducationListOutput! @deprecated(reason: "Query via user instead") """Lookup an engagement by ID""" engagement(changeset: ID, id: ID!): Engagement! + engagementWorkflow: Workflow! """Look up engagements""" engagements(input: EngagementListInput = {count: 25, order: ASC, page: 1, sort: "createdAt"}): EngagementListOutput! @@ -5556,16 +5602,16 @@ """ type SecuredEngagementStatus implements Secured { """ Is the current user allowed to bypass transitions entirely - and change the status to any other status? + and change to any other state? """ canBypassTransitions: Boolean! canEdit: Boolean! canRead: Boolean! - """The available statuses a engagement can be transitioned to.""" - transitions: [EngagementStatusTransition!]! + """The transitions currently available to execute for this engagement""" + transitions: [EngagementWorkflowTransition!]! value: EngagementStatus } """ ```

🚨 Breaking Changes