added UUID to card and form field

This commit is contained in:
Mazyar
2025-11-15 10:51:04 +03:30
parent a3472f432d
commit ba06595ab0
2 changed files with 13 additions and 2 deletions
+2
View File
@@ -90,6 +90,7 @@ type cardSection struct {
// 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"`
@@ -105,6 +106,7 @@ type contactSection struct {
// 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"`
+11 -2
View File
@@ -310,7 +310,12 @@ func (s *cmsService) copyFormToEntity(form *CMSForm, cms *CMS) {
if len(form.Contact.Fields) > 0 {
cms.Contact.Fields = make([]formField, len(form.Contact.Fields))
for i, field := range form.Contact.Fields {
cms.Contact.Fields[i] = formField(field)
cms.Contact.Fields[i] = formField{
Name: field.Name,
Label: field.Label,
Placeholder: field.Placeholder,
Required: field.Required,
}
}
}
@@ -343,7 +348,11 @@ func (s *cmsService) copyCardSectionForm(formSection *cardSectionForm, entitySec
if len(formSection.Cards) > 0 {
entitySection.Cards = make([]card, len(formSection.Cards))
for i, cardForm := range formSection.Cards {
entitySection.Cards[i] = card(cardForm)
entitySection.Cards[i] = card{
Icon: cardForm.Icon,
Title: cardForm.Title,
Description: cardForm.Description,
}
}
}
}