Help us shape the future of Go! Take the 2026 Go Developer Survey

support

package
v1.15.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package support is the facade of the support module (announcements and, as migration proceeds, documents, tickets and ads). Admin and public handlers call the same service; access-plane concerns such as auth and field trimming stay in the handlers. See docs/adr-001-modular-monolith.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepoBuilder added in v1.15.2

func NewRepoBuilder() repository.SupportBuilder

NewRepoBuilder exports the module-owned repository implementations for store assembly (ADR-001 step-6 preparation).

Types

type BatchEmailStopper

type BatchEmailStopper interface {
	StopBatchEmail(taskID int64)
}

BatchEmailStopper aborts a running batch-email worker, if any.

type Deps

type Deps struct {
	Announcements repository.AnnouncementRepo
	Ads           repository.AdsRepo
	Documents     repository.DocumentRepo
	Tickets       repository.TicketRepo
	Tasks         repository.TaskRepo
	Subscriptions SubscriptionReader
	Recipients    EmailRecipientReader
	QuotaTargets  SubscriptionSelector
	Queue         MarketingQueue
	EmailStopper  BatchEmailStopper
}

Deps declares everything the module needs; the composition root (internal/svc) provides them. The module wraps legacy repositories during migration and will own its persistence once the domain data moves in (ADR-001 step 5).

type EmailRecipientReader

type EmailRecipientReader interface {
	QueryEmailRecipients(ctx context.Context, filter *user.EmailRecipientFilter) ([]string, error)
	CountEmailRecipients(ctx context.Context, filter *user.EmailRecipientFilter) (int64, error)
}

EmailRecipientReader is the module's port onto the identity domain for selecting campaign recipients; the legacy user repository satisfies it structurally.

type MarketingQueue

type MarketingQueue interface {
	EnqueueBatchEmail(ctx context.Context, taskID int64, processAt time.Time) (queueTaskID string, err error)
	EnqueueQuota(ctx context.Context, taskID int64) error
}

MarketingQueue schedules asynchronous execution of marketing tasks; the composition root adapts the asynq client so queue task types stay out of the module.

type Service

