Add user database migration, core reusable components, and layout structure

This commit is contained in:
2026-05-16 18:54:23 -04:00
parent c7df396a83
commit e132c7a580
33 changed files with 2348 additions and 398 deletions
+9 -4
View File
@@ -20,9 +20,16 @@ func NewRouter(cfg *config.Config, db *sqlx.DB) http.Handler {
// Serve frontend static files
r.Handle("/*", http.FileServer(http.Dir("./web")))
// Protected API
// Public auth routes
auth := handlers.NewAuthHandler(db, cfg)
r.Post("/api/auth/login", auth.Login)
// Protected API routes
r.Group(func(r chi.Router) {
r.Use(OIDCAuth)
r.Use(JWTAuth(cfg.JWTSecret))
r.Post("/api/auth/refresh", auth.Refresh)
r.Get("/api/auth/me", handlers.Me)
wo := handlers.NewWorkOrderHandler(db, cfg)
r.Get("/api/work-orders", wo.List)
@@ -59,8 +66,6 @@ func NewRouter(cfg *config.Config, db *sqlx.DB) http.Handler {
r.Get("/api/registry/vehicles", reg.Vehicles)
r.Get("/api/registry/equipment", reg.Equipment)
r.Get("/api/registry/materials", reg.Materials)
r.Get("/api/me", handlers.Me)
})
return r