Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29163,6 +29163,9 @@ const docTemplate = `{
"inProgressSteps": {
"type": "integer"
},
"overdueSteps": {
"type": "integer"
},
"pendingSteps": {
"type": "integer"
},
Expand Down Expand Up @@ -29355,6 +29358,9 @@ const docTemplate = `{
"evidence-required": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand All @@ -29380,6 +29386,9 @@ const docTemplate = `{
"description": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"is-active": {
"type": "boolean"
},
Expand Down Expand Up @@ -29421,6 +29430,9 @@ const docTemplate = `{
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -29711,6 +29723,9 @@ const docTemplate = `{
"deleted_at": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"due_date": {
"type": "string"
},
"failed-at": {
"type": "string"
},
Expand All @@ -29720,6 +29735,9 @@ const docTemplate = `{
"id": {
"type": "string"
},
"overdue-at": {
"type": "string"
},
"reassignment_history": {
"type": "array",
"items": {
Expand Down Expand Up @@ -29929,6 +29947,9 @@ const docTemplate = `{
"evidence-required": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand All @@ -29949,6 +29970,9 @@ const docTemplate = `{
"description": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"is-active": {
"type": "boolean"
},
Expand Down Expand Up @@ -29978,6 +30002,9 @@ const docTemplate = `{
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -30012,7 +30039,7 @@ const docTemplate = `{
"description": "JSON array of required evidence types",
"type": "string"
},
"grace_period_days": {
"grace-period-days": {
"description": "Override global default if set",
"type": "integer"
},
Expand Down Expand Up @@ -30098,6 +30125,9 @@ const docTemplate = `{
"id": {
"type": "string"
},
"overdue-at": {
"type": "string"
},
"period_label": {
"description": "Scheduling Context",
"type": "string"
Expand Down Expand Up @@ -30204,7 +30234,7 @@ const docTemplate = `{
"$ref": "#/definitions/workflows.WorkflowExecution"
}
},
"grace_period_days": {
"grace-period-days": {
"description": "Override definition/global default if set",
"type": "integer"
},
Expand Down Expand Up @@ -30311,6 +30341,10 @@ const docTemplate = `{
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"description": "Override default grace for this specific step",
"type": "integer"
},
"id": {
"type": "string"
},
Expand Down
38 changes: 36 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -29157,6 +29157,9 @@
"inProgressSteps": {
"type": "integer"
},
"overdueSteps": {
"type": "integer"
},
"pendingSteps": {
"type": "integer"
},
Expand Down Expand Up @@ -29349,6 +29352,9 @@
"evidence-required": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand All @@ -29374,6 +29380,9 @@
"description": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"is-active": {
"type": "boolean"
},
Expand Down Expand Up @@ -29415,6 +29424,9 @@
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -29705,6 +29717,9 @@
"deleted_at": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"due_date": {
"type": "string"
},
"failed-at": {
"type": "string"
},
Expand All @@ -29714,6 +29729,9 @@
"id": {
"type": "string"
},
"overdue-at": {
"type": "string"
},
"reassignment_history": {
"type": "array",
"items": {
Expand Down Expand Up @@ -29923,6 +29941,9 @@
"evidence-required": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand All @@ -29943,6 +29964,9 @@
"description": {
"type": "string"
},
"grace-period-days": {
"type": "integer"
},
"is-active": {
"type": "boolean"
},
Expand Down Expand Up @@ -29972,6 +29996,9 @@
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"type": "integer"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -30006,7 +30033,7 @@
"description": "JSON array of required evidence types",
"type": "string"
},
"grace_period_days": {
"grace-period-days": {
"description": "Override global default if set",
"type": "integer"
},
Expand Down Expand Up @@ -30092,6 +30119,9 @@
"id": {
"type": "string"
},
"overdue-at": {
"type": "string"
},
"period_label": {
"description": "Scheduling Context",
"type": "string"
Expand Down Expand Up @@ -30198,7 +30228,7 @@
"$ref": "#/definitions/workflows.WorkflowExecution"
}
},
"grace_period_days": {
"grace-period-days": {
"description": "Override definition/global default if set",
"type": "integer"
},
Expand Down Expand Up @@ -30305,6 +30335,10 @@
"$ref": "#/definitions/workflows.EvidenceRequirement"
}
},
"grace-period-days": {
"description": "Override default grace for this specific step",
"type": "integer"
},
"id": {
"type": "string"
},
Expand Down
27 changes: 25 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6332,6 +6332,8 @@ definitions:
type: string
inProgressSteps:
type: integer
overdueSteps:
type: integer
pendingSteps:
type: integer
startedAt:
Expand Down Expand Up @@ -6458,6 +6460,8 @@ definitions:
type: string
evidence-required:
type: string
grace-period-days:
type: integer
name:
type: string
suggested-cadence:
Expand All @@ -6473,6 +6477,8 @@ definitions:
type: string
description:
type: string
grace-period-days:
type: integer
is-active:
type: boolean
name:
Expand Down Expand Up @@ -6501,6 +6507,8 @@ definitions:
items:
$ref: '#/definitions/workflows.EvidenceRequirement'
type: array
grace-period-days:
type: integer
name:
type: string
responsible-role:
Expand Down Expand Up @@ -6697,12 +6705,16 @@ definitions:
type: string
deleted_at:
$ref: '#/definitions/gorm.DeletedAt'
due_date:
type: string
failed-at:
type: string
failure_reason:
type: string
id:
type: string
overdue-at:
type: string
reassignment_history:
items:
$ref: '#/definitions/workflows.StepReassignmentHistory'
Expand Down Expand Up @@ -6840,6 +6852,8 @@ definitions:
type: string
evidence-required:
type: string
grace-period-days:
type: integer
name:
type: string
suggested-cadence:
Expand All @@ -6853,6 +6867,8 @@ definitions:
type: string
description:
type: string
grace-period-days:
type: integer
is-active:
type: boolean
name:
Expand All @@ -6872,6 +6888,8 @@ definitions:
items:
$ref: '#/definitions/workflows.EvidenceRequirement'
type: array
grace-period-days:
type: integer
name:
type: string
responsible-role:
Expand All @@ -6895,7 +6913,7 @@ definitions:
evidence_required:
description: JSON array of required evidence types
type: string
grace_period_days:
grace-period-days:
description: Override global default if set
type: integer
id:
Expand Down Expand Up @@ -6953,6 +6971,8 @@ definitions:
type: string
id:
type: string
overdue-at:
type: string
period_label:
description: Scheduling Context
type: string
Expand Down Expand Up @@ -7023,7 +7043,7 @@ definitions:
items:
$ref: '#/definitions/workflows.WorkflowExecution'
type: array
grace_period_days:
grace-period-days:
description: Override definition/global default if set
type: integer
id:
Expand Down Expand Up @@ -7094,6 +7114,9 @@ definitions:
items:
$ref: '#/definitions/workflows.EvidenceRequirement'
type: array
grace-period-days:
description: Override default grace for this specific step
type: integer
id:
type: string
name:
Expand Down
5 changes: 4 additions & 1 deletion internal/api/handler/workflows/step_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ func (h *StepExecutionHandler) TransitionStep(ctx echo.Context) error {
if isNotFoundError(err) {
return ctx.JSON(http.StatusNotFound, api.NewError(err))
}
if errors.Is(err, workflow.ErrInvalidStepTransition) {
return ctx.JSON(http.StatusBadRequest, api.NewError(err))
}
// Check if it's a permission error
if isPermissionError(err) {
return ctx.JSON(http.StatusForbidden, api.NewError(err))
Expand Down Expand Up @@ -420,7 +423,7 @@ func (h *StepExecutionHandler) Fail(ctx echo.Context) error {
return HandleError(err)
}

if err := h.service.Fail(id, req.Reason); err != nil {
if err := h.transitionService.FailStep(ctx.Request().Context(), id, req.Reason); err != nil {
return h.HandleServiceError(ctx, err, "fail", "step execution")
}

Expand Down
Loading
Loading