create CMS error handling

This commit is contained in:
Mazyar
2026-05-31 02:17:46 +03:30
parent bca94cd69a
commit 31627a1bbe
6 changed files with 199 additions and 33 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ type CMSForm struct {
Key string `json:"key" valid:"required,length(2|100)" example:"SW-001"`
Language string `json:"language" valid:"optional,length(2|100)" example:"en"`
CompanyName string `json:"company_name" valid:"optional,length(2|100)" example:"Opplens"`
Country string `json:"country" valid:"optional,length(3|3)" example:"SWE"`
Country string `json:"country" valid:"optional,length(2|3)" example:"SWE"`
Type CMSType `json:"type" valid:"optional,in(company|organization)" example:"company"`
Hero heroSectionForm `json:"hero" valid:"optional"`
Chart chartSectionForm `json:"chart" valid:"optional"`
@@ -24,7 +24,7 @@ type heroSectionForm struct {
Description string `json:"description" valid:"optional,length(2|1000)" example:"Hero Description"`
ButtonText string `json:"button_text" valid:"optional,length(2|100)" example:"Button Text"`
ButtonLink string `json:"button_link" valid:"optional,url" example:"https://example.com"`
GifFile string `json:"gif_file" valid:"optional,url" example:"https://example.com/gif.gif"`
GifFile string `json:"gif_file" valid:"optional,mediaRef" example:"674abc123def456789012345"`
}
// chartSectionForm represents the form for creating/updating the chart section
@@ -49,7 +49,7 @@ type cardSectionForm struct {
// cardForm represents the form for creating/updating a card
type cardForm struct {
Icon string `json:"icon" valid:"optional,url" example:"https://example.com/icon.png"`
Icon string `json:"icon" valid:"optional,mediaRef" example:"674abc123def456789012345"`
Title string `json:"title" valid:"optional,length(2|100)" example:"Card Title"`
Description string `json:"description" valid:"optional,length(2|1000)" example:"Card Description"`
}
@@ -73,7 +73,7 @@ type formFieldForm struct {
// footerSectionForm represents the form for creating/updating the footer section
type footerSectionForm struct {
Email string `json:"email" valid:"optional,email" example:"info@example.com"`
Phone string `json:"phone" valid:"optional,length(10|20)" example:"+1234567890"`
Phone string `json:"phone" valid:"optional,length(0|30)" example:"+1234567890"`
Location string `json:"location" valid:"optional,length(2|100)" example:"Location"`
Tagline string `json:"tagline" valid:"optional,length(2|100)" example:"Tagline"`
Copyright string `json:"copyright" valid:"optional,length(2|100)" example:"Copyright"`