Add radar mock

This commit is contained in:
Eli Ribble 2026-02-16 19:14:58 +00:00
parent 5b33b7ffcf
commit 421260a80a
No known key found for this signature in database
4 changed files with 230 additions and 12 deletions

27
sync/radar.go Normal file
View 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)
}

View file

@ -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))