chore: build
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
type Repository interface {
|
||||
Get(ctx context.Context) (*Settings, error)
|
||||
Update(ctx context.Context, s *Settings) error
|
||||
UpdateAppearance(ctx context.Context, s *Settings) error
|
||||
UpdateCustomerAuth(ctx context.Context, s *Settings) error
|
||||
}
|
||||
|
||||
type gormRepository struct {
|
||||
@@ -30,8 +32,39 @@ func (r *gormRepository) Get(ctx context.Context) (*Settings, error) {
|
||||
func (r *gormRepository) Update(ctx context.Context, s *Settings) error {
|
||||
s.ID = 1
|
||||
return r.db.WithContext(ctx).Model(&Settings{}).Where("id = 1").Updates(map[string]any{
|
||||
"name": s.Name,
|
||||
"description": s.Description,
|
||||
"slug": s.Slug,
|
||||
"name": s.Name,
|
||||
"description": s.Description,
|
||||
"orders_enabled": s.OrdersEnabled,
|
||||
}).Error
|
||||
}
|
||||
|
||||
func (r *gormRepository) UpdateAppearance(ctx context.Context, s *Settings) error {
|
||||
s.ID = 1
|
||||
return r.db.WithContext(ctx).Model(&Settings{}).Where("id = 1").Updates(map[string]any{
|
||||
"header_bg_color": s.HeaderBgColor,
|
||||
"header_text_color": s.HeaderTextColor,
|
||||
"body_bg_color": s.BodyBgColor,
|
||||
"body_text_color": s.BodyTextColor,
|
||||
"footer_bg_color": s.FooterBgColor,
|
||||
"footer_text_color": s.FooterTextColor,
|
||||
"accent_color": s.AccentColor,
|
||||
"product_layout": s.ProductLayout,
|
||||
"product_columns": s.ProductColumns,
|
||||
"product_scroll": s.ProductScroll,
|
||||
"contact_card_transparent": s.ContactCardTransparent,
|
||||
"contact_card_bg_color": s.ContactCardBgColor,
|
||||
"logo_media_id": s.LogoMediaID,
|
||||
"hero_media_id": s.HeroMediaID,
|
||||
"hero_pages": s.HeroPages,
|
||||
}).Error
|
||||
}
|
||||
|
||||
func (r *gormRepository) UpdateCustomerAuth(ctx context.Context, s *Settings) error {
|
||||
s.ID = 1
|
||||
return r.db.WithContext(ctx).Model(&Settings{}).Where("id = 1").Updates(map[string]any{
|
||||
"customer_login_enabled": s.CustomerLoginEnabled,
|
||||
"customer_registration_enabled": s.CustomerRegistrationEnabled,
|
||||
"customer_verification_required": s.CustomerVerificationRequired,
|
||||
"verification_contact_link_id": s.VerificationContactLinkID,
|
||||
}).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user