booking modal part 1
This commit is contained in:
+1063
-206
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+4
-5
@@ -23,15 +23,10 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// 1. Read the environment variable
|
||||
jwtSecret := os.Getenv("JWT_SECRET_KEY")
|
||||
|
||||
// 2. Add a check to ensure the secret is set
|
||||
if jwtSecret == "" {
|
||||
log.Fatal("FATAL: JWT_SECRET_KEY environment variable not set. Application cannot start.")
|
||||
}
|
||||
|
||||
// 3. Use the environment variable for initialization
|
||||
auth.InitJWT(jwtSecret)
|
||||
}
|
||||
|
||||
@@ -109,6 +104,7 @@ func main() {
|
||||
|
||||
// Booking routes for authenticated users
|
||||
r.Route("/bookings", func(r chi.Router) {
|
||||
r.Get("/", bookings.GetAllUserBookingsHandler)
|
||||
r.Post("/", bookings.CreateBookingHandler)
|
||||
r.Get("/{id}", bookings.GetBookingHandler)
|
||||
r.Put("/{id}", bookings.EditBookingHandler)
|
||||
@@ -129,6 +125,9 @@ func main() {
|
||||
})
|
||||
|
||||
r.Route("/admin/bookings", func(r chi.Router) {
|
||||
r.Get("/", bookings.GetAllAdminBookingsHandler)
|
||||
r.Get("/search", bookings.SearchAdminBookingsHandler)
|
||||
r.Get("/user/{user_id}", bookings.GetAllBookingsByUserHandler)
|
||||
r.Get("/{id}", bookings.GetAdminBookingHandler)
|
||||
r.Get("/{id}/summary", bookings.GetAdminBookingSummaryHandler)
|
||||
r.Put("/{id}/progress", bookings.ProgressBookingHandler)
|
||||
|
||||
Reference in New Issue
Block a user