package request import ( "web-qudo-be/app/database/entity" "web-qudo-be/utils/paginator" ) type PopupNewsContentsGeneric interface { ToEntity() } // Query type PopupNewsContentsQueryRequest struct { PrimaryTitle string `json:"primary_title"` Pagination *paginator.Pagination `json:"pagination"` } // Create type PopupNewsContentsCreateRequest struct { PrimaryTitle string `json:"primary_title" validate:"required"` SecondaryTitle string `json:"secondary_title"` Description string `json:"description"` PrimaryCTA string `json:"primary_cta"` SecondaryCTAText string `json:"secondary_cta_text"` } func (req PopupNewsContentsCreateRequest) ToEntity() *entity.PopupNewsContents { return &entity.PopupNewsContents{ PrimaryTitle: req.PrimaryTitle, SecondaryTitle: req.SecondaryTitle, Description: req.Description, PrimaryCTA: req.PrimaryCTA, SecondaryCTAText: req.SecondaryCTAText, } } // Update type PopupNewsContentsUpdateRequest struct { ID uint `json:"id" validate:"required"` PrimaryTitle string `json:"primary_title" validate:"required"` SecondaryTitle string `json:"secondary_title"` Description string `json:"description"` PrimaryCTA string `json:"primary_cta"` SecondaryCTAText string `json:"secondary_cta_text"` } func (req PopupNewsContentsUpdateRequest) ToEntity() *entity.PopupNewsContents { return &entity.PopupNewsContents{ ID: req.ID, PrimaryTitle: req.PrimaryTitle, SecondaryTitle: req.SecondaryTitle, Description: req.Description, PrimaryCTA: req.PrimaryCTA, SecondaryCTAText: req.SecondaryCTAText, } }