type Service interface {
	CreateAnnouncement(ctx context.Context, req *dto.CreateAnnouncementRequest) error
	UpdateAnnouncement(ctx context.Context, req *dto.UpdateAnnouncementRequest) error
	DeleteAnnouncement(ctx context.Context, req *dto.DeleteAnnouncementRequest) error
	GetAnnouncement(ctx context.Context, req *dto.GetAnnouncementRequest) (*dto.Announcement, error)
	GetAnnouncementList(ctx context.Context, req *dto.GetAnnouncementListRequest) (*dto.GetAnnouncementListResponse, error)
	// QueryAnnouncement lists announcements visible to end users; Show=true is
	// enforced here, not trusted from the request.
	QueryAnnouncement(ctx context.Context, req *dto.QueryAnnouncementRequest) (*dto.QueryAnnouncementResponse, error)

	CreateAds(ctx context.Context, req *dto.CreateAdsRequest) error
	UpdateAds(ctx context.Context, req *dto.UpdateAdsRequest) error
	DeleteAds(ctx context.Context, req *dto.DeleteAdsRequest) error
	GetAdsDetail(ctx context.Context, req *dto.GetAdsDetailRequest) (*dto.Ads, error)
	GetAdsList(ctx context.Context, req *dto.GetAdsListRequest) (*dto.GetAdsListResponse, error)
	// GetPublicAds lists the active ads for the public site.
	GetPublicAds(ctx context.Context, req *dto.GetAdsRequest) (*dto.GetAdsResponse, error)

	CreateDocument(ctx context.Context, req *dto.CreateDocumentRequest) error
	UpdateDocument(ctx context.Context, req *dto.UpdateDocumentRequest) error
	DeleteDocument(ctx context.Context, req *dto.DeleteDocumentRequest) error
	BatchDeleteDocument(ctx context.Context, req *dto.BatchDeleteDocumentRequest) error
	GetDocumentDetail(ctx context.Context, req *dto.GetDocumentDetailRequest) (*dto.Document, error)
	GetDocumentList(ctx context.Context, req *dto.GetDocumentListRequest) (*dto.GetDocumentListResponse, error)
	// QueryDocumentDetail renders subscription-gated blocks for the current
	// user before returning the content.
	QueryDocumentDetail(ctx context.Context, req *dto.QueryDocumentDetailRequest) (*dto.Document, error)
	QueryDocumentList(ctx context.Context) (*dto.QueryDocumentListResponse, error)

	CreateTicketFollow(ctx context.Context, req *dto.CreateTicketFollowRequest) error
	GetTicketList(ctx context.Context, req *dto.GetTicketListRequest) (*dto.GetTicketListResponse, error)
	GetTicket(ctx context.Context, req *dto.GetTicketRequest) (*dto.Ticket, error)
	UpdateTicketStatus(ctx context.Context, req *dto.UpdateTicketStatusRequest) error
	// The user-facing ticket operations resolve the current user from the
	// request context and enforce ticket ownership.
	CreateUserTicket(ctx context.Context, req *dto.CreateUserTicketRequest) error
	CreateUserTicketFollow(ctx context.Context, req *dto.CreateUserTicketFollowRequest) error
	GetUserTicketDetails(ctx context.Context, req *dto.GetUserTicketDetailRequest) (*dto.Ticket, error)
	GetUserTicketList(ctx context.Context, req *dto.GetUserTicketListRequest) (*dto.GetUserTicketListResponse, error)
	UpdateUserTicketStatus(ctx context.Context, req *dto.UpdateUserTicketStatusRequest) error

	CreateBatchSendEmailTask(ctx context.Context, req *dto.CreateBatchSendEmailTaskRequest) error
	GetPreSendEmailCount(ctx context.Context, req *dto.GetPreSendEmailCountRequest) (*dto.GetPreSendEmailCountResponse, error)
	GetBatchSendEmailTaskList(ctx context.Context, req *dto.GetBatchSendEmailTaskListRequest) (*dto.GetBatchSendEmailTaskListResponse, error)
	GetBatchSendEmailTaskStatus(ctx context.Context, req *dto.GetBatchSendEmailTaskStatusRequest) (*dto.GetBatchSendEmailTaskStatusResponse, error)
	StopBatchSendEmailTask(ctx context.Context, req *dto.StopBatchSendEmailTaskRequest) error
	CreateQuotaTask(ctx context.Context, req *dto.CreateQuotaTaskRequest) error
	QueryQuotaTaskList(ctx context.Context, req *dto.QueryQuotaTaskListRequest) (*dto.QueryQuotaTaskListResponse, error)
	QueryQuotaTaskPreCount(ctx context.Context, req *dto.QueryQuotaTaskPreCountRequest) (*dto.QueryQuotaTaskPreCountResponse, error)
	QueryQuotaTaskStatus(ctx context.Context, req *dto.QueryQuotaTaskStatusRequest) (*dto.QueryQuotaTaskStatusResponse, error)
}

Service is the only surface other code may depend on; the implementation lives under internal/ where the compiler seals it off.

func New

func New(deps Deps) Service

type SubscriptionReader

type SubscriptionReader interface {
	HasActiveSubscription(ctx context.Context, userID int64) (bool, error)
}

SubscriptionReader is the support module's port onto the subscription domain (dependency inversion: the consumer owns the interface). The composition root wraps the legacy repository today; the subscription module facade will implement it once that module exists.

type SubscriptionSelector

type SubscriptionSelector interface {
	QuerySubscribeIdsByFilter(ctx context.Context, filter *usersub.SubscribeFilter) ([]int64, error)
	CountSubscribesByFilter(ctx context.Context, filter *usersub.SubscribeFilter) (int64, error)
}

SubscriptionSelector is the module's port onto the subscription domain for selecting quota-task targets; the legacy user-subscription repository satisfies it structurally.

Directories

Path Synopsis
entity
ads
internal
ads
Package ads implements the ads subdomain of the support module.
Package ads implements the ads subdomain of the support module.
announcement
Package announcement implements the announcement subdomain of the support module.
Package announcement implements the announcement subdomain of the support module.
document
Package document implements the document subdomain of the support module.
Package document implements the document subdomain of the support module.
marketing
Package marketing implements the marketing subdomain of the support module (batch email campaigns and quota gift tasks).
Package marketing implements the marketing subdomain of the support module (batch email campaigns and quota gift tasks).
ticket
Package ticket implements the ticket subdomain of the support module.
Package ticket implements the ticket subdomain of the support module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL