appointment

package
v0.0.0-...-1e59c39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2022 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Appointment

type Appointment struct {
	ID        int64             `json:"id"`
	TrainerID int64             `json:"trainer_id"`
	UserID    *int64            `json:"user_id"`
	StartsAt  time.Time         `json:"starts_at"`
	EndsAt    time.Time         `json:"ends_at"`
	Status    AppointmentStatus `json:"appointment_status"`
}

Appointment holds relevant appointment information

type AppointmentStatus

type AppointmentStatus string
const (
	Open        AppointmentStatus = "OPEN"
	Booked      AppointmentStatus = "BOOKED"
	Unavailable AppointmentStatus = "UNAVAILABLE"
)

type Option

type Option func(*repository)

func WithConnectionPool

func WithConnectionPool(dbPool *pgxpool.Pool) Option

func WithLocation

func WithLocation(tz string) Option

type Repository

type Repository interface {
	GetAppointmentsByTrainerAndDates(ctx context.Context, trainerID int64, startsAt, endsAt time.Time) ([]Appointment, error)
	GetBookedAppointments(ctx context.Context, trainerID int64) ([]Appointment, error)
	UpdateAppointment(ctx context.Context, apptRequest Request) error
}

func NewRepository

func NewRepository(opts ...Option) Repository

type Request

type Request struct {
	AppointmentID int64 `json:"id"`
	UserID        int64 `json:"user_id"`
}

Request represents a minimal body for booking an appointmeent. Only the appointmentI ID and UserID are needed to attempt a booking.

type Service

type Service interface {
	GetAppointmentsByTrainerAndDates(ctx context.Context, trainerID int64, startsAt, endsAt time.Time) ([]Appointment, error)
	GetBookedAppointments(ctx context.Context, trainerID int64) ([]Appointment, error)
	UpdateAppointment(ctx context.Context, apptRequest Request) error
}

func NewService

func NewService(repo Repository) Service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL