Added booking approvals
This commit is contained in:
@@ -1 +0,0 @@
|
||||
package admin
|
||||
@@ -771,6 +771,7 @@ func GetAdminBookingHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// ----------------------------
|
||||
serviceRows, err := db.DB.Query(r.Context(), `
|
||||
SELECT
|
||||
bs.service_id,
|
||||
s.name,
|
||||
coalesce(bs.override_price, s.price) as price,
|
||||
coalesce(bs.override_duration_minutes, s.duration_minutes) as duration_minutes
|
||||
@@ -790,11 +791,12 @@ func GetAdminBookingHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var durationMinutesTotal int
|
||||
|
||||
for serviceRows.Next() {
|
||||
var serviceID string
|
||||
var name string
|
||||
var price float64
|
||||
var durationMinutes int
|
||||
|
||||
if err := serviceRows.Scan(&name, &price, &durationMinutes); err != nil {
|
||||
if err := serviceRows.Scan(&serviceID, &name, &price, &durationMinutes); err != nil {
|
||||
log.Printf("Failed to scan service for booking %s: %v", bookingID, err)
|
||||
http.Error(w, "Internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -804,6 +806,7 @@ func GetAdminBookingHandler(w http.ResponseWriter, r *http.Request) {
|
||||
totalAmount += price
|
||||
durationMinutesTotal += durationMinutes
|
||||
booking.Services = append(booking.Services, BookingService{
|
||||
ServiceID: serviceID, // now set
|
||||
ServiceName: &name,
|
||||
Price: &price,
|
||||
DurationMinutes: &durationMinutes,
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"crussell/handlers/notifications"
|
||||
"crussell/handlers/scheduling"
|
||||
"crussell/handlers/services"
|
||||
"crussell/handlers/today"
|
||||
"crussell/handlers/user"
|
||||
)
|
||||
|
||||
@@ -140,6 +141,12 @@ func main() {
|
||||
r.Get("/{id}", user.GetAdminUserHandler)
|
||||
})
|
||||
|
||||
r.Route("/admin/today", func(r chi.Router) {
|
||||
r.Get("/current-next", today.GetCurrentAndNextHandler)
|
||||
r.Get("/appointments", today.GetTodayAppointmentsHandler)
|
||||
r.Get("/pending-approvals", today.GetPendingApprovalsHandler)
|
||||
})
|
||||
|
||||
// --- Admin Notifications ---
|
||||
r.Route("/admin/notifications", func(r chi.Router) {
|
||||
// List all unacknowledged notifications
|
||||
|
||||
Reference in New Issue
Block a user