Merge pull request 'added UUID to card and form field' (#6) from TM-290 into develop

Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/6
This commit is contained in:
m.nazemi
2025-11-15 10:52:36 +03:30
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,
}
}
}
}