domain

package
v0.0.0-...-c87371f Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Booking

type Booking struct {
	// Persistence ID
	ID int64
	// Business ID
	BookingID  string
	CampsiteID string
	Email      string
	FullName   string
	StartDate  time.Time
	EndDate    time.Time
	Active     bool
}

func (*Booking) BookingDates

func (b *Booking) BookingDates() []time.Time

type BookingRepository

type BookingRepository interface {
	Find(ctx context.Context, bookingID string) (*Booking, error)
	FindForDateRange(ctx context.Context, campsiteID string, startDate time.Time, endDate time.Time) ([]*Booking, error)
	Insert(ctx context.Context, booking *Booking) error
	Update(ctx context.Context, booking *Booking) error
}

type Campsite

type Campsite struct {
	// Persistence ID
	ID int64
	// Business ID
	CampsiteID    string
	CampsiteCode  string
	Capacity      int32
	DrinkingWater bool
	Restrooms     bool
	PicnicTable   bool
	FirePit       bool
	Active        bool
}

type CampsiteRepository

type CampsiteRepository interface {
	FindAll(ctx context.Context) ([]*Campsite, error)
	Insert(ctx context.Context, campsite *Campsite) error
}

type ErrBookingAlreadyCancelled

type ErrBookingAlreadyCancelled struct {
	BookingID string
}

func (ErrBookingAlreadyCancelled) Error

type ErrBookingDatesNotAvailable

type ErrBookingDatesNotAvailable struct {
	StartDate time.Time
	EndDate   time.Time
}

func (ErrBookingDatesNotAvailable) Error

type ErrBookingNotFound

type ErrBookingNotFound struct {
	BookingID string
}

func (ErrBookingNotFound) Error

func (e ErrBookingNotFound) Error() string

type MockBookingRepository

type MockBookingRepository struct {
	mock.Mock
}

MockBookingRepository is an autogenerated mock type for the BookingRepository type

func NewMockBookingRepository

func NewMockBookingRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockBookingRepository

NewMockBookingRepository creates a new instance of MockBookingRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockBookingRepository) Find

func (_m *MockBookingRepository) Find(ctx context.Context, bookingID string) (*Booking, error)

Find provides a mock function with given fields: ctx, bookingID

func (*MockBookingRepository) FindForDateRange

func (_m *MockBookingRepository) FindForDateRange(ctx context.Context, campsiteID string, startDate time.Time, endDate time.Time) ([]*Booking, error)

FindForDateRange provides a mock function with given fields: ctx, campsiteID, startDate, endDate

func (*MockBookingRepository) Insert

func (_m *MockBookingRepository) Insert(ctx context.Context, booking *Booking) error

Insert provides a mock function with given fields: ctx, booking

func (*MockBookingRepository) Update

func (_m *MockBookingRepository) Update(ctx context.Context, booking *Booking) error

Update provides a mock function with given fields: ctx, booking

type MockCampsiteRepository

type MockCampsiteRepository struct {
	mock.Mock
}

MockCampsiteRepository is an autogenerated mock type for the CampsiteRepository type

func NewMockCampsiteRepository

func NewMockCampsiteRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCampsiteRepository

NewMockCampsiteRepository creates a new instance of MockCampsiteRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCampsiteRepository) FindAll

func (_m *MockCampsiteRepository) FindAll(ctx context.Context) ([]*Campsite, error)

FindAll provides a mock function with given fields: ctx

func (*MockCampsiteRepository) Insert

func (_m *MockCampsiteRepository) Insert(ctx context.Context, campsite *Campsite) error

Insert provides a mock function with given fields: ctx, campsite

Jump to

Keyboard shortcuts

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