81 lines
3.2 KiB
Go
81 lines
3.2 KiB
Go
// Package site owns the minimal, config-driven site identity (name,
|
|
// description). It is the proof of the "code defines capabilities, admin
|
|
// defines content" pattern: future modules (appearance, menu, pages, ...)
|
|
// will follow this same shape (single-row or keyed settings table +
|
|
// admin-only read/write endpoints).
|
|
package site
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Settings struct {
|
|
ID int16 `gorm:"primaryKey"`
|
|
Name string
|
|
Description string
|
|
|
|
// OrdersEnabled is the "vitrine vs boutique" site-mode switch (spec
|
|
// section 6-8): off hides the cart/checkout entirely on the storefront
|
|
// (showcase-only, prices shown as indicative), on exposes the full
|
|
// cart/order flow (still subject to CustomerLoginEnabled below). On by
|
|
// default so a fresh deployment behaves like a shop out of the box.
|
|
OrdersEnabled bool
|
|
|
|
// Appearance: lets the admin restyle the storefront (header/body/footer
|
|
// colors, accent color, product listing layout) without touching code.
|
|
HeaderBgColor string
|
|
HeaderTextColor string
|
|
BodyBgColor string
|
|
BodyTextColor string
|
|
FooterBgColor string
|
|
FooterTextColor string
|
|
AccentColor string
|
|
ProductLayout string
|
|
// ProductColumns pins the storefront product grid to a fixed number of
|
|
// columns per row (2-5). 0 means "auto" -- the grid falls back to
|
|
// filling as many columns as fit the viewport (see .product-grid in
|
|
// index.css).
|
|
ProductColumns int
|
|
// ProductScroll is "vertical" (products flow down the page, the normal
|
|
// grid/list layouts) or "horizontal" (the product list becomes a
|
|
// swipeable sideways-scrolling row) -- independent from ProductLayout,
|
|
// so any card style can be browsed either way.
|
|
ProductScroll string
|
|
|
|
// Contact link cards (storefront Contact page): transparent by default
|
|
// so a hero image or the body background shows through the cards
|
|
// instead of a solid block; ContactCardBgColor is only used when the
|
|
// admin turns transparency off in favor of a solid color.
|
|
ContactCardTransparent bool
|
|
ContactCardBgColor string
|
|
|
|
// LogoMediaID replaces the text site name in the storefront header when
|
|
// set. HeroMediaID is a full-width banner image shown above the normal
|
|
// page content, only on the pages listed in HeroPages (comma-separated
|
|
// page keys, e.g. "home,contact" -- see handler.go's validHeroPages).
|
|
LogoMediaID *uuid.UUID `gorm:"type:uuid"`
|
|
HeroMediaID *uuid.UUID `gorm:"type:uuid"`
|
|
HeroPages string
|
|
|
|
// Customer accounts: the login page and the registration page are two
|
|
// independent switches the admin can flip separately (e.g. login-only
|
|
// for an invite-only shop where accounts are created from the admin
|
|
// panel, or registration-only during a pre-launch signup window).
|
|
// CustomerLoginEnabled is also what ordering checks (see
|
|
// orders.RequireAccountsEnabled): off by default, meaning nobody --
|
|
// guest or not -- can check out until the admin turns it on, optionally
|
|
// alongside an admin-approved identity verification too (e.g. for
|
|
// age/ID-restricted goods).
|
|
CustomerLoginEnabled bool
|
|
CustomerRegistrationEnabled bool
|
|
CustomerVerificationRequired bool
|
|
VerificationContactLinkID *uuid.UUID `gorm:"type:uuid"`
|
|
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (Settings) TableName() string { return "site_settings" }
|