feat(advertising): implement advertising service with CRUD operations and validation

- Added advertising.go for managing advertising entries with Create and List functionalities.
- Implemented CreateAdvertisingParams with validation for name, email, and status.
- Created migrations for advertising table structure.
- Added tests for advertising parameters validation.

feat(promo): introduce promo management with validation and CRUD operations

- Added promo.go for managing promotional entries with Create, Update, and List functionalities.
- Implemented CreatePromoParams and UpdatePromoParams with validation for position, section, and weeks.
- Created migrations for promo table structure.
- Added tests for promo parameters validation.

feat(images): add image management service with upload and retrieval

- Added images.go for managing image uploads and retrieval from storage.
- Implemented SaveImageParams with validation for image description and data.
- Created migrations for images table structure.
- Added tests for image parameters validation and data parsing.
This commit is contained in:
fabio
2026-10-01 20:19:07 +02:00
parent 0fe1bc2292
commit 664db8f7a0
17 changed files with 1299 additions and 1382 deletions

View File

@@ -2,104 +2,34 @@ package extrahome
import "time"
type SiteConfig struct {
ExtraSite ExtraSite
StartAt time.Time
Description string
type Head struct {
Title string
Meta []HeadMeta
Links []HeadLink
Langs []HeadLang
Scripts []HeadScript
}
type HeadMeta struct {
Name string
Content string
}
type HeadLink struct {
Rel string
Href string
}
type HeadScript struct {
Defer string
DataDomain string
Src string
}
type HeadLang struct {
Rel string
Hreflang string
Href string
}
type ExtraSite struct {
NavItems []NavItem
HomePageData HomePageData
BroadcasterPageData BroadcasterPageData
ContactPageData ContactPageData
Carusel Carusel
}
type NavItem struct {
Label string
Color string
URL string
}
type HomePageData struct {
Title string
Lang string
HeroTitle string
Profiles []Profile
Promo Promo
ListOfBroadcasters ListOfBroadcaster
Carusel Carusel
Year int
}
type BroadcasterPageData struct {
Title string
Lang string
Year int
PromoRight1 Promo
PromoRight2 Promo
Profile BroadcasterProfile
}
type ContactPageData struct {
Title string
Lang string
HeroTitle string
Email string
Phone string
Address string
Hours string
Message string
Year int
}
type Carusel struct {
Items []CaruselItem
}
type CaruselItem struct {
Title string
Description string
ImageURL string
URL string
}
type Promo struct {
Left PromoItem
Right1 PromoItem
Right2 PromoItem
}
type PromoItem struct {
Title string
Description string
Content []PromoContent
}
type PromoContent struct {
Width int
Height int
MobileOnly bool
MobileImageURL string
NewWindow bool
Title string
Description string
ImageURL string
URL string
}
type ListOfBroadcaster struct {
Title string
Items []ListOfBroadcasterItem
}
type ListOfBroadcasterItem struct {
Title string
Category string
Description string
ImageURL string
URL string
type SiteLangs map[string][]struct {
Name string
}
type Profile struct {
@@ -141,3 +71,99 @@ type BroadcasterProfile struct {
Languages []string
Services []string
}
type ListOfBroadcaster struct {
Title string
Broadcasters []int64
}
type Carusel struct {
Items []CaruselItem
}
type CaruselItem struct {
Title string
Description string
ImageURL string
URL string
}
const (
PromoLeft = iota
PromoRight1
PromoRight2
)
type Promo struct {
ID int64
Position int // Promo position: PromoLeft, PromoRight1, PromoRight2
Item []PromoItem
ActiveFrom time.Time
}
type PromoItem struct {
Title string
Content []PromoContent
}
type PromoContent struct {
Width int
Height int
MobileOnly bool
MobileImageURL string
NewWindow bool
ImageURL string
URL string
}
type NavItem struct {
Label string
Color string
URL string
}
type HomePageData struct {
Title string
SiteLangs SiteLangs
PromoLeft Promo // Promo position: PromoLeft id
PromoRight1 Promo // Promo position: PromoRight1 id
PromoRight2 Promo // Promo position: PromoRight2 id
ListOfBroadcasters ListOfBroadcaster
Carusel Carusel
Year int
}
type SiteConfig struct {
ExtraSite ExtraSite
StartAt time.Time
Description string
}
type ExtraSite struct {
NavItems []NavItem
HomePageData HomePageData
BroadcasterPageData BroadcasterPageData
ContactPageData ContactPageData
Carusel Carusel
}
type BroadcasterPageData struct {
Title string
Lang string
Year int
PromoRight1 Promo
PromoRight2 Promo
Profile BroadcasterProfile
}
type ContactPageData struct {
Title string
Lang string
HeroTitle string
Email string
Phone string
Address string
Hours string
Message string
Year int
}