page

package
v0.0.0-...-991afdd Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePageEntityUseCase

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

CreatePageEntityUseCase creates a domain page entity from input

func ProvideCreatePageEntityUseCase

func ProvideCreatePageEntityUseCase(
	ipEncryptor *ipcrypt.IPEncryptor,
	logger *zap.Logger,
) *CreatePageEntityUseCase

ProvideCreatePageEntityUseCase creates a new CreatePageEntityUseCase

func (*CreatePageEntityUseCase) Execute

func (uc *CreatePageEntityUseCase) Execute(
	siteID, tenantID gocql.UUID,
	input SyncPageInput,
) (*domainpage.Page, error)

Execute converts SyncPageInput to a domain Page entity

type DeleteAllPagesInput

type DeleteAllPagesInput struct{}

DeleteAllPagesInput is the input for deleting all pages for a site

type DeletePagesFromRepoUseCase

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

DeletePagesFromRepoUseCase deletes pages from the database repository

func ProvideDeletePagesFromRepoUseCase

func ProvideDeletePagesFromRepoUseCase(
	pageRepo domainpage.Repository,
	logger *zap.Logger,
) *DeletePagesFromRepoUseCase

ProvideDeletePagesFromRepoUseCase creates a new DeletePagesFromRepoUseCase

func (*DeletePagesFromRepoUseCase) Execute

func (uc *DeletePagesFromRepoUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
	pageIDs []string,
) (*DeletePagesResult, error)

Execute deletes specific pages from the database

func (*DeletePagesFromRepoUseCase) ExecuteDeleteAll

func (uc *DeletePagesFromRepoUseCase) ExecuteDeleteAll(
	ctx context.Context,
	siteID gocql.UUID,
) (int64, error)

ExecuteDeleteAll deletes all pages for a site from the database

type DeletePagesFromSearchUseCase

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

DeletePagesFromSearchUseCase deletes pages from the search index

func ProvideDeletePagesFromSearchUseCase

func ProvideDeletePagesFromSearchUseCase(
	searchClient *search.Client,
	logger *zap.Logger,
) *DeletePagesFromSearchUseCase

ProvideDeletePagesFromSearchUseCase creates a new DeletePagesFromSearchUseCase

func (*DeletePagesFromSearchUseCase) Execute

func (uc *DeletePagesFromSearchUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
	pageIDs []string,
) (int, error)

Execute deletes specific pages from the search index

func (*DeletePagesFromSearchUseCase) ExecuteDeleteAll

func (uc *DeletePagesFromSearchUseCase) ExecuteDeleteAll(
	ctx context.Context,
	siteID gocql.UUID,
) error

ExecuteDeleteAll deletes all documents for a site from the search index

type DeletePagesInput

type DeletePagesInput struct {
	PageIDs []string `json:"page_ids"`
}

DeletePagesInput is the input for deleting pages

type DeletePagesOutput

type DeletePagesOutput struct {
	DeletedCount   int      `json:"deleted_count"`
	DeindexedCount int      `json:"deindexed_count"`
	FailedPages    []string `json:"failed_pages,omitempty"`
	Message        string   `json:"message"`
}

DeletePagesOutput is the output after deleting pages

type DeletePagesResult

type DeletePagesResult struct {
	DeletedCount int
	FailedPages  []string
}

DeletePagesResult contains the result of page deletion

type DeletePagesUseCase

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

DeletePagesUseCase handles page deletion

func ProvideDeletePagesUseCase

func ProvideDeletePagesUseCase(
	pageRepo domainpage.Repository,
	siteRepo domainsite.Repository,
	searchClient *search.Client,
	logger *zap.Logger,
) *DeletePagesUseCase

ProvideDeletePagesUseCase creates a new DeletePagesUseCase

func (*DeletePagesUseCase) Execute

func (uc *DeletePagesUseCase) Execute(ctx context.Context, tenantID, siteID gocql.UUID, input *DeletePagesInput) (*DeletePagesOutput, error)

Execute deletes pages from both database and search index

func (*DeletePagesUseCase) ExecuteDeleteAll

func (uc *DeletePagesUseCase) ExecuteDeleteAll(ctx context.Context, tenantID, siteID gocql.UUID) (*DeletePagesOutput, error)

ExecuteDeleteAll deletes all pages for a site

type EnsureSearchIndexUseCase

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

EnsureSearchIndexUseCase ensures search index exists for a site

func ProvideEnsureSearchIndexUseCase

func ProvideEnsureSearchIndexUseCase(
	searchClient *search.Client,
	logger *zap.Logger,
) *EnsureSearchIndexUseCase

