Documentation
¶
Index ¶
- func Handler(svc BookingService, logger *slog.Logger) http.Handler
- type Booking
- type BookingService
- type ID
- type ListFilter
- func (f ListFilter) ByBookingID(bookings ID) ListFilter
- func (f ListFilter) ByEndTime(t time.Time) ListFilter
- func (f ListFilter) ByStartTime(t time.Time) ListFilter
- func (f ListFilter) ByState(state State) ListFilter
- func (f ListFilter) ByStudentID(id students.ID) ListFilter
- func (f ListFilter) ByTeacherID(id users.ID) ListFilter
- func (f ListFilter) Where() (string, []any)
- type Repo
- func (r *Repo) Add(ctx context.Context, booking Booking) error
- func (r *Repo) BookingStates() []State
- func (r *Repo) CountByState(ctx context.Context, f ListFilter) (map[string]map[State]int, error)
- func (r *Repo) LastBooking(ctx context.Context, teacherID users.ID, studentID students.ID) (ID, time.Time, time.Time, error)
- func (r *Repo) List(ctx context.Context, f ListFilter) ([]Booking, error)
- func (r *Repo) Reschedule(ctx context.Context, bookingID ID, startTime time.Time, endTime time.Time) error
- func (r *Repo) SetState(ctx context.Context, bookingID ID, state State) error
- func (r *Repo) SetStateByFilter(ctx context.Context, f ListFilter, state State) error
- type Service
- func (s Service) AddBookings(ctx context.Context, teacherID users.ID, studentID students.ID, ...) error
- func (s Service) MarkDayDone(ctx context.Context, teacherID users.ID, date time.Time) error
- func (s Service) RescheduleBooking(ctx context.Context, id ID, teacherID users.ID, studentID students.ID) error
- func (s Service) ReschedulePostponedBookings(ctx context.Context) (int, error)
- func (s Service) ReschedulePostponedDayBookings(ctx context.Context, teacherID users.ID, date time.Time) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BookingService ¶
type BookingService interface {
List(context.Context, ListFilter) ([]Booking, error)
AddBookings(ctx context.Context, teacherID users.ID, studentID students.ID, startTime, endTime time.Time, count int) error
Reschedule(ctx context.Context, id ID, startTime, endTime time.Time) error
SetState(ctx context.Context, id ID, state State) error
MarkDayDone(ctx context.Context, teacherID users.ID, date time.Time) error
ReschedulePostponedDayBookings(ctx context.Context, teacherID users.ID, date time.Time) error
}
type ListFilter ¶ added in v0.3.0
type ListFilter struct {
// contains filtered or unexported fields
}
func (ListFilter) ByBookingID ¶ added in v0.3.0
func (f ListFilter) ByBookingID(bookings ID) ListFilter
func (ListFilter) ByEndTime ¶ added in v0.3.0
func (f ListFilter) ByEndTime(t time.Time) ListFilter
func (ListFilter) ByStartTime ¶ added in v0.3.0
func (f ListFilter) ByStartTime(t time.Time) ListFilter
func (ListFilter) ByState ¶ added in v0.3.0
func (f ListFilter) ByState(state State) ListFilter
func (ListFilter) ByStudentID ¶ added in v0.3.0
func (f ListFilter) ByStudentID(id students.ID) ListFilter
func (ListFilter) ByTeacherID ¶ added in v0.3.0
func (f ListFilter) ByTeacherID(id users.ID) ListFilter
func (ListFilter) Where ¶ added in v0.3.0
func (f ListFilter) Where() (string, []any)
type Repo ¶
func (*Repo) BookingStates ¶
func (*Repo) CountByState ¶ added in v0.2.0
func (*Repo) LastBooking ¶ added in v0.2.0
func (*Repo) Reschedule ¶ added in v0.3.0
func (*Repo) SetStateByFilter ¶ added in v0.3.0
type Service ¶
type Service struct {
Repo
}
func (Service) AddBookings ¶
func (Service) MarkDayDone ¶ added in v0.3.0
func (Service) RescheduleBooking ¶ added in v0.3.0
func (Service) ReschedulePostponedBookings ¶
Click to show internal directories.
Click to hide internal directories.