Added booking approvals

This commit is contained in:
2026-01-19 22:32:25 +00:00
parent 73610e5d8e
commit 1dd37a8d22
7 changed files with 110 additions and 50 deletions
-1
View File
@@ -1 +0,0 @@
package admin
+4 -1
View File
@@ -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,
+7
View File
@@ -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