event

package
v0.0.0-...-3b9bdc6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VenueOnline            string = "ONLINE"
	ShowTypeLive           string = "LIVE"
	ShowTypeHologramLive   string = "HOLOGRAM_LIVE"
	ShowTypeOnline         string = "ONLINE"
	TicketTierOnline       string = "ONLINE"
	TicketTierWood         string = "WOOD"
	TicketTierBronze       string = "BRONZE"
	TicketTierSilver       string = "SILVER"
	TicketTierGold         string = "GOLD"
	TypeOrderRuleRangeDate string = "ORDER_RULE_RANGE_DATE"
)

Variables

This section is empty.

Functions

func InitHTTPHandler

func InitHTTPHandler(router *mux.Router, adminSession *middleware.AdminSession, validate *validator.Validate, eventUsecase EventUseCase)

Types

type Artist

type Artist struct {
	EventID string
	Name    string
}

type ArtistRepository

type ArtistRepository interface {
	FindManyByEventID(ctx context.Context, eventID string, tx *sql.Tx) ([]Artist, error)
	Save(ctx context.Context, a Artist, tx *sql.Tx) error
}

func NewArtistRepository

func NewArtistRepository(logger *logrus.Logger, db *sql.DB) ArtistRepository

type CreateEventRequest

type CreateEventRequest struct {
	Name        string   `json:"name" validate:"required"`
	Description string   `json:"description" validate:"required"`
	Artists     []string `json:"artists" validate:"required,dive,required"`
	Promotors   []struct {
		Name  string `json:"name" validate:"required"`
		Email string `json:"email" validate:"email"`
		Phone string `json:"phone" validate:"required"`
	} `json:"promotors" validate:"required,dive"`
	OnlineTicketPrice           float64             `json:"online_ticket_price" validate:"required"`
	TotalOnlineTicketAllocation int64               `json:"total_online_ticket_allocation" validate:"required"`
	Shows                       []CreateShowRequest `json:"shows" validate:"required,dive,required"`
	ShowTime                    string              `json:"show_time" validate:"datetime=2006-01-02 15:04:05"`
	OrderRuleDay                []int64             `json:"order_rule_day" validate:"omitempty,dive,min=0,max=6"`
	OrderRuleRangeDate          struct {
		StartDate string `json:"start_date" validate:"datetime=2006-01-02 15:04:05"`
		EndDate   string `json:"end_date" validate:"datetime=2006-01-02 15:04:05"`
	} `json:"order_rule_range_date" validate:"required"`
	OrderRuleMaximumTicket int64 `json:"order_rule_maximum_ticket" validate:"-"`
}

func (CreateEventRequest) ToEntityEvent

func (r CreateEventRequest) ToEntityEvent(location *time.Location, now time.Time) (Event, error)

type CreateEventResponse

type CreateEventResponse struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Promotors   []PromotorResponse
	Artists     []string `json:"artists"`
	Shows       []ShowResponse
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func (*CreateEventResponse) PopulateFromEntity

func (r *CreateEventResponse) PopulateFromEntity(e Event)

type CreateLocationRequest

type CreateLocationRequest struct {
	Country          string  `json:"country" validate:"required"`
	City             string  `json:"city" validate:"required"`
	FormattedAddress string  `json:"formatted_address" validate:"formatted_address"`
	Latitude         float64 `json:"latitude" validate:"required"`
	Longitude        float64 `json:"longitude" validate:"required"`
}

type CreateShowRequest

type CreateShowRequest struct {
	Venue                 string                   `json:"venue" validate:"required"`
	Type                  string                   `json:"type" validate:"oneof=LIVE HOLOGRAM_LIVE"`
	Online                bool                     `json:"online" validate:"-"`
	Location              *CreateLocationRequest   `json:"location" validate:"-"`
	TotalTicketAllocation int64                    `json:"total_ticket_allocation"`
	TicketAllocation      []CreateTicketAllocation `json:"ticket_allocation" validate:"required,dive"`
}

type CreateTicketAllocation

type CreateTicketAllocation struct {
	Tier                   string  `json:"tier" validate:"oneof=WOOD BRONZE SILVER GOLD"`
	AllocationByPercentage float64 `json:"allocation_by_percentage" validate:"required"`
	Price                  float64 `json:"price" validate:"required"`
}

type Event

