From ba06595ab03d1f2a20685391f7b96a1a0a42a762 Mon Sep 17 00:00:00 2001 From: Mazyar Date: Sat, 15 Nov 2025 10:51:04 +0330 Subject: [PATCH] added UUID to card and form field --- internal/cms/entity.go | 2 ++ internal/cms/service.go | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/cms/entity.go b/internal/cms/entity.go index 1f4363a..c458619 100644 --- a/internal/cms/entity.go +++ b/internal/cms/entity.go @@ -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"` diff --git a/internal/cms/service.go b/internal/cms/service.go index c6de0b1..a8cd34c 100644 --- a/internal/cms/service.go +++ b/internal/cms/service.go @@ -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, + } } } }