document

package
v1.21.0 Latest Latest
Warning

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

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

Documentation

Overview

Package document implements the document subdomain of the support module. Only the module facade (internal/module/support) may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages the help documents for the support facade.

func NewService

func NewService(repo repository.DocumentRepo, subs SubscriptionReader) *Service

NewService builds the document service; subs may be nil, and then every reader sees the content for users without a subscription.

func (*Service) BatchDelete

func (s *Service) BatchDelete(ctx context.Context, req *dto.BatchDeleteDocumentRequest) error

BatchDelete removes the documents one by one, stopping at the first failure.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *dto.CreateDocumentRequest) error

Create stores a new document; its tags are stored comma-separated.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, req *dto.DeleteDocumentRequest) error

Delete removes a document.

func (*Service) GetDetail

func (s *Service) GetDetail(ctx context.Context, req *dto.GetDocumentDetailRequest) (*dto.Document, error)

GetDetail returns a document for the admin panel, hidden ones included.

func (*Service) List

List pages the documents for the admin panel.

func (*Service) QueryDetail

func (s *Service) QueryDetail(ctx context.Context, req *dto.QueryDocumentDetailRequest) (*dto.Document, error)

QueryDetail serves the user-facing detail. A hidden document answers exactly like a missing one, so the endpoint cannot be used to read or probe unpublished documents; the admin detail (GetDetail) still returns them.

func (*Service) QueryList

func (s *Service) QueryList(ctx context.Context) (*dto.QueryDocumentListResponse, error)

QueryList lists the shown documents for users, without their content.

func (*Service) Update

func (s *Service) Update(ctx context.Context, req *dto.UpdateDocumentRequest) error

Update overwrites a document's title, content and tags. A request without the show switch keeps the stored one, since the column cannot be NULL, and the document must exist: saving an unknown id used to insert it.

type SubscriptionReader

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

SubscriptionReader is the support module's port onto the subscription domain; the composition root adapts the subscription domain's repository to it.

Jump to

Keyboard shortcuts

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