entities

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeError   = "danger"
	MessageTypeSuccess = "success"
)
View Source
const TimeFormatDate = "2006-01-02"

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseData

type BaseData struct {
	Title      string
	ParentPath string
	Messages   []Message
}

func (*BaseData) AddMessage

func (b *BaseData) AddMessage(messageType MessageType, messageFormat string, args ...any)

AddMessage appends a single message to the slice of messages. Message format and arguments are passed to fmt.Sprintf.

func (*BaseData) SetMessages

func (b *BaseData) SetMessages(messages []Message)

SetMessages replaces the current slice of messages

type CategoriesFormTemplate

type CategoriesFormTemplate struct {
	BaseData
	IsNew    bool
	Category Category
}

func (CategoriesFormTemplate) GetTemplateName

func (t CategoriesFormTemplate) GetTemplateName() string

type CategoriesListTemplate

type CategoriesListTemplate struct {
	BaseData
	Categories []*entities.Category
}

func (CategoriesListTemplate) GetTemplateName

func (t CategoriesListTemplate) GetTemplateName() string

type Category

type Category struct {
	Name        string `form:"name"`
	Description string `form:"description"`
}

func CategoryFromEntity

func CategoryFromEntity(e *entities.Category) Category

func (Category) ToEntity

func (e Category) ToEntity() entities.Category

type Content

type Content struct {
	BodySimple string        `form:"body"`
	BodyHTML   template.HTML `form:"body"`
}

type ContentFormTemplate

type ContentFormTemplate struct {
	BaseData
	ContentName   string
	IsHTMLContent bool
	Content       Content
}

func (ContentFormTemplate) GetTemplateName

func (t ContentFormTemplate) GetTemplateName() string

type ContentListTemplate

type ContentListTemplate struct {
	BaseData
	Content []*entities.Content
}

func (ContentListTemplate) GetTemplateName

func (t ContentListTemplate) GetTemplateName() string

type Event

type Event struct {
	Name  string `form:"name"`
	Start string `form:"start"`
	End   string `form:"end"`
}

func EventFromEntity

func EventFromEntity(e *entities.Event) Event

func (Event) ToEntity

func (e Event) ToEntity() (entities.Event, error)

type EventsFormTemplate

type EventsFormTemplate struct {
	BaseData
	IsNew bool
	Event Event
}

func (EventsFormTemplate) GetTemplateName

func (t EventsFormTemplate) GetTemplateName() string

type EventsListTemplate

type EventsListTemplate struct {
	BaseData
	Events         []*entities.Event
	ShowPastEvents bool
}

func (EventsListTemplate) GetTemplateName

func (t EventsListTemplate) GetTemplateName() string

type LoginFailedTemplate

type LoginFailedTemplate struct {
	BaseData
	Reason string
}

func (LoginFailedTemplate) GetTemplateName

func (t LoginFailedTemplate) GetTemplateName() string

type LogoutSuccessfulTemplate

type LogoutSuccessfulTemplate struct {
	BaseData
}

func (LogoutSuccessfulTemplate) GetTemplateName

func (t LogoutSuccessfulTemplate) GetTemplateName() string

type Manufacturer

type Manufacturer struct {
	Name       string `form:"name"`
	WebsiteURL string `form:"website_url"`
}

func ManufacturerFromEntity

func ManufacturerFromEntity(e *entities.Manufacturer) Manufacturer

func (Manufacturer) ToEntity

func (e Manufacturer) ToEntity() entities.Manufacturer

type ManufacturersFormTemplate

type ManufacturersFormTemplate struct {
	BaseData
	IsNew        bool
	Manufacturer Manufacturer
}

func (ManufacturersFormTemplate) GetTemplateName

func (t ManufacturersFormTemplate) GetTemplateName() string

type ManufacturersImageTemplate

type ManufacturersImageTemplate struct {
	BaseData
	Manufacturer entities.Manufacturer
}

func (ManufacturersImageTemplate) GetTemplateName

func (t ManufacturersImageTemplate) GetTemplateName() string

type ManufacturersListTemplate

type ManufacturersListTemplate struct {
	BaseData
	Manufacturers []*entities.Manufacturer
}

func (ManufacturersListTemplate) GetTemplateName

func (t ManufacturersListTemplate) GetTemplateName() string

type Message

type Message struct {
	Type    MessageType
	Content string
}

func ParseMessage

func ParseMessage(input string) Message

func (Message) String

func (m Message) String() string

type MessageType

type MessageType string

Flash types based on https://getbootstrap.com/docs/5.1/components/alerts/

type Product

type Product struct {
	Name             string   `form:"name"`
	Price            string   `form:"price"`
	ManufacturerID   string   `form:"manufacturer_id"`
	CategoryIDs      []string `form:"category_ids"`
	StockCount       int      `form:"stock_count"`
	DescriptionShort string   `form:"description_short"`
	DescriptionLong  string   `form:"description_long"`
}

func ProductFromEntity

func ProductFromEntity(e *entities.ResolvedProduct) Product

func (Product) HasCategoryID

func (e Product) HasCategoryID(categoryID string) bool

func (Product) ToEntity

func (e Product) ToEntity() (entities.Product, error)

type ProductsFormTemplate

type ProductsFormTemplate struct {
	BaseData
	IsNew                bool
	ShortDescriptionOnly bool
	Product              Product
	Categories           []*entities.Category
	Manufacturers        []*entities.Manufacturer
}

func (ProductsFormTemplate) GetTemplateName

func (t ProductsFormTemplate) GetTemplateName() string

type ProductsImagesTemplate

type ProductsImagesTemplate struct {
	BaseData
	Product entities.Product
}

func (ProductsImagesTemplate) GetTemplateName

func (t ProductsImagesTemplate) GetTemplateName() string

type ProductsListTemplate

type ProductsListTemplate struct {
	BaseData
	Products         []*entities.Product
	ManufacturersMap map[entities.ID]entities.Manufacturer
	PublicURLMap     map[entities.ID]string
}

func (ProductsListTemplate) GetTemplateName

func (t ProductsListTemplate) GetTemplateName() string

type Service added in v1.1.0

type Service struct {
	Name              string `form:"name"`
	Description       string `form:"description"`
	Price             string `form:"price"`
	ServiceCategoryID string `form:"service_category_id"`
}

func ServiceFromEntity added in v1.1.0

func ServiceFromEntity(e *entities.Service) Service

func (Service) ToEntity added in v1.1.0

func (e Service) ToEntity() (entities.Service, error)

type ServiceCategoriesFormTemplate added in v1.1.0

type ServiceCategoriesFormTemplate struct {
	BaseData
	IsNew           bool
	ServiceCategory ServiceCategory
}

func (ServiceCategoriesFormTemplate) GetTemplateName added in v1.1.0

func (t ServiceCategoriesFormTemplate) GetTemplateName() string

type ServiceCategoriesListTemplate added in v1.1.0

type ServiceCategoriesListTemplate struct {
	BaseData
	ServiceCategories []*entities.ServiceCategory
}

func (ServiceCategoriesListTemplate) GetTemplateName added in v1.1.0

func (t ServiceCategoriesListTemplate) GetTemplateName() string

type ServiceCategory added in v1.1.0

type ServiceCategory struct {
	Name string `form:"name"`
}

func ServiceCategoryFromEntity added in v1.1.0

func ServiceCategoryFromEntity(e *entities.ServiceCategory) ServiceCategory

func (ServiceCategory) ToEntity added in v1.1.0

type ServicesFormTemplate added in v1.1.0

type ServicesFormTemplate struct {
	BaseData
	IsNew             bool
	Service           Service
	ServiceCategories []*entities.ServiceCategory
}

func (ServicesFormTemplate) GetTemplateName added in v1.1.0

func (t ServicesFormTemplate) GetTemplateName() string

type ServicesListTemplate added in v1.1.0

type ServicesListTemplate struct {
	BaseData
	Services        []*entities.Service
	ServiceCategory *entities.ServiceCategory
}

func (ServicesListTemplate) GetTemplateName added in v1.1.0

func (t ServicesListTemplate) GetTemplateName() string

type Template

type Template interface {
	GetTemplateName() string
	SetMessages(messages []Message)
}

Template represents a single HTML page template

Jump to

Keyboard shortcuts

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