package users import ( "strings" "time" ) type DataNewsDTO struct { News []NewsDTO `json:"news"` Count int `json:"count"` } type NewsDTO struct { Id int `json:"id"` Title string `json:"title"` Content string `json:"content,omitempty"` Image string `json:"imagePath"` DataRelease time.Time `json:"dateRelease,omitzero"` } // Language is used when scanning multilingual JSON from the database. type Language struct { En string `json:"en,omitempty"` Ru string `json:"ru,omitempty"` Tm string `json:"tm,omitempty"` } func NormalizeLang(lang string) string { switch strings.ToLower(strings.TrimSpace(lang)) { case "ru", "en", "tm": return strings.ToLower(strings.TrimSpace(lang)) default: return "tm" } } func (l Language) Pick(lang string) string { switch NormalizeLang(lang) { case "ru": if l.Ru != "" { return l.Ru } case "en": if l.En != "" { return l.En } } if l.Tm != "" { return l.Tm } if l.Ru != "" { return l.Ru } return l.En } func PickContent(lang, tm, ru, en string) string { switch NormalizeLang(lang) { case "ru": if ru != "" { return ru } case "en": if en != "" { return en } } if tm != "" { return tm } if ru != "" { return ru } return en } type CategoryDTO struct { Id int `json:"id"` Name string `json:"name"` Image string `json:"imagePath,omitempty"` SubCategories []SubCategoryDTO `json:"subCategories"` } type SubCategoryDTO struct { Id int `json:"id"` CategoryId int `json:"categoryId"` Name string `json:"name"` Content string `json:"content,omitempty"` Count int `json:"count,omitempty"` } type DataBannerDTO struct { Banners []BannerListItemDTO `json:"banners"` Count int `json:"count"` } type DataMiniSliderDTO struct { MiniSliders []MiniSliderDTO `json:"miniSliders"` Count int `json:"count"` } type MiniSliderDTO struct { Id int `json:"id"` Title string `json:"title"` Image string `json:"imagePath"` } type BannerListItemDTO struct { Id int `json:"id"` Image string `json:"imagePath"` } type BannerDTO struct { Id int `json:"id"` Title string `json:"title"` Content string `json:"content,omitempty"` Image string `json:"imagePath"` CreatedAt time.Time `json:"createdAt,omitzero"` } type DataStaticDTO struct { Statics []StaticDTO `json:"statics"` Count int `json:"count"` } type StaticDTO struct { Id int `json:"id"` Logo string `json:"logo"` Title string `json:"title"` Content string `json:"content,omitempty"` CreatedAt time.Time `json:"createdAt,omitzero"` } type CurrencyDTO struct { Id int `json:"id"` Title string `json:"title"` Content string `json:"content,omitempty"` Path string `json:"path,omitempty"` CreatedAt time.Time `json:"createdAt,omitzero"` } type SettingDTO struct { UUID string `json:"UUID,omitempty"` LogoR string `json:"logoR"` PhoneNumber string `json:"phoneNumber"` FaxNumber string `json:"faxNumber"` HelpNumber string `json:"helpNumber"` CreatedAt time.Time `json:"createdAt,omitzero"` }