Skip to content
Snippets Groups Projects
Commit 19102a67 authored by Vladymyr Riabov's avatar Vladymyr Riabov
Browse files

Merge branch 'dev' into 'stageMappingSupport'

# Conflicts:
#   entities/entities.go
parents ea471fb0 46c23e76
Branches
Tags
2 merge requests!32Dev,!31+ Status field >> Issue struct
......@@ -46,6 +46,7 @@ type ProjectIssuesReq struct {
Tracker entities.Tracker
ProjectID entities.ProjectID
IssueStatuses []entities.TypeID
AssignedOnly bool
entities.Pagination
}
......
......@@ -16,6 +16,7 @@ import (
"github.com/powerman/rpc-codec/jsonrpc2"
"gitlab.qarea.org/tgms/tgmserr"
"strconv"
)
var log = narada.NewLog("rpcsvc: ")
......@@ -131,6 +132,7 @@ func (r *API) GetProjectIssues(req *ProjectIssuesReq, resp *ProjectIssuesResp) e
Tracker: req.Tracker,
}
is, amount, err := r.tracker.ProjectIssues(ctx, params)
is = r.isAssignedTo(is, req.AssignedOnly, req)
*resp = ProjectIssuesResp{
Issues: is,
......@@ -386,3 +388,32 @@ func reducePath(path string, f func(string) (string, error)) (url string) {
return
}
func (r *API) isAssignedTo(issues []entities.Issue, isAssignedTo bool, req *ProjectIssuesReq) []entities.Issue {
var el int
log.DEBUG("ASSIGNEDONLY: %+b", req.AssignedOnly)
if req.AssignedOnly {
userReq := CurrentUserReq{
Context: req.Context,
Tracker: req.Tracker,
}
userResp := CurrentUserResp{}
err := r.GetCurrentUser(&userReq, &userResp)
if err != nil {
log.DEBUG("Can not get user id: %+v", err)
return issues
}
for _, issue := range issues {
uid, err := strconv.Atoi(userResp.User.ID)
if err != nil {
log.DEBUG("Can not convert user id: %+v", err)
return issues
}
if issue.Assignee == int64(uid) {
issues[el] = issue
el++
}
}
}
return issues
}
......@@ -59,6 +59,7 @@ type Issue struct {
Spent int64
URL string
Status TypeID
Assignee int64
}
type NewIssue struct {
......
......@@ -17,6 +17,7 @@ type taskItem struct {
Title string `json:"content"`
Complete bool `json:"completed"`
URL string `json:"url"`
Assignee int64 `json:"user_id"`
}
type projectItem struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment