Files
sendico/api/billing/documents/storage/storage.go
2026-01-30 15:16:20 +01:00

33 lines
974 B
Go

package storage
import (
"context"
"github.com/tech/sendico/billing/documents/storage/model"
)
type storageError string
func (e storageError) Error() string {
return string(e)
}
var (
ErrDocumentNotFound = storageError("billing.documents.storage: document record not found")
ErrDuplicateDocument = storageError("billing.documents.storage: duplicate document record")
)
// Repository defines the root storage contract for the billing documents service.
type Repository interface {
Ping(ctx context.Context) error
Documents() DocumentsStore
}
// DocumentsStore exposes persistence operations for document records.
type DocumentsStore interface {
Create(ctx context.Context, record *model.DocumentRecord) error
Update(ctx context.Context, record *model.DocumentRecord) error
GetByPaymentRef(ctx context.Context, paymentRef string) (*model.DocumentRecord, error)
ListByPaymentRefs(ctx context.Context, paymentRefs []string) ([]*model.DocumentRecord, error)
}