advert

package
v0.0.0-...-5fdd26c Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContactEmptyErr     = errors.New("contact is empty")
	NoUserProvidedErr   = errors.New("no user provided")
	MissingBasicInfoErr = errors.New("advert is missing basic info")
	InvalidLanguages    = errors.New("not enough valid languages provided")
)
View Source
var (
	AdvertAlreadyExists = errors.New("advert already exists in repository")
	AdvertNotFound      = errors.New("advert not found in repository")
)

Functions

func Assert

func Assert(t *testing.T, expected *Advert, actual *Advert)

Types

type Advert struct {
	ID          uuid.UUID
	Details     domain.AdvertDetails
	User        *user.User
	CreatedAt   time.Time
	UpdatedAt   *time.Time
	DestroyedAt *time.Time
}

func NewAdvert

func NewAdvert(user *user.User, title MultilingualString, description MultilingualString, advertType domain.AdvertType, opts ...AdvertOption) (*Advert, error)

type AdvertLog

type AdvertLog struct {
	AdvertID uuid.UUID
	Trigger  AdvertLogTrigger
	Meta     json.RawMessage
}

type AdvertLogTrigger

type AdvertLogTrigger string
const (
	AdvertCreatedEvent AdvertLogTrigger = "created"
	AdvertUpdatedEvent AdvertLogTrigger = "updated"
	AdvertDeletedEvent AdvertLogTrigger = "deleted"
)

type AdvertOption

type AdvertOption func(advert *Advert) error

func WithContactDetails

func WithContactDetails(contactDetails domain.ContactDetails) AdvertOption

type Repository

type Repository interface {
	Get(ctx context.Context, id uuid.UUID) (Advert, error)
	Add(ctx context.Context, advert *Advert) error
	Delete(ctx context.Context, id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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