admin: new interface to manage claims
This commit is contained in:
parent
3932bba83d
commit
1eef71923a
10 changed files with 791 additions and 0 deletions
|
|
@ -248,6 +248,30 @@ 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.Atoi(string(ps.ByName("cid"))); err != nil {
|
||||
return nil, err
|
||||
} else if claim, err := fic.GetClaim(cid); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return f(claim, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func claimAssigneeHandler(f func(fic.ClaimAssignee,[]byte) (interface{}, error)) func (httprouter.Params,[]byte) (interface{}, error) {
|
||||
return func (ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if aid, err := strconv.Atoi(string(ps.ByName("aid"))); err != nil {
|
||||
return nil, err
|
||||
} else if assignee, err := fic.GetAssignee(int64(aid)); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return f(assignee, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fileHandler(f func(fic.EFile,[]byte) (interface{}, error)) func (httprouter.Params,[]byte) (interface{}, error) {
|
||||
return func (ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
if fileid, err := strconv.Atoi(string(ps.ByName("fileid"))); err != nil {
|
||||
|
|
|
|||
Reference in a new issue