Skip to content

Commit

Permalink
Merge pull request #67 from joshuaspence/participant
Browse files Browse the repository at this point in the history
Support escalation and none participants
  • Loading branch information
uraviOG authored Dec 4, 2020
2 parents d4146e3 + d7ccb7a commit d90cad0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions og/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ func validateParticipants(rotation *Rotation) error {
if participant.Type == "" {
return errors.New("Participant type cannot be empty.")
}
if !(participant.Type == User || participant.Type == Team) {
return errors.New("Participant type should be one of these: 'User', 'Team'")
if !(participant.Type == User || participant.Type == Team || participant.Type == Escalation || participant.Type == None) {
return errors.New("Participant type should be one of these: 'User', 'Team', 'Escalation', 'None'")
}
if participant.Type == User && participant.Username == "" && participant.Id == "" {
return errors.New("For participant type user either username or id must be provided.")
}
if participant.Type == Team && participant.Name == "" && participant.Id == "" {
return errors.New("For participant type team either team name or id must be provided.")
}
if participant.Type == Escalation && participant.Name == "" && participant.Id == "" {
return errors.New("For participant type escalation either escalation name or id must be provided.")
}
}
return nil
}
Expand Down

0 comments on commit d90cad0

Please sign in to comment.