admin: Insert $team assignee in db automatically
This commit is contained in:
parent
f5941dcece
commit
abf0715dbf
4 changed files with 37 additions and 32 deletions
|
|
@ -171,11 +171,11 @@ func clearClaims(_ httprouter.Params, _ []byte) (interface{}, error) {
|
|||
|
||||
func generateTeamIssuesFile(team fic.Team) error {
|
||||
if my, err := team.MyIssueFile(); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Unable to generate issue FILE (tid=%d): %w", team.Id, err)
|
||||
} else if j, err := json.Marshal(my); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Unable to encode issues' file JSON: %w", err)
|
||||
} else if err = ioutil.WriteFile(path.Join(TeamsDir, fmt.Sprintf("%d", team.Id), "issues.json"), j, 0644); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Unable to write issues' file: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,9 +283,9 @@ func eventHandler(f func(fic.Event, []byte) (interface{}, error)) func(httproute
|
|||
func claimHandler(f func(fic.Claim, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
|
||||
return func(ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if cid, err := strconv.ParseInt(string(ps.ByName("cid")), 10, 64); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Invalid claim id: %w", err)
|
||||
} else if claim, err := fic.GetClaim(cid); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Unable to find requested claim (id=%d): %w", cid, err)
|
||||
} else {
|
||||
return f(claim, body)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue