services

package
v0.0.0-...-82d3590 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAPIKey

func GenerateAPIKey() (string, error)

GenerateKey generates new random API key (32 bytes = 43 chars base64)

Types

type APIKeyRepository

type APIKeyRepository interface {
	GetByKeyHash(keyHash string) (*models.APIKey, error)
	UpdateLastUsed(keyID string, lastUsed time.Time) error
	Create(apiKey *models.APIKey) error
	Update(apiKey *models.APIKey) error
	Delete(keyID string) error
	ListByAccount(accountID string) ([]*models.APIKey, error)
}

APIKeyRepository defines interface for API key storage operations

type APIKeyService

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

APIKeyService handles API key operations

func NewAPIKeyService

func NewAPIKeyService(repo APIKeyRepository) *APIKeyService

NewAPIKeyService creates new API key service

func (*APIKeyService) CreateAPIKey

func (s *APIKeyService) CreateAPIKey(accountID, name string, expiresAt *time.Time) (string, *models.APIKey, error)

CreateAPIKey creates new API key for account

func (*APIKeyService) DeleteKey

func (s *APIKeyService) DeleteKey(keyID string) error

DeleteKey deletes API key

func (*APIKeyService) DisableKey

func (s *APIKeyService) DisableKey(keyID string) error

DisableKey disables API key

func (*APIKeyService) EnableKey

func (s *APIKeyService) EnableKey(keyID string) error

EnableKey enables API key

func (*APIKeyService) ListAccountKeys

func (s *APIKeyService) ListAccountKeys(accountID string) ([]*models.APIKey, error)

ListAccountKeys lists all API keys for account

func (*APIKeyService) UpdateLastUsed

func (s *APIKeyService) UpdateLastUsed(keyID string) error

UpdateLastUsed updates last used timestamp for API key

func (*APIKeyService) ValidateAPIKey

func (s *APIKeyService) ValidateAPIKey(keyHash string) (*models.APIKey, error)

ValidateAPIKey validates API key and returns key model

type CompletedDocumentBuilder

type CompletedDocumentBuilder struct {
	Pool            *pgxpool.Pool
	TemplateQueries *queries.TemplateQueries
	PagesDir        string
	SignedDir       string
	AssetsDir       string
}

CompletedDocumentBuilder builds and caches a final, completed PDF for a submission.

It is intentionally simple and filesystem-backed: - source pages are in PagesDir: lc_pages/{attachment_id}/0.pdf - completed PDFs are written to SignedDir: lc_signed/submission_{submission_id}.pdf

func (*CompletedDocumentBuilder) CertificatePDFPath

func (b *CompletedDocumentBuilder) CertificatePDFPath(submissionID string) string

func (*CompletedDocumentBuilder) CompletedPDFPath

func (b *CompletedDocumentBuilder) CompletedPDFPath(submissionID string) string

func (*CompletedDocumentBuilder) EnsureCertificatePDF

func (b *CompletedDocumentBuilder) EnsureCertificatePDF(ctx context.Context, submissionID string) (string, error)

EnsureCertificatePDF generates the certificate-only PDF (if missing) and returns its path. It does NOT check completion; caller must ensure submission is completed.

func (*CompletedDocumentBuilder) EnsureCompletedPDF

func (b *CompletedDocumentBuilder) EnsureCompletedPDF(ctx context.Context, submissionID string) (string, error)

EnsureCompletedPDF generates the completed PDF (if missing) and returns its path. It does NOT check completion; caller must ensure submission is completed.

func (*CompletedDocumentBuilder) IsSubmissionFullyCompleted

func (b *CompletedDocumentBuilder) IsSubmissionFullyCompleted(ctx context.Context, submissionID string) (bool, error)

IsSubmissionFullyCompleted returns true if ALL submitters for the submission are completed.

type ReminderRepository

type ReminderRepository interface {
	GetSubmitters(ctx context.Context, submissionID string) ([]*models.Submitter, error)
}

ReminderRepository represents database operations for reminders

type ReminderService

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

ReminderService manages reminders for submitters

func NewReminderService

func NewReminderService(notificationSvc *notification.Service, repo ReminderRepository) *ReminderService

NewReminderService creates a new reminder service

func (*ReminderService) CancelReminders

func (s *ReminderService) CancelReminders(submissionID string) error

CancelReminders cancels all scheduled reminders for submission

func (*ReminderService) ProcessScheduled

func (s *ReminderService) ProcessScheduled() error

ProcessScheduled processes all scheduled notifications (called by worker)

func (*ReminderService) ScheduleReminders

func (s *ReminderService) ScheduleReminders(ctx context.Context, submission *models.Submission, template *models.Template) error

ScheduleReminders schedules reminders for submission according to settings

func (*ReminderService) SendImmediate

func (s *ReminderService) SendImmediate(submitter *models.Submitter, submissionTitle string) error

SendImmediate sends a reminder immediately (on user request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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