2025-12-16 16:37:53 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
|
"github.com/go-chi/render"
|
|
|
|
|
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func AddRoutes(r chi.Router) {
|
|
|
|
|
r.Use(render.SetContentType(render.ContentTypeJSON))
|
2026-03-27 06:08:55 -07:00
|
|
|
// Unauthenticated endpoints
|
|
|
|
|
r.Post("/signin", handlerJSONPost(postSignin))
|
|
|
|
|
r.Post("/signup", handlerJSONPost(postSignup))
|
|
|
|
|
// Authenticated endpoints
|
2025-12-16 16:37:53 +00:00
|
|
|
r.Method("POST", "/audio/{uuid}", auth.NewEnsureAuth(apiAudioPost))
|
|
|
|
|
r.Method("POST", "/audio/{uuid}/content", auth.NewEnsureAuth(apiAudioContentPost))
|
2026-03-11 22:50:36 +00:00
|
|
|
r.Method("GET", "/client/ios", auth.NewEnsureAuth(handleClientIos))
|
|
|
|
|
r.Method("GET", "/communication", authenticatedHandlerJSON(listCommunication))
|
2026-03-27 06:08:55 -07:00
|
|
|
r.Method("POST", "/configuration/integration/arcgis", authenticatedHandlerJSONPost(postConfigurationIntegrationArcgis))
|
|
|
|
|
r.Method("POST", "/configuration/upload/pool/flyover", authenticatedHandlerPostMultipart(postUploadPoolFlyoverCreate))
|
|
|
|
|
r.Method("POST", "/configuration/upload/pool/custom", authenticatedHandlerPostMultipart(postUploadPoolCustomCreate))
|
|
|
|
|
r.Method("POST", "/configuration/upload/{id}/commit", authenticatedHandlerJSONPost(postUploadCommit))
|
|
|
|
|
r.Method("POST", "/configuration/upload/{id}/discard", authenticatedHandlerJSONPost(postUploadDiscard))
|
2026-03-12 23:49:16 +00:00
|
|
|
r.Method("GET", "/events", auth.NewEnsureAuth(streamEvents))
|
2025-12-16 16:37:53 +00:00
|
|
|
r.Method("POST", "/image/{uuid}", auth.NewEnsureAuth(apiImagePost))
|
2026-03-07 02:02:10 +00:00
|
|
|
r.Method("GET", "/image/{uuid}/content", auth.NewEnsureAuth(apiImageContentGet))
|
2025-12-16 16:37:53 +00:00
|
|
|
r.Method("POST", "/image/{uuid}/content", auth.NewEnsureAuth(apiImageContentPost))
|
2026-03-05 15:41:56 +00:00
|
|
|
r.Method("GET", "/leads", authenticatedHandlerJSON(listLead))
|
2026-03-05 14:18:10 +00:00
|
|
|
r.Method("POST", "/leads", authenticatedHandlerJSONPost(postLeads))
|
2026-03-11 22:50:36 +00:00
|
|
|
r.Method("GET", "/mosquito-source", auth.NewEnsureAuth(apiMosquitoSource))
|
2026-03-14 01:14:30 +00:00
|
|
|
r.Method("POST", "/publicreport/invalid", authenticatedHandlerJSONPost(postPublicreportInvalid))
|
2026-03-19 17:41:38 +00:00
|
|
|
r.Method("POST", "/publicreport/signal", authenticatedHandlerJSONPost(postPublicreportSignal))
|
2026-03-15 22:38:36 +00:00
|
|
|
r.Method("POST", "/publicreport/message", authenticatedHandlerJSONPost(postPublicreportMessage))
|
2026-03-11 22:50:36 +00:00
|
|
|
r.Method("POST", "/review/pool", authenticatedHandlerJSONPost(postReviewPool))
|
|
|
|
|
r.Method("GET", "/review-task/pool", authenticatedHandlerJSON(listReviewTaskPool))
|
|
|
|
|
r.Method("GET", "/service-request", auth.NewEnsureAuth(apiServiceRequest))
|
|
|
|
|
r.Method("GET", "/signal", authenticatedHandlerJSON(listSignal))
|
2026-03-27 06:08:55 -07:00
|
|
|
r.Method("POST", "/sudo/email", authenticatedHandlerJSONPost(postSudoEmail))
|
|
|
|
|
r.Method("POST", "/sudo/sms", authenticatedHandlerJSONPost(postSudoSMS))
|
|
|
|
|
r.Method("POST", "/sudo/sse", authenticatedHandlerJSONPost(postSudoSSE))
|
2026-03-11 22:50:36 +00:00
|
|
|
r.Method("GET", "/trap-data", auth.NewEnsureAuth(apiTrapData))
|
2026-03-11 14:28:59 +00:00
|
|
|
r.Method("GET", "/tile/{z}/{y}/{x}", auth.NewEnsureAuth(getTile))
|
2026-03-25 21:44:06 -07:00
|
|
|
r.Method("GET", "/upload/{id}", authenticatedHandlerJSON(getUploadByID))
|
2026-03-22 01:22:44 +00:00
|
|
|
r.Method("GET", "/user/self", authenticatedHandlerJSON(getUserSelf))
|
2026-03-20 05:20:37 +00:00
|
|
|
r.Method("GET", "/user/suggestion", authenticatedHandlerJSON(listUserSuggestion))
|
|
|
|
|
r.Method("GET", "/user", authenticatedHandlerJSON(listUser))
|
2025-12-16 16:37:53 +00:00
|
|
|
|
|
|
|
|
// Unauthenticated endpoints
|
2026-01-15 22:56:32 +00:00
|
|
|
r.Get("/district", apiGetDistrict)
|
2026-01-24 19:13:55 +00:00
|
|
|
r.Get("/district/{slug}/logo", apiGetDistrictLogo)
|
2026-02-28 23:40:21 +00:00
|
|
|
r.Get("/compliance-request/image/pool/{public_id}", getComplianceRequestImagePool)
|
2026-01-29 17:30:21 +00:00
|
|
|
r.Post("/twilio/call", twilioCallPost)
|
|
|
|
|
r.Post("/twilio/call/status", twilioCallStatusPost)
|
2026-01-21 03:30:03 +00:00
|
|
|
r.Post("/twilio/message", twilioMessagePost)
|
|
|
|
|
r.Post("/twilio/text", twilioTextPost)
|
2026-01-29 17:30:21 +00:00
|
|
|
r.Post("/twilio/text/status", twilioTextStatusPost)
|
2026-01-29 21:53:49 +00:00
|
|
|
r.Get("/voipms/text", voipmsTextGet)
|
|
|
|
|
r.Post("/voipms/text", voipmsTextPost)
|
2025-12-16 16:37:53 +00:00
|
|
|
r.Get("/webhook/fieldseeker", webhookFieldseeker)
|
|
|
|
|
r.Post("/webhook/fieldseeker", webhookFieldseeker)
|
|
|
|
|
}
|