Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
Index ¶
- func InitDB(ctx context.Context, config Config) (*sql.DB, error)
- func NewMagicLinkRepository(db *sql.DB) services.MagicLinkRepository
- type Config
- type ConfigRepository
- func (r *ConfigRepository) ClearSeeded(ctx context.Context) error
- func (r *ConfigRepository) DeleteAll(ctx context.Context) error
- func (r *ConfigRepository) GetAll(ctx context.Context) ([]*models.TenantConfig, error)
- func (r *ConfigRepository) GetByCategory(ctx context.Context, category models.ConfigCategory) (*models.TenantConfig, error)
- func (r *ConfigRepository) GetLatestUpdatedAt(ctx context.Context) (time.Time, error)
- func (r *ConfigRepository) GetTenantID(ctx context.Context) (uuid.UUID, error)
- func (r *ConfigRepository) IsSeeded(ctx context.Context) (bool, error)
- func (r *ConfigRepository) MarkSeeded(ctx context.Context) error
- func (r *ConfigRepository) Upsert(ctx context.Context, category models.ConfigCategory, config json.RawMessage, ...) error
- type DocumentRepository
- func (r *DocumentRepository) Count(ctx context.Context, searchQuery string) (int, error)
- func (r *DocumentRepository) CountByCreatedBy(ctx context.Context, createdBy, searchQuery string) (int, error)
- func (r *DocumentRepository) Create(ctx context.Context, docID string, input models.DocumentInput, ...) (*models.Document, error)
- func (r *DocumentRepository) CreateOrUpdate(ctx context.Context, docID string, input models.DocumentInput, ...) (*models.Document, error)
- func (r *DocumentRepository) Delete(ctx context.Context, docID string) error
- func (r *DocumentRepository) FindByReference(ctx context.Context, ref string, refType string) (*models.Document, error)
- func (r *DocumentRepository) GetByDocID(ctx context.Context, docID string) (*models.Document, error)
- func (r *DocumentRepository) List(ctx context.Context, limit, offset int) ([]*models.Document, error)
- func (r *DocumentRepository) ListByCreatedBy(ctx context.Context, createdBy string, limit, offset int) ([]*models.Document, error)
- func (r *DocumentRepository) Search(ctx context.Context, query string, limit, offset int) ([]*models.Document, error)
- func (r *DocumentRepository) SearchByCreatedBy(ctx context.Context, createdBy, searchQuery string, limit, offset int) ([]*models.Document, error)
- func (r *DocumentRepository) Update(ctx context.Context, docID string, input models.DocumentInput) (*models.Document, error)
- type EmailQueueRepository
- func (r *EmailQueueRepository) CancelEmail(ctx context.Context, id int64) error
- func (r *EmailQueueRepository) CleanupOldEmails(ctx context.Context, olderThan time.Duration) (int64, error)
- func (r *EmailQueueRepository) Enqueue(ctx context.Context, input models.EmailQueueInput) (*models.EmailQueueItem, error)
- func (r *EmailQueueRepository) GetNextToProcess(ctx context.Context, limit int) ([]*models.EmailQueueItem, error)
- func (r *EmailQueueRepository) GetQueueStats(ctx context.Context) (*models.EmailQueueStats, error)
- func (r *EmailQueueRepository) GetRetryableEmails(ctx context.Context, limit int) ([]*models.EmailQueueItem, error)
- func (r *EmailQueueRepository) MarkAsFailed(ctx context.Context, id int64, err error, shouldRetry bool) error
- func (r *EmailQueueRepository) MarkAsFailedWithDelay(ctx context.Context, id int64, err error, shouldRetry bool, ...) error
- func (r *EmailQueueRepository) MarkAsSent(ctx context.Context, id int64) error
- type ExpectedSignerRepository
- func (r *ExpectedSignerRepository) AddExpected(ctx context.Context, docID string, contacts []models.ContactInfo, ...) error
- func (r *ExpectedSignerRepository) GetStats(ctx context.Context, docID string) (*models.DocCompletionStats, error)
- func (r *ExpectedSignerRepository) IsExpected(ctx context.Context, docID, email string) (bool, error)
- func (r *ExpectedSignerRepository) ListByDocID(ctx context.Context, docID string) ([]*models.ExpectedSigner, error)
- func (r *ExpectedSignerRepository) ListWithStatusByDocID(ctx context.Context, docID string) ([]*models.ExpectedSignerWithStatus, error)
- func (r *ExpectedSignerRepository) Remove(ctx context.Context, docID, email string) error
- func (r *ExpectedSignerRepository) RemoveAllForDoc(ctx context.Context, docID string) error
- type OAuthSessionRepository
- func (r *OAuthSessionRepository) Create(ctx context.Context, session *models.OAuthSession) error
- func (r *OAuthSessionRepository) DeleteBySessionID(ctx context.Context, sessionID string) error
- func (r *OAuthSessionRepository) DeleteExpired(ctx context.Context, olderThan time.Duration) (int64, error)
- func (r *OAuthSessionRepository) GetBySessionID(ctx context.Context, sessionID string) (*models.OAuthSession, error)
- func (r *OAuthSessionRepository) UpdateRefreshToken(ctx context.Context, sessionID string, encryptedToken []byte, ...) error
- type ReminderRepository
- func (r *ReminderRepository) Count(ctx context.Context) (int, error)
- func (r *ReminderRepository) GetLastReminderByEmail(ctx context.Context, docID, email string) (*models.ReminderLog, error)
- func (r *ReminderRepository) GetReminderCount(ctx context.Context, docID, email string) (int, error)
- func (r *ReminderRepository) GetReminderHistory(ctx context.Context, docID string) ([]*models.ReminderLog, error)
- func (r *ReminderRepository) GetReminderStats(ctx context.Context, docID string) (*models.ReminderStats, error)
- func (r *ReminderRepository) LogReminder(ctx context.Context, log *models.ReminderLog) error
- type SignatureRepository
- func (r *SignatureRepository) CheckUserSignatureStatus(ctx context.Context, docID, userIdentifier string) (bool, error)
- func (r *SignatureRepository) Count(ctx context.Context) (int, error)
- func (r *SignatureRepository) Create(ctx context.Context, signature *models.Signature) error
- func (r *SignatureRepository) ExistsByDocAndUser(ctx context.Context, docID, userSub string) (bool, error)
- func (r *SignatureRepository) GetAllSignaturesOrdered(ctx context.Context) ([]*models.Signature, error)
- func (r *SignatureRepository) GetByDoc(ctx context.Context, docID string) ([]*models.Signature, error)
- func (r *SignatureRepository) GetByDocAndUser(ctx context.Context, docID, userSub string) (*models.Signature, error)
- func (r *SignatureRepository) GetByUserEmail(ctx context.Context, userEmail string) ([]*models.Signature, error)
- func (r *SignatureRepository) GetLastSignature(ctx context.Context, docID string) (*models.Signature, error)
- func (r *SignatureRepository) UpdatePrevHash(ctx context.Context, id int64, prevHash *string) error
- type WebhookDeliveryItem
- type WebhookDeliveryRepository
- func (r *WebhookDeliveryRepository) CleanupOld(ctx context.Context, olderThan time.Duration) (int64, error)
- func (r *WebhookDeliveryRepository) Enqueue(ctx context.Context, input models.WebhookDeliveryInput) (*models.WebhookDelivery, error)
- func (r *WebhookDeliveryRepository) GetNextToProcess(ctx context.Context, limit int) ([]*WebhookDeliveryItem, error)
- func (r *WebhookDeliveryRepository) GetRetryable(ctx context.Context, limit int) ([]*WebhookDeliveryItem, error)
- func (r *WebhookDeliveryRepository) ListByWebhook(ctx context.Context, webhookID int64, limit, offset int) ([]*models.WebhookDelivery, error)
- func (r *WebhookDeliveryRepository) MarkDelivered(ctx context.Context, id int64, responseStatus int, ...) error
- func (r *WebhookDeliveryRepository) MarkFailed(ctx context.Context, id int64, err error, shouldRetry bool) error
- type WebhookRepository
- func (r *WebhookRepository) Count(ctx context.Context) (int, error)
- func (r *WebhookRepository) Create(ctx context.Context, input models.WebhookInput) (*models.Webhook, error)
- func (r *WebhookRepository) Delete(ctx context.Context, id int64) error
- func (r *WebhookRepository) GetByID(ctx context.Context, id int64) (*models.Webhook, error)
- func (r *WebhookRepository) List(ctx context.Context, limit, offset int) ([]*models.Webhook, error)
- func (r *WebhookRepository) ListActiveByEvent(ctx context.Context, event string) ([]*models.Webhook, error)
- func (r *WebhookRepository) SetActive(ctx context.Context, id int64, active bool) error
- func (r *WebhookRepository) Update(ctx context.Context, id int64, input models.WebhookInput) (*models.Webhook, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMagicLinkRepository ¶ added in v1.2.1
func NewMagicLinkRepository(db *sql.DB) services.MagicLinkRepository
Types ¶
type ConfigRepository ¶ added in v1.3.0
type ConfigRepository struct {
// contains filtered or unexported fields
}
func NewConfigRepository ¶ added in v1.3.0
func NewConfigRepository(db *sql.DB, tenants tenant.Provider) *ConfigRepository
func (*ConfigRepository) ClearSeeded ¶ added in v1.3.0
func (r *ConfigRepository) ClearSeeded(ctx context.Context) error
ClearSeeded clears the seeded flag (for reset functionality)
func (*ConfigRepository) DeleteAll ¶ added in v1.3.0
func (r *ConfigRepository) DeleteAll(ctx context.Context) error
DeleteAll removes all configuration for the current tenant (for reset)
func (*ConfigRepository) GetAll ¶ added in v1.3.0
func (r *ConfigRepository) GetAll(ctx context.Context) ([]*models.TenantConfig, error)
GetAll retrieves all configuration sections for the current tenant
func (*ConfigRepository) GetByCategory ¶ added in v1.3.0
func (r *ConfigRepository) GetByCategory(ctx context.Context, category models.ConfigCategory) (*models.TenantConfig, error)
GetByCategory retrieves a configuration section by category
func (*ConfigRepository) GetLatestUpdatedAt ¶ added in v1.3.0
GetLatestUpdatedAt returns the most recent updated_at across all config sections
func (*ConfigRepository) GetTenantID ¶ added in v1.3.0
GetTenantID returns the current tenant ID
func (*ConfigRepository) IsSeeded ¶ added in v1.3.0
func (r *ConfigRepository) IsSeeded(ctx context.Context) (bool, error)
IsSeeded checks if configuration has been seeded from environment variables
func (*ConfigRepository) MarkSeeded ¶ added in v1.3.0
func (r *ConfigRepository) MarkSeeded(ctx context.Context) error
MarkSeeded marks configuration as seeded from environment variables
func (*ConfigRepository) Upsert ¶ added in v1.3.0
func (r *ConfigRepository) Upsert(ctx context.Context, category models.ConfigCategory, config json.RawMessage, secrets []byte, updatedBy string) error
Upsert creates or updates a configuration section
type DocumentRepository ¶
type DocumentRepository struct {
// contains filtered or unexported fields
}
DocumentRepository handles document metadata persistence
func NewDocumentRepository ¶
func NewDocumentRepository(db *sql.DB, tenants tenant.Provider) *DocumentRepository
NewDocumentRepository creates a new DocumentRepository
func (*DocumentRepository) Count ¶ added in v1.2.3
Count returns the total number of documents matching the optional search query (excluding soft-deleted)
func (*DocumentRepository) CountByCreatedBy ¶ added in v1.3.0
func (r *DocumentRepository) CountByCreatedBy(ctx context.Context, createdBy, searchQuery string) (int, error)
CountByCreatedBy returns the total number of documents created by a specific user (excluding soft-deleted)
func (*DocumentRepository) Create ¶
func (r *DocumentRepository) Create(ctx context.Context, docID string, input models.DocumentInput, createdBy string) (*models.Document, error)
Create persists a new document with metadata including optional checksum validation data
func (*DocumentRepository) CreateOrUpdate ¶
func (r *DocumentRepository) CreateOrUpdate(ctx context.Context, docID string, input models.DocumentInput, createdBy string) (*models.Document, error)
CreateOrUpdate performs upsert operation, creating new document or updating existing one atomically
func (*DocumentRepository) Delete ¶
func (r *DocumentRepository) Delete(ctx context.Context, docID string) error
Delete soft-deletes document by setting deleted_at timestamp, preserving metadata and signature history RLS policy automatically filters by tenant_id
func (*DocumentRepository) FindByReference ¶
func (r *DocumentRepository) FindByReference(ctx context.Context, ref string, refType string) (*models.Document, error)
FindByReference searches for a document by reference (URL, path, or doc_id) RLS policy automatically filters by tenant_id
func (*DocumentRepository) GetByDocID ¶
func (r *DocumentRepository) GetByDocID(ctx context.Context, docID string) (*models.Document, error)
GetByDocID retrieves document metadata by document ID (excluding soft-deleted documents) RLS policy automatically filters by tenant_id
func (*DocumentRepository) List ¶
func (r *DocumentRepository) List(ctx context.Context, limit, offset int) ([]*models.Document, error)
List retrieves paginated documents ordered by creation date, newest first (excluding soft-deleted) RLS policy automatically filters by tenant_id
func (*DocumentRepository) ListByCreatedBy ¶ added in v1.3.0
func (r *DocumentRepository) ListByCreatedBy(ctx context.Context, createdBy string, limit, offset int) ([]*models.Document, error)
ListByCreatedBy retrieves paginated documents created by a specific user (excluding soft-deleted) RLS policy automatically filters by tenant_id
func (*DocumentRepository) Search ¶ added in v1.2.3
func (r *DocumentRepository) Search(ctx context.Context, query string, limit, offset int) ([]*models.Document, error)
Search retrieves paginated documents matching the search query (excluding soft-deleted) Searches in doc_id, title, url, and description fields using case-insensitive pattern matching RLS policy automatically filters by tenant_id
func (*DocumentRepository) SearchByCreatedBy ¶ added in v1.3.0
func (r *DocumentRepository) SearchByCreatedBy(ctx context.Context, createdBy, searchQuery string, limit, offset int) ([]*models.Document, error)
SearchByCreatedBy retrieves paginated documents matching search query created by a specific user (excluding soft-deleted) RLS policy automatically filters by tenant_id
type EmailQueueRepository ¶
type EmailQueueRepository struct {
// contains filtered or unexported fields
}
EmailQueueRepository handles database operations for the email queue
func NewEmailQueueRepository ¶
func NewEmailQueueRepository(db *sql.DB, tenants tenant.Provider) *EmailQueueRepository
NewEmailQueueRepository creates a new email queue repository
func (*EmailQueueRepository) CancelEmail ¶
func (r *EmailQueueRepository) CancelEmail(ctx context.Context, id int64) error
CancelEmail cancels a pending email
func (*EmailQueueRepository) CleanupOldEmails ¶
func (r *EmailQueueRepository) CleanupOldEmails(ctx context.Context, olderThan time.Duration) (int64, error)
CleanupOldEmails removes old processed emails from the queue
func (*EmailQueueRepository) Enqueue ¶
func (r *EmailQueueRepository) Enqueue(ctx context.Context, input models.EmailQueueInput) (*models.EmailQueueItem, error)
Enqueue adds a new email to the queue
func (*EmailQueueRepository) GetNextToProcess ¶
func (r *EmailQueueRepository) GetNextToProcess(ctx context.Context, limit int) ([]*models.EmailQueueItem, error)
GetNextToProcess fetches the next email(s) to process from the queue
func (*EmailQueueRepository) GetQueueStats ¶
func (r *EmailQueueRepository) GetQueueStats(ctx context.Context) (*models.EmailQueueStats, error)
GetQueueStats returns statistics about the email queue
func (*EmailQueueRepository) GetRetryableEmails ¶
func (r *EmailQueueRepository) GetRetryableEmails(ctx context.Context, limit int) ([]*models.EmailQueueItem, error)
GetRetryableEmails fetches emails that should be retried
func (*EmailQueueRepository) MarkAsFailed ¶
func (r *EmailQueueRepository) MarkAsFailed(ctx context.Context, id int64, err error, shouldRetry bool) error
MarkAsFailed marks an email as failed with error details This method uses the default PostgreSQL exponential backoff calculation
func (*EmailQueueRepository) MarkAsFailedWithDelay ¶ added in v1.2.3
func (r *EmailQueueRepository) MarkAsFailedWithDelay(ctx context.Context, id int64, err error, shouldRetry bool, retryDelay time.Duration) error
MarkAsFailedWithDelay marks an email as failed with error details and custom retry delay
func (*EmailQueueRepository) MarkAsSent ¶
func (r *EmailQueueRepository) MarkAsSent(ctx context.Context, id int64) error
MarkAsSent marks an email as successfully sent
type ExpectedSignerRepository ¶
type ExpectedSignerRepository struct {
// contains filtered or unexported fields
}
ExpectedSignerRepository handles database operations for expected signers
func NewExpectedSignerRepository ¶
func NewExpectedSignerRepository(db *sql.DB, tenants tenant.Provider) *ExpectedSignerRepository
NewExpectedSignerRepository creates a new expected signer repository
func (*ExpectedSignerRepository) AddExpected ¶
func (r *ExpectedSignerRepository) AddExpected(ctx context.Context, docID string, contacts []models.ContactInfo, addedBy string) error
AddExpected batch-inserts multiple expected signers with conflict-safe deduplication on (doc_id, email)
func (*ExpectedSignerRepository) GetStats ¶
func (r *ExpectedSignerRepository) GetStats(ctx context.Context, docID string) (*models.DocCompletionStats, error)
GetStats calculates signature completion metrics including percentage progress for a document RLS policy automatically filters by tenant_id
func (*ExpectedSignerRepository) IsExpected ¶
func (r *ExpectedSignerRepository) IsExpected(ctx context.Context, docID, email string) (bool, error)
IsExpected efficiently verifies if an email address is in the expected signer list for a document RLS policy automatically filters by tenant_id
func (*ExpectedSignerRepository) ListByDocID ¶
func (r *ExpectedSignerRepository) ListByDocID(ctx context.Context, docID string) ([]*models.ExpectedSigner, error)
ListByDocID retrieves all expected signers for a document, ordered chronologically by when they were added RLS policy automatically filters by tenant_id
func (*ExpectedSignerRepository) ListWithStatusByDocID ¶
func (r *ExpectedSignerRepository) ListWithStatusByDocID(ctx context.Context, docID string) ([]*models.ExpectedSignerWithStatus, error)
ListWithStatusByDocID enriches signer data with signature completion status and reminder tracking metrics RLS policy automatically filters by tenant_id
func (*ExpectedSignerRepository) Remove ¶
func (r *ExpectedSignerRepository) Remove(ctx context.Context, docID, email string) error
Remove deletes a specific expected signer by document ID and email address RLS policy automatically filters by tenant_id
func (*ExpectedSignerRepository) RemoveAllForDoc ¶
func (r *ExpectedSignerRepository) RemoveAllForDoc(ctx context.Context, docID string) error
RemoveAllForDoc purges all expected signers associated with a document in a single operation RLS policy automatically filters by tenant_id
type OAuthSessionRepository ¶
type OAuthSessionRepository struct {
// contains filtered or unexported fields
}
OAuthSessionRepository implements the OAuth session repository
func NewOAuthSessionRepository ¶
func NewOAuthSessionRepository(db *sql.DB, tenants tenant.Provider) *OAuthSessionRepository
NewOAuthSessionRepository creates a new OAuth session repository
func (*OAuthSessionRepository) Create ¶
func (r *OAuthSessionRepository) Create(ctx context.Context, session *models.OAuthSession) error
Create creates a new OAuth session
func (*OAuthSessionRepository) DeleteBySessionID ¶
func (r *OAuthSessionRepository) DeleteBySessionID(ctx context.Context, sessionID string) error
DeleteBySessionID deletes an OAuth session by session ID RLS policy automatically filters by tenant_id
func (*OAuthSessionRepository) DeleteExpired ¶
func (r *OAuthSessionRepository) DeleteExpired(ctx context.Context, olderThan time.Duration) (int64, error)
DeleteExpired deletes OAuth sessions older than the specified duration
func (*OAuthSessionRepository) GetBySessionID ¶
func (r *OAuthSessionRepository) GetBySessionID(ctx context.Context, sessionID string) (*models.OAuthSession, error)
GetBySessionID retrieves an OAuth session by session ID RLS policy automatically filters by tenant_id
func (*OAuthSessionRepository) UpdateRefreshToken ¶
func (r *OAuthSessionRepository) UpdateRefreshToken(ctx context.Context, sessionID string, encryptedToken []byte, expiresAt time.Time) error
UpdateRefreshToken updates the refresh token and expiration time RLS policy automatically filters by tenant_id
type ReminderRepository ¶
type ReminderRepository struct {
// contains filtered or unexported fields
}
ReminderRepository handles database operations for reminder logs
func NewReminderRepository ¶
func NewReminderRepository(db *sql.DB, tenants tenant.Provider) *ReminderRepository
NewReminderRepository creates a new reminder repository
func (*ReminderRepository) Count ¶ added in v1.3.0
func (r *ReminderRepository) Count(ctx context.Context) (int, error)
Count returns the number of sent reminders in the database
func (*ReminderRepository) GetLastReminderByEmail ¶
func (r *ReminderRepository) GetLastReminderByEmail(ctx context.Context, docID, email string) (*models.ReminderLog, error)
GetLastReminderByEmail retrieves the most recent reminder sent to a specific recipient for throttling logic RLS policy automatically filters by tenant_id
func (*ReminderRepository) GetReminderCount ¶
func (r *ReminderRepository) GetReminderCount(ctx context.Context, docID, email string) (int, error)
GetReminderCount tallies successfully delivered reminders to a recipient for rate limiting RLS policy automatically filters by tenant_id
func (*ReminderRepository) GetReminderHistory ¶
func (r *ReminderRepository) GetReminderHistory(ctx context.Context, docID string) ([]*models.ReminderLog, error)
GetReminderHistory retrieves complete reminder audit trail for a document, ordered by send time descending RLS policy automatically filters by tenant_id
func (*ReminderRepository) GetReminderStats ¶
func (r *ReminderRepository) GetReminderStats(ctx context.Context, docID string) (*models.ReminderStats, error)
GetReminderStats aggregates reminder metrics including pending signers and last send timestamp RLS policy automatically filters by tenant_id
func (*ReminderRepository) LogReminder ¶
func (r *ReminderRepository) LogReminder(ctx context.Context, log *models.ReminderLog) error
LogReminder records an email reminder event with delivery status for audit tracking
type SignatureRepository ¶
type SignatureRepository struct {
// contains filtered or unexported fields
}
SignatureRepository handles PostgreSQL persistence for cryptographic signatures
func NewSignatureRepository ¶
func NewSignatureRepository(db *sql.DB, tenants tenant.Provider) *SignatureRepository
NewSignatureRepository initializes a signature repository with the given database connection
func (*SignatureRepository) CheckUserSignatureStatus ¶
func (r *SignatureRepository) CheckUserSignatureStatus(ctx context.Context, docID, userIdentifier string) (bool, error)
CheckUserSignatureStatus verifies if a user has signed, accepting either OAuth subject or email as identifier RLS policy automatically filters by tenant_id
func (*SignatureRepository) Count ¶ added in v1.3.0
func (r *SignatureRepository) Count(ctx context.Context) (int, error)
Count returns the total number of unique signers (distinct email addresses)
func (*SignatureRepository) Create ¶
Create persists a new signature record to PostgreSQL with UNIQUE constraint enforcement on (doc_id, user_sub)
func (*SignatureRepository) ExistsByDocAndUser ¶
func (r *SignatureRepository) ExistsByDocAndUser(ctx context.Context, docID, userSub string) (bool, error)
ExistsByDocAndUser efficiently checks if a signature already exists without retrieving full record data RLS policy automatically filters by tenant_id
func (*SignatureRepository) GetAllSignaturesOrdered ¶
func (r *SignatureRepository) GetAllSignaturesOrdered(ctx context.Context) ([]*models.Signature, error)
GetAllSignaturesOrdered retrieves all signatures in chronological order for chain integrity verification RLS policy automatically filters by tenant_id
func (*SignatureRepository) GetByDoc ¶
func (r *SignatureRepository) GetByDoc(ctx context.Context, docID string) ([]*models.Signature, error)
GetByDoc retrieves all signatures for a specific document, ordered by creation timestamp descending RLS policy automatically filters by tenant_id
func (*SignatureRepository) GetByDocAndUser ¶
func (r *SignatureRepository) GetByDocAndUser(ctx context.Context, docID, userSub string) (*models.Signature, error)
GetByDocAndUser retrieves a specific signature by document ID and user OAuth subject identifier RLS policy automatically filters by tenant_id
func (*SignatureRepository) GetByUserEmail ¶ added in v1.3.0
func (r *SignatureRepository) GetByUserEmail(ctx context.Context, userEmail string) ([]*models.Signature, error)
GetByUserEmail retrieves all signatures created by a specific user (by email), ordered by creation timestamp descending RLS policy automatically filters by tenant_id
func (*SignatureRepository) GetLastSignature ¶
func (r *SignatureRepository) GetLastSignature(ctx context.Context, docID string) (*models.Signature, error)
GetLastSignature retrieves the most recent signature for hash chain linking (returns nil if no signatures exist) RLS policy automatically filters by tenant_id
func (*SignatureRepository) UpdatePrevHash ¶
UpdatePrevHash modifies the previous hash pointer for chain reconstruction operations RLS policy automatically filters by tenant_id
type WebhookDeliveryItem ¶
type WebhookDeliveryItem struct {
ID int64
WebhookID int64
EventType string
EventID string
Payload []byte
Status string
RetryCount int
MaxRetries int
Priority int
ScheduledFor time.Time
TargetURL string
Secret string
CustomHeaders map[string]string
}
Joined view of a delivery with webhook send data
type WebhookDeliveryRepository ¶
type WebhookDeliveryRepository struct {
// contains filtered or unexported fields
}
func NewWebhookDeliveryRepository ¶
func NewWebhookDeliveryRepository(db *sql.DB, tenants tenant.Provider) *WebhookDeliveryRepository
func (*WebhookDeliveryRepository) CleanupOld ¶
func (*WebhookDeliveryRepository) Enqueue ¶
func (r *WebhookDeliveryRepository) Enqueue(ctx context.Context, input models.WebhookDeliveryInput) (*models.WebhookDelivery, error)
func (*WebhookDeliveryRepository) GetNextToProcess ¶
func (r *WebhookDeliveryRepository) GetNextToProcess(ctx context.Context, limit int) ([]*WebhookDeliveryItem, error)
GetNextToProcess fetches deliveries and moves them to processing; joins webhooks data
func (*WebhookDeliveryRepository) GetRetryable ¶
func (r *WebhookDeliveryRepository) GetRetryable(ctx context.Context, limit int) ([]*WebhookDeliveryItem, error)
func (*WebhookDeliveryRepository) ListByWebhook ¶
func (r *WebhookDeliveryRepository) ListByWebhook(ctx context.Context, webhookID int64, limit, offset int) ([]*models.WebhookDelivery, error)
ListByWebhook retrieves paginated webhook deliveries for a specific webhook RLS policy automatically filters by tenant_id
func (*WebhookDeliveryRepository) MarkDelivered ¶
func (*WebhookDeliveryRepository) MarkFailed ¶
type WebhookRepository ¶
type WebhookRepository struct {
// contains filtered or unexported fields
}
func NewWebhookRepository ¶
func NewWebhookRepository(db *sql.DB, tenants tenant.Provider) *WebhookRepository
func (*WebhookRepository) Count ¶ added in v1.3.0
func (r *WebhookRepository) Count(ctx context.Context) (int, error)
Count returns the total number of unique webhooks (distinct target URLs)
func (*WebhookRepository) Create ¶
func (r *WebhookRepository) Create(ctx context.Context, input models.WebhookInput) (*models.Webhook, error)
func (*WebhookRepository) Delete ¶
func (r *WebhookRepository) Delete(ctx context.Context, id int64) error
Delete removes a webhook configuration RLS policy automatically filters by tenant_id
func (*WebhookRepository) GetByID ¶
GetByID retrieves a webhook by its ID RLS policy automatically filters by tenant_id
func (*WebhookRepository) List ¶
List retrieves paginated webhooks RLS policy automatically filters by tenant_id
func (*WebhookRepository) ListActiveByEvent ¶
func (r *WebhookRepository) ListActiveByEvent(ctx context.Context, event string) ([]*models.Webhook, error)
ListActiveByEvent returns active webhooks subscribed to a given event type RLS policy automatically filters by tenant_id