admin: claims now reference exercices
This commit is contained in:
parent
56b79cae2d
commit
2e3f7c6894
6 changed files with 76 additions and 20 deletions
|
|
@ -38,6 +38,8 @@ type ClaimExported struct {
|
|||
Subject string `json:"subject"`
|
||||
IdTeam *int64 `json:"id_team"`
|
||||
Team *fic.Team `json:"team"`
|
||||
IdExercice *int64 `json:"id_exercice"`
|
||||
Exercice *fic.Exercice `json:"exercice"`
|
||||
IdAssignee *int64 `json:"id_assignee"`
|
||||
Assignee *fic.ClaimAssignee `json:"assignee"`
|
||||
Creation time.Time `json:"creation"`
|
||||
|
|
@ -53,6 +55,9 @@ func showClaim(claim fic.Claim, _ []byte) (interface{}, error) {
|
|||
if e.Team, err = claim.GetTeam(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if e.Exercice, err = claim.GetExercice(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if e.Assignee, err = claim.GetAssignee(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -70,6 +75,7 @@ func showClaim(claim fic.Claim, _ []byte) (interface{}, error) {
|
|||
e.Id = claim.Id
|
||||
e.IdAssignee = claim.IdAssignee
|
||||
e.IdTeam = claim.IdTeam
|
||||
e.IdExercice = claim.IdExercice
|
||||
e.Subject = claim.Subject
|
||||
e.Creation = claim.Creation
|
||||
e.State = claim.State
|
||||
|
|
@ -80,6 +86,7 @@ func showClaim(claim fic.Claim, _ []byte) (interface{}, error) {
|
|||
type ClaimUploaded struct {
|
||||
Subject string `json:"subject"`
|
||||
Team *int64 `json:"id_team"`
|
||||
Exercice *int64 `json:"id_exercice"`
|
||||
Assignee *int64 `json:"id_assignee"`
|
||||
Priority string `json:"priority"`
|
||||
}
|
||||
|
|
@ -101,6 +108,17 @@ func newClaim(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
t = nil
|
||||
}
|
||||
|
||||
var e *fic.Exercice
|
||||
if uc.Exercice != nil {
|
||||
if exercice, err := fic.GetExercice(*uc.Exercice); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
e = &exercice
|
||||
}
|
||||
} else {
|
||||
e = nil
|
||||
}
|
||||
|
||||
var a *fic.ClaimAssignee
|
||||
if uc.Assignee != nil {
|
||||
if assignee, err := fic.GetAssignee(*uc.Assignee); err != nil {
|
||||
|
|
@ -112,7 +130,7 @@ func newClaim(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
a = nil
|
||||
}
|
||||
|
||||
return fic.NewClaim(uc.Subject, t, a, uc.Priority)
|
||||
return fic.NewClaim(uc.Subject, t, e, a, uc.Priority)
|
||||
}
|
||||
|
||||
func clearClaims(_ httprouter.Params, _ []byte) (interface{}, error) {
|
||||
|
|
|
|||
Reference in a new issue