Enhance CMS Entity with JSON Tags
- Added JSON tags to all fields in the CMS entity and its related sections (heroSection, chartSection, cardSection, contactSection, footerSection) to ensure proper serialization and deserialization in API responses. - This change improves the API's usability by providing clear JSON representations of the CMS data structure.
This commit is contained in:
+37
-37
@@ -9,18 +9,18 @@ import (
|
|||||||
// CMS represents the content management system for the landing page
|
// CMS represents the content management system for the landing page
|
||||||
type CMS struct {
|
type CMS struct {
|
||||||
mongo.Model `bson:",inline"`
|
mongo.Model `bson:",inline"`
|
||||||
Key string `bson:"key"`
|
Key string `bson:"key" json:"key"`
|
||||||
Language string `bson:"language"`
|
Language string `bson:"language" json:"language"`
|
||||||
CompanyName string `bson:"company_name"`
|
CompanyName string `bson:"company_name" json:"company_name"`
|
||||||
Country string `bson:"country"`
|
Country string `bson:"country" json:"country"`
|
||||||
Type CMSType `bson:"type"`
|
Type CMSType `bson:"type" json:"type"`
|
||||||
Hero heroSection `bson:"hero"`
|
Hero heroSection `bson:"hero" json:"hero"`
|
||||||
Chart chartSection `bson:"chart"`
|
Chart chartSection `bson:"chart" json:"chart"`
|
||||||
Features cardSection `bson:"features"`
|
Features cardSection `bson:"features" json:"features"`
|
||||||
Challenges cardSection `bson:"challenges"`
|
Challenges cardSection `bson:"challenges" json:"challenges"`
|
||||||
Advantages cardSection `bson:"advantages"`
|
Advantages cardSection `bson:"advantages" json:"advantages"`
|
||||||
Contact contactSection `bson:"contact"`
|
Contact contactSection `bson:"contact" json:"contact"`
|
||||||
Footer footerSection `bson:"footer"`
|
Footer footerSection `bson:"footer" json:"footer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CMSType string
|
type CMSType string
|
||||||
@@ -62,17 +62,17 @@ func (c *CMS) GetUpdatedAt() int64 {
|
|||||||
|
|
||||||
// heroSection represents the hero section of the landing page
|
// heroSection represents the hero section of the landing page
|
||||||
type heroSection struct {
|
type heroSection struct {
|
||||||
Title string `bson:"title"`
|
Title string `bson:"title" json:"title"`
|
||||||
Description string `bson:"description"`
|
Description string `bson:"description" json:"description"`
|
||||||
ButtonText string `bson:"button_text"`
|
ButtonText string `bson:"button_text" json:"button_text"`
|
||||||
ButtonLink string `bson:"button_link"`
|
ButtonLink string `bson:"button_link" json:"button_link"`
|
||||||
GifFile string `bson:"gif_file"`
|
GifFile string `bson:"gif_file" json:"gif_file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// chartSection represents the chart section of the landing page
|
// chartSection represents the chart section of the landing page
|
||||||
type chartSection struct {
|
type chartSection struct {
|
||||||
Title string `bson:"title" json:"title"`
|
Title string `bson:"title" json:"title"`
|
||||||
MissedAmount string `bson:"missed_amount" json:"missedAmount"`
|
MissedAmount string `bson:"missed_amount" json:"missed_amount"`
|
||||||
Data []chartPoint `bson:"data" json:"data"`
|
Data []chartPoint `bson:"data" json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,41 +83,41 @@ type chartPoint struct {
|
|||||||
|
|
||||||
// cardSection represents the card section of the landing page
|
// cardSection represents the card section of the landing page
|
||||||
type cardSection struct {
|
type cardSection struct {
|
||||||
Title string `bson:"title"`
|
Title string `bson:"title" json:"title"`
|
||||||
Description string `bson:"description"`
|
Description string `bson:"description" json:"description"`
|
||||||
Cards []card `bson:"cards"`
|
Cards []card `bson:"cards" json:"cards"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// card represents a card in the card section
|
// card represents a card in the card section
|
||||||
type card struct {
|
type card struct {
|
||||||
ID string `bson:"id" json:"id"`
|
ID string `bson:"id" json:"id"`
|
||||||
Icon string `bson:"icon"`
|
Icon string `bson:"icon" json:"icon"`
|
||||||
Title string `bson:"title"`
|
Title string `bson:"title" json:"title"`
|
||||||
Description string `bson:"description"`
|
Description string `bson:"description" json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// contactSection represents the contact section of the landing page
|
// contactSection represents the contact section of the landing page
|
||||||
type contactSection struct {
|
type contactSection struct {
|
||||||
Title string `bson:"title"`
|
Title string `bson:"title" json:"title"`
|
||||||
Description string `bson:"description"`
|
Description string `bson:"description" json:"description"`
|
||||||
SubmitButtonText string `bson:"submit_button_text"`
|
SubmitButtonText string `bson:"submit_button_text" json:"submit_button_text"`
|
||||||
Fields []formField `bson:"fields"`
|
Fields []formField `bson:"fields" json:"fields"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// formField represents a form field in the contact section
|
// formField represents a form field in the contact section
|
||||||
type formField struct {
|
type formField struct {
|
||||||
ID string `bson:"id" json:"id"`
|
ID string `bson:"id" json:"id"`
|
||||||
Name string `bson:"name"`
|
Name string `bson:"name" json:"name"`
|
||||||
Label string `bson:"label"`
|
Label string `bson:"label" json:"label"`
|
||||||
Placeholder string `bson:"placeholder"`
|
Placeholder string `bson:"placeholder" json:"placeholder"`
|
||||||
Required bool `bson:"required"`
|
Required bool `bson:"required" json:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// footerSection represents the footer section of the landing page
|
// footerSection represents the footer section of the landing page
|
||||||
type footerSection struct {
|
type footerSection struct {
|
||||||
Email string `bson:"email"`
|
Email string `bson:"email" json:"email"`
|
||||||
Phone string `bson:"phone"`
|
Phone string `bson:"phone" json:"phone"`
|
||||||
Location string `bson:"location"`
|
Location string `bson:"location" json:"location"`
|
||||||
Tagline string `bson:"tagline"`
|
Tagline string `bson:"tagline" json:"tagline"`
|
||||||
Copyright string `bson:"copyright"`
|
Copyright string `bson:"copyright" json:"copyright"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user