Add radar mock
This commit is contained in:
parent
5b33b7ffcf
commit
421260a80a
4 changed files with 230 additions and 12 deletions
27
sync/radar.go
Normal file
27
sync/radar.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package sync
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
)
|
||||
|
||||
type contentRadar struct {
|
||||
URL ContentURL
|
||||
User User
|
||||
}
|
||||
|
||||
func getRadar(w http.ResponseWriter, r *http.Request, u *models.User) {
|
||||
ctx := r.Context()
|
||||
userContent, err := contentForUser(ctx, u)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
data := contentRadar{
|
||||
URL: newContentURL(),
|
||||
User: userContent,
|
||||
}
|
||||
html.RenderOrError(w, "sync/radar.html", data)
|
||||
}
|
||||
|
|
@ -66,6 +66,7 @@ func Router() chi.Router {
|
|||
r.Method("GET", "/pool/upload", auth.NewEnsureAuth(getPoolUpload))
|
||||
r.Method("GET", "/pool/upload/{id}", auth.NewEnsureAuth(getPoolUploadByID))
|
||||
r.Method("POST", "/pool/upload", auth.NewEnsureAuth(postPoolUpload))
|
||||
r.Method("GET", "/radar", auth.NewEnsureAuth(getRadar))
|
||||
r.Method("GET", "/setting", auth.NewEnsureAuth(getSetting))
|
||||
r.Method("GET", "/setting/district", auth.NewEnsureAuth(getSettingDistrict))
|
||||
r.Method("GET", "/setting/integration", auth.NewEnsureAuth(getSettingIntegration))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue