Populate report URI and district on communication list
This commit is contained in:
parent
909665ab6c
commit
6350aa00d5
2 changed files with 6 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ func AddRoutes(r *mux.Router) {
|
|||
r.Handle("/avatar/{uuid}", authenticatedHandlerGetImage(avatar.ByUUIDGet)).Methods("GET").Name("avatar.ByUUIDGet")
|
||||
r.Handle("/avatar", authenticatedHandlerPostMultipart(avatar.Create, file.CollectionAvatar)).Methods("POST")
|
||||
r.Handle("/client/ios", auth.NewEnsureAuth(handleClientIos)).Methods("GET")
|
||||
communication := resource.Communication(r)
|
||||
communication := resource.Communication(router)
|
||||
r.Handle("/communication", authenticatedHandlerJSON(communication.List)).Methods("GET")
|
||||
compliance_request := resource.ComplianceRequest(router)
|
||||
r.Handle("/compliance-request/mailer", authenticatedHandlerJSONPost(compliance_request.CreateMailer)).Methods("POST")
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/mux"
|
||||
//"github.com/gorilla/mux"
|
||||
//"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type communicationR struct {
|
||||
router *mux.Router
|
||||
router *router
|
||||
}
|
||||
|
||||
func Communication(r *mux.Router) *communicationR {
|
||||
func Communication(r *router) *communicationR {
|
||||
return &communicationR{
|
||||
router: r,
|
||||
}
|
||||
|
|
@ -53,6 +53,8 @@ func (res *communicationR) List(ctx context.Context, r *http.Request, user platf
|
|||
}
|
||||
comms := make([]communication, len(reports))
|
||||
for i, report := range reports {
|
||||
populateDistrictURI(report, res.router)
|
||||
populateReportURI(report, res.router)
|
||||
comms[i] = communication{
|
||||
Created: report.Created,
|
||||
ID: report.PublicID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue