blob: 536bda16b7a75f4a77705617832319dec4c05466 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package task
import "time"
type StoryState string
const (
StoryPending StoryState = "PENDING"
StoryInProgress StoryState = "IN_PROGRESS"
StoryShippable StoryState = "SHIPPABLE"
StoryDeployed StoryState = "DEPLOYED"
StoryValidating StoryState = "VALIDATING"
StoryReviewReady StoryState = "REVIEW_READY"
StoryNeedsFix StoryState = "NEEDS_FIX"
)
type Story struct {
ID string `json:"id"`
Name string `json:"name"`
ProjectID string `json:"project_id"`
BranchName string `json:"branch_name"`
DeployConfig string `json:"deploy_config"`
ValidationJSON string `json:"validation_json"`
Status StoryState `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
var validStoryTransitions = map[StoryState]map[StoryState]bool{
StoryPending: {StoryInProgress: true},
StoryInProgress: {StoryShippable: true, StoryNeedsFix: true},
StoryShippable: {StoryDeployed: true},
StoryDeployed: {StoryValidating: true},
StoryValidating: {StoryReviewReady: true, StoryNeedsFix: true},
StoryReviewReady: {},
StoryNeedsFix: {StoryInProgress: true},
}
func ValidStoryTransition(from, to StoryState) bool {
return validStoryTransitions[from][to]
}
|