Update CMS Entity and Forms to Include New Fields

- Added new fields to the CMS entity: CompanyName, Country, and Language, enhancing the data structure for better content management.
- Updated the CMSForm to include validation and examples for the new fields, ensuring proper input handling.
- Modified the copyFormToEntity method in the CMS service to map the new fields from the form to the entity, maintaining data integrity.
- Enhanced Swagger documentation to reflect the changes in the CMS API, providing clear examples for the new fields.
This commit is contained in:
Nima Nakhostin
2025-11-09 09:24:23 +03:30
parent 7fc6568d02
commit 9fe86d4f8e
6 changed files with 64 additions and 16 deletions
+11 -8
View File
@@ -4,14 +4,17 @@ import "tm/pkg/response"
// CMSForm represents the form for creating/updating the CMS
type CMSForm struct {
Key string `json:"key" valid:"required,length(2|100)" example:"SW-001"`
Hero heroSectionForm `json:"hero" valid:"optional"`
Chart chartSectionForm `json:"chart" valid:"optional"`
Features cardSectionForm `json:"features" valid:"optional"`
Challenges cardSectionForm `json:"challenges" valid:"optional"`
Advantages cardSectionForm `json:"advantages" valid:"optional"`
Contact contactSectionForm `json:"contact" valid:"optional"`
Footer footerSectionForm `json:"footer" valid:"optional"`
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)" example:"SWE"`
Hero heroSectionForm `json:"hero" valid:"optional"`
Chart chartSectionForm `json:"chart" valid:"optional"`
Features cardSectionForm `json:"features" valid:"optional"`
Challenges cardSectionForm `json:"challenges" valid:"optional"`
Advantages cardSectionForm `json:"advantages" valid:"optional"`
Contact contactSectionForm `json:"contact" valid:"optional"`
Footer footerSectionForm `json:"footer" valid:"optional"`
}
// heroSectionForm represents the form for creating/updating the hero section