type Event struct {
	ID          string
	Name        string
	Promotors   []Promotor
	Artists     []Artist
	Shows       []Show
	Description string
	Status      string
	OrderRules  OrderRuleAggregation
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type EventRepository

type EventRepository interface {
	BeginTx(ctx context.Context) (*sql.Tx, error)
	CommitTx(ctx context.Context, tx *sql.Tx) error
	Rollback(ctx context.Context, tx *sql.Tx) error

	Save(ctx context.Context, e Event, tx *sql.Tx) error
	FindByID(ctx context.Context, ID string, tx *sql.Tx) (Event, error)
	Update(ctx context.Context, ID string, update Event, tx *sql.DB) error
}

func NewEventRepository

func NewEventRepository(logger *logrus.Logger, db *sql.DB) EventRepository

type EventUseCase

type EventUseCase interface {
	CreateEvent(ctx context.Context, req CreateEventRequest) (interface{}, error)
}

func NewEventUseCase

func NewEventUseCase(props EventUseCaseProperty) EventUseCase

type EventUseCaseProperty

type EventUseCaseProperty struct {
	Logger                       *logrus.Logger
	Location                     *time.Location
	Timeout                      time.Duration
	EventRepository              EventRepository
	ArtistRepository             ArtistRepository
	PromotorRepository           PromotorRepository
	ShowRepository               ShowRepository
	LocationRepository           LocationRepository
	OrderRuleDayRepository       order.OrderRuleDayRepository
	OrderRuleRangeDateRepository order.OrderRuleRangeDateRepository
	TicketStockRepository        ticket.TicketStockRepository
}

type HTTPHandler

type HTTPHandler struct {
	SessionMiddleware *middleware.AdminSession
	Validate          *validator.Validate
	EventUseCase      EventUseCase
}

func (HTTPHandler) CreateEvent

func (handler HTTPHandler) CreateEvent(w http.ResponseWriter, r *http.Request)

type Location

type Location struct {
	EventID          string
	ShowID           string
	Country          string
	City             string
	FormattedAddress string
	Latitude         float64
	Longitude        float64
}

type LocationRepository

type LocationRepository interface {
	FindByShowID(ctx context.Context, showID string, tx *sql.Tx) (Location, error)
	Save(ctx context.Context, l Location, tx *sql.Tx) error
}

func NewLocationRepository

func NewLocationRepository(logger *logrus.Logger, db *sql.DB) LocationRepository

type LocationResponse

type LocationResponse struct {
	Country          string  `json:"country"`
	City             string  `json:"city"`
	FormattedAddress string  `json:"formatted_address"`
	Latitude         float64 `json:"latitude"`
	Longitude        float64 `json:"longitude"`
}

type OrderRuleAggregation

type OrderRuleAggregation struct {
	OrderRuleRangeDate order.OrderRuleRangeDate
	OrderRuleDay       []order.OrderRuleDay
}

type OrderRuleDay

type OrderRuleDay struct {
	EventID string
	Day     int64
}

type OrderRuleMaximumTicket

type OrderRuleMaximumTicket struct {
	EventID string
	Maximum int64
}

type OrderRuleRangeDate

type OrderRuleRangeDate struct {
	EventID   string
	StartDate time.Time
	EndDate   time.Time
}

type Promotor

type Promotor struct {
	EventID string
	Name    string
	Email   string
	Phone   string
}

type PromotorRepository

type PromotorRepository interface {
	FindManyByEventID(ctx context.Context, eventID string, tx *sql.Tx) ([]Promotor, error)
	Save(ctx context.Context, p Promotor, tx *sql.Tx) error
}

func NewPromotorRepository

func NewPromotorRepository(logger *logrus.Logger, db *sql.DB) PromotorRepository

type PromotorResponse

type PromotorResponse struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Phone string `json:"phone"`
}

type Show

type Show struct {
	EventID     string
	ID          string
	Venue       string
	Type        string
	TicketStock []ticket.TicketStock
	Location    *Location
	Time        time.Time
	Status      string
}

type ShowRepository

type ShowRepository interface {
	Save(ctx context.Context, s Show, tx *sql.Tx) error
	FindByID(ctx context.Context, ID string, tx *sql.Tx) (Show, error)
	FindManyByEventID(ctx context.Context, eventID string, tx *sql.Tx) ([]Show, error)
	Update(ctx context.Context, ID string, s Show, tx *sql.Tx) error
}

func NewShowRepository

func NewShowRepository(logger *logrus.Logger, db *sql.DB) ShowRepository

type ShowResponse

type ShowResponse struct {
	ID       string            `json:"id"`
	Venue    string            `json:"venue"`
	Type     string            `json:"type"`
	Location *LocationResponse `json:"location"`
	Time     time.Time         `json:"time"`
	Status   string            `json:"status"`
}

Jump to

Keyboard shortcuts

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