Enhance CMS Entity and Forms with Type Field
- Added a new Type field to the CMS entity to differentiate between Company and Organization types, improving data categorization. - Updated the CMSForm to include validation for the Type field, ensuring proper input handling. - Modified the ToResponse method to include the Type field in the CMSResponse, enhancing the API response structure. - Adjusted the copyFormToEntity method in the CMS service to handle the new Type field, maintaining data integrity based on the selected type. - Enhanced Swagger documentation to reflect the changes in the CMS API, providing clear examples for the new Type field.
This commit is contained in:
@@ -13,6 +13,7 @@ type CMS struct {
|
||||
Language string `bson:"language"`
|
||||
CompanyName string `bson:"company_name"`
|
||||
Country string `bson:"country"`
|
||||
Type CMSType `bson:"type"`
|
||||
Hero heroSection `bson:"hero"`
|
||||
Chart chartSection `bson:"chart"`
|
||||
Features cardSection `bson:"features"`
|
||||
@@ -22,6 +23,13 @@ type CMS struct {
|
||||
Footer footerSection `bson:"footer"`
|
||||
}
|
||||
|
||||
type CMSType string
|
||||
|
||||
const (
|
||||
CMSTypeCompany CMSType = "company"
|
||||
CMSTypeOrganization CMSType = "organization"
|
||||
)
|
||||
|
||||
// SetID sets the CMS ID (implements IDSetter interface)
|
||||
func (c *CMS) SetID(id string) {
|
||||
c.ID, _ = bson.ObjectIDFromHex(id)
|
||||
|
||||
Reference in New Issue
Block a user