124 lines
3.5 KiB
Go
124 lines
3.5 KiB
Go
package cms
|
|
|
|
import (
|
|
"tm/pkg/mongo"
|
|
|
|
"go.mongodb.org/mongo-driver/v2/bson"
|
|
)
|
|
|
|
// CMS represents the content management system for the landing page
|
|
type CMS struct {
|
|
mongo.Model `bson:",inline"`
|
|
Key string `bson:"key"`
|
|
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"`
|
|
Challenges cardSection `bson:"challenges"`
|
|
Advantages cardSection `bson:"advantages"`
|
|
Contact contactSection `bson:"contact"`
|
|
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)
|
|
}
|
|
|
|
// GetID returns the CMS ID (implements IDGetter interface)
|
|
func (c *CMS) GetID() string {
|
|
return c.ID.Hex()
|
|
}
|
|
|
|
// SetCreatedAt sets the created timestamp (implements Timestamp interface)
|
|
func (c *CMS) SetCreatedAt(timestamp int64) {
|
|
c.CreatedAt = timestamp
|
|
}
|
|
|
|
// SetUpdatedAt sets the updated timestamp (implements Timestamp interface)
|
|
func (c *CMS) SetUpdatedAt(timestamp int64) {
|
|
c.UpdatedAt = timestamp
|
|
}
|
|
|
|
// GetCreatedAt returns the created timestamp (implements Timestamp interface)
|
|
func (c *CMS) GetCreatedAt() int64 {
|
|
return c.CreatedAt
|
|
}
|
|
|
|
// GetUpdatedAt returns the updated timestamp (implements Timestamp interface)
|
|
func (c *CMS) GetUpdatedAt() int64 {
|
|
return c.UpdatedAt
|
|
}
|
|
|
|
// heroSection represents the hero section of the landing page
|
|
type heroSection struct {
|
|
Title string `bson:"title"`
|
|
Description string `bson:"description"`
|
|
ButtonText string `bson:"button_text"`
|
|
ButtonLink string `bson:"button_link"`
|
|
GifFile string `bson:"gif_file"`
|
|
}
|
|
|
|
// chartSection represents the chart section of the landing page
|
|
type chartSection struct {
|
|
Title string `bson:"title" json:"title"`
|
|
MissedAmount string `bson:"missed_amount" json:"missedAmount"`
|
|
Data []chartPoint `bson:"data" json:"data"`
|
|
}
|
|
|
|
type chartPoint struct {
|
|
Key string `bson:"key" json:"key"`
|
|
Value int `bson:"value" json:"value"`
|
|
}
|
|
|
|
// cardSection represents the card section of the landing page
|
|
type cardSection struct {
|
|
Title string `bson:"title"`
|
|
Description string `bson:"description"`
|
|
Cards []card `bson:"cards"`
|
|
}
|
|
|
|
// card represents a card in the card section
|
|
type card struct {
|
|
ID string `bson:"id" json:"id"`
|
|
Icon string `bson:"icon"`
|
|
Title string `bson:"title"`
|
|
Description string `bson:"description"`
|
|
}
|
|
|
|
// contactSection represents the contact section of the landing page
|
|
type contactSection struct {
|
|
Title string `bson:"title"`
|
|
Description string `bson:"description"`
|
|
SubmitButtonText string `bson:"submit_button_text"`
|
|
Fields []formField `bson:"fields"`
|
|
}
|
|
|
|
// formField represents a form field in the contact section
|
|
type formField struct {
|
|
ID string `bson:"id" json:"id"`
|
|
Name string `bson:"name"`
|
|
Label string `bson:"label"`
|
|
Placeholder string `bson:"placeholder"`
|
|
Required bool `bson:"required"`
|
|
}
|
|
|
|
// footerSection represents the footer section of the landing page
|
|
type footerSection struct {
|
|
Email string `bson:"email"`
|
|
Phone string `bson:"phone"`
|
|
Location string `bson:"location"`
|
|
Tagline string `bson:"tagline"`
|
|
Copyright string `bson:"copyright"`
|
|
}
|