2025-11-05 15:06:07 +00:00
|
|
|
package repositories
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"attune-heart-therapy/internal/models"
|
|
|
|
|
)
|
|
|
|
|
|
2025-11-05 16:58:34 +00:00
|
|
|
// BookingStats represents booking statistics for admin dashboard
|
|
|
|
|
type BookingStats struct {
|
|
|
|
|
TotalBookings int64 `json:"total_bookings"`
|
|
|
|
|
UpcomingBookings int64 `json:"upcoming_bookings"`
|
|
|
|
|
CompletedBookings int64 `json:"completed_bookings"`
|
|
|
|
|
CancelledBookings int64 `json:"cancelled_bookings"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FinancialStats represents financial statistics for admin reports
|
|
|
|
|
type FinancialStats struct {
|
|
|
|
|
TotalRevenue float64 `json:"total_revenue"`
|
|
|
|
|
TotalBookings int64 `json:"total_bookings"`
|
|
|
|
|
AverageBooking float64 `json:"average_booking"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-05 15:06:07 +00:00
|
|
|
// UserRepository handles user data persistence
|
|
|
|
|
type UserRepository interface {
|
|
|
|
|
Create(user *models.User) error
|
|
|
|
|
GetByID(id uint) (*models.User, error)
|
|
|
|
|
GetByEmail(email string) (*models.User, error)
|
|
|
|
|
Update(user *models.User) error
|
|
|
|
|
GetActiveUsersCount() (int64, error)
|
2025-11-05 16:58:34 +00:00
|
|
|
GetAllUsers(limit, offset int) ([]models.User, int64, error)
|
2025-11-05 15:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// BookingRepository handles booking data persistence
|
|
|
|
|
type BookingRepository interface {
|
|
|
|
|
Create(booking *models.Booking) error
|
|
|
|
|
GetByID(id uint) (*models.Booking, error)
|
|
|
|
|
GetByUserID(userID uint) ([]models.Booking, error)
|
2025-11-05 16:35:36 +00:00
|
|
|
GetByPaymentID(paymentID string) (*models.Booking, error)
|
2025-11-05 15:06:07 +00:00
|
|
|
Update(booking *models.Booking) error
|
|
|
|
|
Delete(id uint) error
|
|
|
|
|
GetUpcomingBookings() ([]models.Booking, error)
|
2025-11-05 16:58:34 +00:00
|
|
|
GetAllBookings(limit, offset int) ([]models.Booking, int64, error)
|
|
|
|
|
GetBookingStats() (*BookingStats, error)
|
|
|
|
|
GetFinancialStats(startDate, endDate time.Time) (*FinancialStats, error)
|
2025-11-05 15:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ScheduleRepository handles schedule data persistence
|
|
|
|
|
type ScheduleRepository interface {
|
|
|
|
|
Create(schedule *models.Schedule) error
|
|
|
|
|
GetAvailable(date time.Time) ([]models.Schedule, error)
|
|
|
|
|
Update(schedule *models.Schedule) error
|
|
|
|
|
GetByID(id uint) (*models.Schedule, error)
|
2025-11-05 15:21:56 +00:00
|
|
|
IncrementBookedCount(scheduleID uint) error
|
|
|
|
|
DecrementBookedCount(scheduleID uint) error
|
2025-11-05 15:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NotificationRepository handles notification data persistence
|
|
|
|
|
type NotificationRepository interface {
|
|
|
|
|
Create(notification *models.Notification) error
|
|
|
|
|
GetByID(id uint) (*models.Notification, error)
|
|
|
|
|
Update(notification *models.Notification) error
|
|
|
|
|
GetPendingNotifications() ([]models.Notification, error)
|
|
|
|
|
}
|