ProvideEnsureSearchIndexUseCase creates a new EnsureSearchIndexUseCase

func (*EnsureSearchIndexUseCase) Execute

func (uc *EnsureSearchIndexUseCase) Execute(ctx context.Context, siteID gocql.UUID) error

Execute ensures the search index exists, creating it if necessary

type ExecuteSearchQueryUseCase

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

ExecuteSearchQueryUseCase performs the actual search query

func ProvideExecuteSearchQueryUseCase

func ProvideExecuteSearchQueryUseCase(
	searchClient *search.Client,
	logger *zap.Logger,
) *ExecuteSearchQueryUseCase

ProvideExecuteSearchQueryUseCase creates a new ExecuteSearchQueryUseCase

func (*ExecuteSearchQueryUseCase) Execute

func (uc *ExecuteSearchQueryUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
	query string,
	limit, offset int64,
	filter string,
) (*search.SearchResult, error)

Execute performs the search query against Meilisearch

type GetPageByIDUseCase

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

GetPageByIDUseCase retrieves a specific page by ID

func ProvideGetPageByIDUseCase

func ProvideGetPageByIDUseCase(
	pageRepo domainpage.Repository,
	logger *zap.Logger,
) *GetPageByIDUseCase

ProvideGetPageByIDUseCase creates a new GetPageByIDUseCase

func (*GetPageByIDUseCase) Execute

func (uc *GetPageByIDUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
	pageID string,
) (*domainpage.Page, error)

Execute retrieves a page by its ID

type GetPageDetailsInput

type GetPageDetailsInput struct {
	PageID string `json:"page_id"`
}

GetPageDetailsInput is the input for getting page details

type GetPageStatisticsUseCase

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

GetPageStatisticsUseCase retrieves page count statistics

func ProvideGetPageStatisticsUseCase

func ProvideGetPageStatisticsUseCase(
	pageRepo domainpage.Repository,
	logger *zap.Logger,
) *GetPageStatisticsUseCase

ProvideGetPageStatisticsUseCase creates a new GetPageStatisticsUseCase

func (*GetPageStatisticsUseCase) Execute

func (uc *GetPageStatisticsUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
) (*PageStatistics, error)

Execute retrieves page statistics for a site

type GetSearchIndexStatusUseCase

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

GetSearchIndexStatusUseCase retrieves search index status information

func ProvideGetSearchIndexStatusUseCase

func ProvideGetSearchIndexStatusUseCase(
	searchClient *search.Client,
	logger *zap.Logger,
) *GetSearchIndexStatusUseCase

ProvideGetSearchIndexStatusUseCase creates a new GetSearchIndexStatusUseCase

func (*GetSearchIndexStatusUseCase) Execute

Execute retrieves search index status for a site

type GetSyncStatusUseCase

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

GetSyncStatusUseCase handles retrieving synchronization status

func ProvideGetSyncStatusUseCase

func ProvideGetSyncStatusUseCase(
	pageRepo domainpage.Repository,
	siteRepo domainsite.Repository,
	searchClient *search.Client,
	logger *zap.Logger,
) *GetSyncStatusUseCase

ProvideGetSyncStatusUseCase creates a new GetSyncStatusUseCase

func (*GetSyncStatusUseCase) Execute

func (uc *GetSyncStatusUseCase) Execute(ctx context.Context, tenantID, siteID gocql.UUID) (*SyncStatusOutput, error)

Execute retrieves the current sync status for a site

func (*GetSyncStatusUseCase) ExecuteGetPageDetails

func (uc *GetSyncStatusUseCase) ExecuteGetPageDetails(ctx context.Context, tenantID, siteID gocql.UUID, input *GetPageDetailsInput) (*PageDetailsOutput, error)

ExecuteGetPageDetails retrieves detailed information about a specific page

type IncrementSearchCountUseCase

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

IncrementSearchCountUseCase increments the search request counter for a site

func ProvideIncrementSearchCountUseCase

func ProvideIncrementSearchCountUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *IncrementSearchCountUseCase

ProvideIncrementSearchCountUseCase creates a new IncrementSearchCountUseCase

func (*IncrementSearchCountUseCase) Execute

func (uc *IncrementSearchCountUseCase) Execute(
	ctx context.Context,
	site *domainsite.Site,
) error

Execute increments the search count and updates the site usage tracking

type IndexPageToSearchUseCase

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

IndexPageToSearchUseCase indexes pages to the search engine

func ProvideIndexPageToSearchUseCase

func ProvideIndexPageToSearchUseCase(
	searchClient *search.Client,
	logger *zap.Logger,
) *IndexPageToSearchUseCase

