2026-01-13 20:26:15 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/api"
|
2026-03-21 05:38:42 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/static"
|
2026-01-13 20:26:15 +00:00
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Router() chi.Router {
|
|
|
|
|
r := chi.NewRouter()
|
|
|
|
|
|
|
|
|
|
// Unauthenticated endpoints
|
|
|
|
|
r.Get("/arcgis/oauth/begin", getArcgisOauthBegin)
|
|
|
|
|
r.Get("/arcgis/oauth/callback", getArcgisOauthCallback)
|
2026-02-28 23:18:25 +00:00
|
|
|
r.Get("/mailer/{code}", getMailer)
|
|
|
|
|
r.Get("/mailer/{code}/preview", getMailerPreview)
|
2026-01-13 20:26:15 +00:00
|
|
|
r.Get("/district", getDistrict)
|
|
|
|
|
|
2026-02-10 16:24:37 +00:00
|
|
|
// Mock endpoints
|
2026-02-16 19:52:20 +00:00
|
|
|
r.Get("/mock", renderMockList)
|
|
|
|
|
addMock(r, "/mock/report", "sync/mock/report.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}", "sync/mock/report-detail.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}/confirm", "sync/mock/report-confirmation.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}/contribute", "sync/mock/report-contribute.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}/evidence", "sync/mock/report-evidence.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}/schedule", "sync/mock/report-schedule.html")
|
|
|
|
|
addMock(r, "/mock/report/{code}/update", "sync/mock/report-update.html")
|
2026-01-13 20:26:15 +00:00
|
|
|
|
2026-02-10 16:24:37 +00:00
|
|
|
// Utility endpoints
|
2026-01-22 18:37:00 +00:00
|
|
|
r.Get("/privacy", getPrivacy)
|
2026-01-13 20:26:15 +00:00
|
|
|
r.Get("/qr-code/report/{code}", getQRCodeReport)
|
2026-02-28 23:18:25 +00:00
|
|
|
r.Get("/qr-code/mailer/{code}", getQRCodeMailer)
|
2026-02-07 05:51:21 +00:00
|
|
|
r.Get("/template-test", getTemplateTest)
|
2026-01-13 20:26:15 +00:00
|
|
|
|
|
|
|
|
// Authenticated endpoints
|
|
|
|
|
r.Route("/api", api.AddRoutes)
|
2026-03-01 21:14:48 +00:00
|
|
|
|
2026-03-27 06:08:55 -07:00
|
|
|
r.Get("/", getRoot)
|
|
|
|
|
r.Get("/_/*", getRoot)
|
2026-01-13 20:26:15 +00:00
|
|
|
|
2026-03-21 05:38:42 +00:00
|
|
|
static.AddStaticRoute(r, "/static")
|
2026-01-13 20:26:15 +00:00
|
|
|
return r
|
|
|
|
|
}
|