Documentation
¶
Index ¶
- type Module
- func (m *Module) FieldResolvers() map[string]any
- func (m *Module) GetSettingsStep(sCtx mdk.StepContext) mdk.StepResult
- func (m *Module) GetStoreSettings(ctx context.Context) (*StoreSettings, error)
- func (m *Module) ID() string
- func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error
- func (m *Module) ListResources(ctx context.Context) ([]mdk.MCPResource, error)
- func (m *Module) Models() []any
- func (m *Module) Mutations() map[string]any
- func (m *Module) Queries() map[string]any
- func (m *Module) ReadResource(ctx context.Context, uri string) (string, error)
- func (m *Module) Repo() *Repository
- func (m *Module) Routes() []mdk.Route
- func (m *Module) Shutdown(ctx context.Context) error
- func (m *Module) UpdateSettingsStep(sCtx mdk.StepContext) mdk.StepResult
- func (m *Module) UpdateStoreSettings(ctx context.Context, input UpdateStoreSettingsInput) (*StoreSettings, error)
- type Repository
- type SEOInput
- type StoreSettings
- type UpdateStoreSettingsInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements the mdk.Module interface for StoreSettings management.
func (*Module) FieldResolvers ¶
FieldResolvers exposes custom field-level resolvers.
func (*Module) GetSettingsStep ¶
func (m *Module) GetSettingsStep(sCtx mdk.StepContext) mdk.StepResult
func (*Module) GetStoreSettings ¶
func (m *Module) GetStoreSettings(ctx context.Context) (*StoreSettings, error)
GetStoreSettings returns the global store settings record.
func (*Module) Init ¶
Init initializes the store module and seeds default configurations if necessary.
func (*Module) ListResources ¶
func (*Module) ReadResource ¶
func (*Module) Repo ¶
func (m *Module) Repo() *Repository
Repo returns the direct repository data-access client.
func (*Module) UpdateSettingsStep ¶
func (m *Module) UpdateSettingsStep(sCtx mdk.StepContext) mdk.StepResult
func (*Module) UpdateStoreSettings ¶
func (m *Module) UpdateStoreSettings(ctx context.Context, input UpdateStoreSettingsInput) (*StoreSettings, error)
UpdateStoreSettings updates non-nil input configurations for the store settings.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository handles database interactions for the singleton StoreSettings.
func NewRepository ¶
func NewRepository(db *gorm.DB) *Repository
NewRepository creates a new database repository instance.
func (*Repository) Get ¶
func (r *Repository) Get(ctx context.Context) (*StoreSettings, error)
Get retrieves the singleton StoreSettings (ID = 1).
func (*Repository) Save ¶
func (r *Repository) Save(ctx context.Context, settings *StoreSettings) error
Save saves or updates the StoreSettings entity.
type SEOInput ¶
type SEOInput struct {
MetaTitle *string `json:"metaTitle"`
MetaDescription *string `json:"metaDescription"`
MetaKeywords *string `json:"metaKeywords"`
MetaImage *string `json:"metaImage"`
}
SEOInput matches the GraphQL input mapping.
type StoreSettings ¶
type StoreSettings struct {
ID uint `gorm:"primaryKey;default:1" json:"id"`
Name string `gorm:"not null;default:'My Hyperrr Store'" json:"name"`
Host string `gorm:"not null;default:'localhost:8080'" json:"host"`
Email string `gorm:"default:'admin@example.com'" json:"email"`
Phone string `json:"phone"`
Description string `json:"description"`
Currency string `gorm:"not null;default:'USD'" json:"currency"`
Locale string `gorm:"not null;default:'en-US'" json:"locale"`
Timezone string `gorm:"not null;default:'UTC'" json:"timezone"`
// Physical Store Address (used by fulfillment, tax, invoice modules)
Address string `json:"address"`
City string `json:"city"`
State string `json:"state"`
Zip string `json:"zip"`
Country string `json:"country"`
// SEO & Metadata
SEO seo.SEO `gorm:"embedded;embeddedPrefix:seo_" json:"seo"`
RobotsTXT string `gorm:"type:text" json:"robotsTxt"`
SitemapURL string `json:"sitemapUrl"`
LogoURL string `json:"logoUrl"`
FaviconURL string `json:"faviconUrl"`
// Social Links
SocialFacebook string `json:"socialFacebook"`
SocialInstagram string `json:"socialInstagram"`
SocialTwitter string `json:"socialTwitter"`
SocialLinkedin string `json:"socialLinkedin"`
SocialYoutube string `json:"socialYoutube"`
SocialPinterest string `json:"socialPinterest"`
SocialTikTok string `json:"socialTikTok"`
// Dynamic Metadata (Dynamic Extensibility options)
Metadata mdk.Metadata `gorm:"type:text" json:"metadata"`
// Timestamps
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
StoreSettings represents the global configurations and settings of the e-commerce shop.
type UpdateStoreSettingsInput ¶
type UpdateStoreSettingsInput struct {
Name *string `json:"name"`
Host *string `json:"host"`
Email *string `json:"email"`
Phone *string `json:"phone"`
Description *string `json:"description"`
Currency *string `json:"currency"`
Locale *string `json:"locale"`
Timezone *string `json:"timezone"`
Address *string `json:"address"`
City *string `json:"city"`
State *string `json:"state"`
Zip *string `json:"zip"`
Country *string `json:"country"`
SEO *SEOInput `json:"seo"`
RobotsTxt *string `json:"robotsTxt"`
SitemapUrl *string `json:"sitemapUrl"`
LogoUrl *string `json:"logoUrl"`
FaviconUrl *string `json:"faviconUrl"`
SocialFacebook *string `json:"socialFacebook"`
SocialInstagram *string `json:"socialInstagram"`
SocialTwitter *string `json:"socialTwitter"`
SocialLinkedin *string `json:"socialLinkedin"`
SocialYoutube *string `json:"socialYoutube"`
SocialPinterest *string `json:"socialPinterest"`
SocialTikTok *string `json:"socialTikTok"`
Metadata mdk.Metadata `json:"metadata"`
}
UpdateStoreSettingsInput maps GraphQL inputs to updates on the model.