ProvideIndexPageToSearchUseCase creates a new IndexPageToSearchUseCase

func (*IndexPageToSearchUseCase) Execute

func (uc *IndexPageToSearchUseCase) Execute(
	ctx context.Context,
	siteID gocql.UUID,
	pages []*domainpage.Page,
) (int, error)

Execute indexes a batch of pages to Meilisearch

type PageDetailsOutput

type PageDetailsOutput struct {
	PageID           string    `json:"page_id"`
	Title            string    `json:"title"`
	Excerpt          string    `json:"excerpt"`
	URL              string    `json:"url"`
	Status           string    `json:"status"`
	PostType         string    `json:"post_type"`
	Author           string    `json:"author"`
	PublishedAt      time.Time `json:"published_at"`
	ModifiedAt       time.Time `json:"modified_at"`
	IndexedAt        time.Time `json:"indexed_at"`
	MeilisearchDocID string    `json:"meilisearch_doc_id"`
	IsIndexed        bool      `json:"is_indexed"`
}

PageDetailsOutput provides detailed information about a specific page

type PageStatistics

type PageStatistics struct {
	TotalPages     int64
	PublishedPages int64
	DraftPages     int64
}

PageStatistics contains page count statistics

type SearchIndexStatus

type SearchIndexStatus struct {
	Status        string // "not_created", "active", "error"
	DocumentCount int64
}

SearchIndexStatus contains search index status information

type SearchPagesInput

type SearchPagesInput struct {
	Query  string `json:"query"`
	Limit  int64  `json:"limit"`
	Offset int64  `json:"offset"`
	Filter string `json:"filter,omitempty"` // e.g., "status = publish AND post_type = post"
}

SearchPagesInput is the input for searching pages

type SearchPagesOutput

type SearchPagesOutput struct {
	Hits             interface{} `json:"hits"` // meilisearch.Hits
	Query            string      `json:"query"`
	ProcessingTimeMs int64       `json:"processing_time_ms"`
	TotalHits        int64       `json:"total_hits"`
	Limit            int64       `json:"limit"`
	Offset           int64       `json:"offset"`
}

SearchPagesOutput is the output after searching pages

type SearchPagesUseCase

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

SearchPagesUseCase handles page search functionality

func ProvideSearchPagesUseCase

func ProvideSearchPagesUseCase(
	siteRepo domainsite.Repository,
	searchClient *search.Client,
	logger *zap.Logger,
) *SearchPagesUseCase

ProvideSearchPagesUseCase creates a new SearchPagesUseCase

func (*SearchPagesUseCase) Execute

func (uc *SearchPagesUseCase) Execute(ctx context.Context, tenantID, siteID gocql.UUID, input *SearchPagesInput) (*SearchPagesOutput, error)

Execute performs a search on the site's indexed pages

type SyncPageInput

type SyncPageInput struct {
	PageID      string    `json:"page_id"`
	Title       string    `json:"title"`
	Content     string    `json:"content"`
	Excerpt     string    `json:"excerpt"`
	URL         string    `json:"url"`
	Status      string    `json:"status"`    // publish, draft, trash
	PostType    string    `json:"post_type"` // page, post
	Author      string    `json:"author"`
	PublishedAt time.Time `json:"published_at"`
	ModifiedAt  time.Time `json:"modified_at"`
	IPAddress   string    `json:"-"` // Plain IP address (will be encrypted before storage), never exposed in JSON
}

SyncPageInput represents a single page to sync

type SyncPagesInput

type SyncPagesInput struct {
	Pages []SyncPageInput `json:"pages"`
}

SyncPagesInput is the input for syncing pages

type SyncPagesOutput

type SyncPagesOutput struct {
	SyncedCount  int      `json:"synced_count"`
	IndexedCount int      `json:"indexed_count"`
	FailedPages  []string `json:"failed_pages,omitempty"`
	Message      string   `json:"message"`
}

SyncPagesOutput is the output after syncing pages

type SyncPagesUseCase

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

SyncPagesUseCase handles page synchronization from WordPress

func ProvideSyncPagesUseCase

func ProvideSyncPagesUseCase(
	pageRepo domainpage.Repository,
	siteRepo domainsite.Repository,
	searchClient *search.Client,
	ipEncryptor *ipcrypt.IPEncryptor,
	logger *zap.Logger,
) *SyncPagesUseCase

ProvideSyncPagesUseCase creates a new SyncPagesUseCase

func (*SyncPagesUseCase) SyncPages

