Changeset 0.38.1 (#234)

Co-authored-by: gobha <jasafpro@gmail.com>
Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
2026-03-25 11:13:12 +00:00
committed by xcaliber
parent 10acadc9d0
commit 6943c91f40
30 changed files with 2410 additions and 10 deletions

View File

@@ -65,6 +65,7 @@ type Stores struct {
Tickets TicketStore // v0.32.0: WS auth tickets (PG-backed for cross-pod)
RateLimits RateLimitStore // v0.32.0: Distributed rate limiting
Export ExportStore // v0.34.0: Data portability batch reads + GDPR ops
Connections ConnectionStore // v0.38.1: Extension connection credentials
}
// =========================================
@@ -1366,6 +1367,35 @@ type ExportStore interface {
// =========================================
// SHARED TYPES
// =========================================
// CONNECTION STORE (v0.38.1)
// =========================================
type ConnectionStore interface {
Create(ctx context.Context, conn *models.ExtConnection) error
GetByID(ctx context.Context, id string) (*models.ExtConnection, error)
Update(ctx context.Context, id string, patch models.ExtConnectionPatch) error
Delete(ctx context.Context, id string) error
// Scoped queries
ListGlobal(ctx context.Context) ([]models.ExtConnection, error)
ListForTeam(ctx context.Context, teamID string) ([]models.ExtConnection, error)
ListForUser(ctx context.Context, userID string) ([]models.ExtConnection, error)
// Resolution chain: personal → team → global.
// Returns first active connection matching type (and optional name).
// Empty name means "first match". Returns sql.ErrNoRows if not found.
Resolve(ctx context.Context, userID, connType, name string) (*models.ExtConnection, error)
// ResolveAll returns all active connections of the given type accessible
// to the user (personal + team + global).
ResolveAll(ctx context.Context, userID, connType string) ([]models.ExtConnection, error)
// DeleteByIDAndScope deletes a connection only if it matches the given
// scope and owner. Returns rows affected (0 or 1).
DeleteByIDAndScope(ctx context.Context, id, scope, ownerID string) (int64, error)
}
// =========================================
// ListOptions provides standard pagination/sort for list queries.