- Add JWT authentication middleware with token validation - Implement user context extraction methods for user ID, email, and admin status - Create admin middleware to restrict access to admin-only routes - Add convenience method to combine authentication and admin authorization - Update auth middleware to handle token parsing, validation, and context setting - Enhance error handling for various authentication scenarios - Add new JWT service and related dependencies in go.mod
22 lines
566 B
Go
22 lines
566 B
Go
package repositories
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// Repositories holds all repository instances
|
|
type Repositories struct {
|
|
User UserRepository
|
|
Booking BookingRepository
|
|
Schedule ScheduleRepository
|
|
Notification NotificationRepository
|
|
}
|
|
|
|
// NewRepositories creates and returns all repository instances
|
|
func NewRepositories(db *gorm.DB) *Repositories {
|
|
return &Repositories{
|
|
User: NewUserRepository(db),
|
|
Booking: NewBookingRepository(db),
|
|
Schedule: NewScheduleRepository(db),
|
|
Notification: NewNotificationRepository(db),
|
|
}
|
|
}
|