func (uc *SyncPagesUseCase) SyncPages(ctx context.Context, tenantID, siteID gocql.UUID, input *SyncPagesInput) (*SyncPagesOutput, error)

SyncPages syncs a batch of pages for a site

type SyncStatusOutput

type SyncStatusOutput struct {
	SiteID              string    `json:"site_id"`
	TotalPages          int64     `json:"total_pages"`
	PublishedPages      int64     `json:"published_pages"`
	DraftPages          int64     `json:"draft_pages"`
	LastSyncedAt        time.Time `json:"last_synced_at"`
	PagesIndexedMonth   int64     `json:"pages_indexed_month"`   // Usage tracking
	SearchRequestsMonth int64     `json:"search_requests_month"` // Usage tracking
	LastResetAt         time.Time `json:"last_reset_at"`         // Monthly billing cycle
	SearchIndexStatus   string    `json:"search_index_status"`
	SearchIndexDocCount int64     `json:"search_index_doc_count"`
}

SyncStatusOutput provides synchronization status information

type UpdateSiteUsageUseCase

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

UpdateSiteUsageUseCase updates site usage counters after indexing

func ProvideUpdateSiteUsageUseCase

func ProvideUpdateSiteUsageUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *UpdateSiteUsageUseCase

ProvideUpdateSiteUsageUseCase creates a new UpdateSiteUsageUseCase

func (*UpdateSiteUsageUseCase) Execute

func (uc *UpdateSiteUsageUseCase) Execute(
	ctx context.Context,
	site *domainsite.Site,
	indexedCount int,
) error

Execute updates the site's monthly page indexed count (for billing tracking)

type UpsertPageUseCase

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

UpsertPageUseCase saves or updates a page in the repository

func ProvideUpsertPageUseCase

func ProvideUpsertPageUseCase(
	pageRepo domainpage.Repository,
	logger *zap.Logger,
) *UpsertPageUseCase

ProvideUpsertPageUseCase creates a new UpsertPageUseCase

func (*UpsertPageUseCase) Execute

func (uc *UpsertPageUseCase) Execute(ctx context.Context, page *domainpage.Page) error

Execute saves or updates a page in the database

type ValidateSiteForDeletionUseCase

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

ValidateSiteForDeletionUseCase validates that a site exists and is authorized for deletion

func ProvideValidateSiteForDeletionUseCase

func ProvideValidateSiteForDeletionUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *ValidateSiteForDeletionUseCase

ProvideValidateSiteForDeletionUseCase creates a new ValidateSiteForDeletionUseCase

func (*ValidateSiteForDeletionUseCase) Execute

func (uc *ValidateSiteForDeletionUseCase) Execute(
	ctx context.Context,
	tenantID, siteID gocql.UUID,
) (*domainsite.Site, error)

Execute validates the site for deletion operations

type ValidateSiteForSearchUseCase

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

ValidateSiteForSearchUseCase validates that a site exists and is authorized for search

func ProvideValidateSiteForSearchUseCase

func ProvideValidateSiteForSearchUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *ValidateSiteForSearchUseCase

ProvideValidateSiteForSearchUseCase creates a new ValidateSiteForSearchUseCase

func (*ValidateSiteForSearchUseCase) Execute

func (uc *ValidateSiteForSearchUseCase) Execute(
	ctx context.Context,
	tenantID, siteID gocql.UUID,
) (*domainsite.Site, error)

Execute validates the site for search operations

type ValidateSiteForStatusUseCase

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

ValidateSiteForStatusUseCase validates that a site exists and is authorized for status queries

func ProvideValidateSiteForStatusUseCase

func ProvideValidateSiteForStatusUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *ValidateSiteForStatusUseCase

ProvideValidateSiteForStatusUseCase creates a new ValidateSiteForStatusUseCase

func (*ValidateSiteForStatusUseCase) Execute

func (uc *ValidateSiteForStatusUseCase) Execute(
	ctx context.Context,
	tenantID, siteID gocql.UUID,
) (*domainsite.Site, error)

Execute validates the site for status operations

type ValidateSiteUseCase

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

ValidateSiteUseCase validates site status and verification

func ProvideValidateSiteUseCase

func ProvideValidateSiteUseCase(
	siteRepo domainsite.Repository,
	logger *zap.Logger,
) *ValidateSiteUseCase

ProvideValidateSiteUseCase creates a new ValidateSiteUseCase

func (*ValidateSiteUseCase) Execute

func (uc *ValidateSiteUseCase) Execute(
	ctx context.Context,
	tenantID, siteID gocql.UUID,
) (*domainsite.Site, error)

Execute validates the site and returns it if valid

Jump to

Keyboard shortcuts

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