qudoco-be/app/module/hero_contents/request/hero_contents.request.go

39 lines
1.3 KiB
Go

package request
import "web-qudo-be/app/database/entity"
type HeroContentsCreateRequest struct {
PrimaryTitle string `json:"primary_title" form:"primary_title" validate:"required"`
SecondaryTitle string `json:"secondary_title" form:"secondary_title"`
Description string `json:"description" form:"description"`
PrimaryCTA string `json:"primary_cta" form:"primary_cta"`
SecondaryCTAText string `json:"secondary_cta_text" form:"secondary_cta_text"`
}
func (r *HeroContentsCreateRequest) ToEntity() *entity.HeroContents {
return &entity.HeroContents{
PrimaryTitle: r.PrimaryTitle,
SecondaryTitle: r.SecondaryTitle,
Description: r.Description,
PrimaryCta: r.PrimaryCTA,
SecondaryCtaText: r.SecondaryCTAText,
}
}
type HeroContentsUpdateRequest 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 (r *HeroContentsUpdateRequest) ToEntity() *entity.HeroContents {
return &entity.HeroContents{
PrimaryTitle: r.PrimaryTitle,
SecondaryTitle: r.SecondaryTitle,
Description: r.Description,
PrimaryCta: r.PrimaryCTA,
SecondaryCtaText: r.SecondaryCTAText,
}
}