Add NoOp email service, /docs shortcut and fix streak timezone bug
Replace nil email service pattern with NoOpEmailService (Null Object) to eliminate nil pointer panics across all handlers. Add /docs route as a shortcut to Swagger UI. Fix streak calculation returning 0 when server timezone differs from UTC — CreatedAt was not converted to UTC before date extraction.
This commit is contained in:
@@ -30,6 +30,9 @@ func NewRouter(appURL string, habitHandlers *HabitHandlers, authHandlers *AuthHa
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
r.Get("/docs", httpSwagger.Handler(
|
||||
httpSwagger.URL("/api/v1/docs/doc.json"),
|
||||
))
|
||||
r.Get("/api/v1/docs", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/api/v1/docs/index.html", http.StatusMovedPermanently)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user