Documentation
¶
Overview ¶
Package services provides business logic implementations for the Simple Easy Tasks application.
Package services provides business logic and service implementations ¶
Package services provides health monitoring and other service implementations.
Package services provides database migration services.
Package services provides performance monitoring and database optimization services.
Package services provides real-time subscription services for PocketBase with enhanced task event support.
Package services provides access control and rules configuration for PocketBase.
Index ¶
- Constants
- type AuthService
- type BackendStats
- type BoardStatistics
- type BulkCreateRequest
- type BulkCreateTemplate
- type BulkDeleteOptions
- type BulkOperationError
- type BulkOperationService
- type BulkResult
- type BulkTagUpdateRequest
- type BulkTaskOperation
- type CacheBackend
- type CacheConfig
- type CacheManager
- type CacheStats
- type Column
- type CommentService
- type ConnectionPoolConfig
- type ConnectionStats
- type CreateSubscriptionRequest
- type DatabaseOptimizer
- type DuplicationOptions
- type EnhancedRealtimeHealthChecker
- type EnhancedRealtimeService
- func (r *EnhancedRealtimeService) BroadcastTaskEvent(ctx context.Context, event *domain.TaskEvent) error
- func (r *EnhancedRealtimeService) GetRealtimeEndpoint() string
- func (r *EnhancedRealtimeService) GetStats() map[string]interface{}
- func (r *EnhancedRealtimeService) GetSubscriptionURL(collection string) string
- func (r *EnhancedRealtimeService) GetTaskEventEndpoint() string
- func (r *EnhancedRealtimeService) GetTaskSubscriptionURL(projectID string) string
- func (r *EnhancedRealtimeService) SetupRealtimeSubscriptions()
- type EventBroadcaster
- type EventBroadcasterConfig
- type EventBroadcasterHealthChecker
- type EventHandler
- type EventMetrics
- type EventSubscription
- type FileService
- func (fs *FileService) FileAccessMiddleware() func(*core.RequestEvent) error
- func (fs *FileService) GetProtectedFileURL(collectionName string, recordID string, filename string) (string, error)
- func (fs *FileService) ValidateFileAccess(userID string, collectionName string, recordID string) (bool, error)
- type GitHubAuthRequest
- type GitHubAuthResponse
- type GitHubCallbackRequest
- type GitHubCallbackResponse
- type GitHubCommitLinkRepository
- type GitHubIntegrationRepository
- type GitHubIssueMappingRepository
- type GitHubOAuthService
- func (s *GitHubOAuthService) CleanupExpiredStates(ctx context.Context) error
- func (s *GitHubOAuthService) GetUserRepositories(ctx context.Context, accessToken string, page, perPage int) ([]*github.Repository, error)
- func (s *GitHubOAuthService) GetUserToken(ctx context.Context, userID string) (string, error)
- func (s *GitHubOAuthService) HandleCallback(ctx context.Context, userID string, req *GitHubCallbackRequest) (*GitHubCallbackResponse, error)
- func (s *GitHubOAuthService) InitiateAuth(ctx context.Context, req *GitHubAuthRequest) (*GitHubAuthResponse, error)
- func (s *GitHubOAuthService) RefreshToken(ctx context.Context, refreshToken string) (*oauth2.Token, error)
- func (s *GitHubOAuthService) ValidateToken(ctx context.Context, accessToken string) (*github.User, error)
- type GitHubOAuthStateRepository
- type GitHubPRMappingRepository
- type GitHubRateLimiter
- type GitHubService
- func (s *GitHubService) CreateBranchForTask(ctx context.Context, integrationID, _ string, task *domain.Task) error
- func (s *GitHubService) CreateIntegration(ctx context.Context, accessToken string, projectID, userID string, ...) (*domain.GitHubIntegration, error)
- func (s *GitHubService) CreateIssueFromTask(ctx context.Context, integrationID, taskID string, task *domain.Task) (*github.Issue, error)
- func (s *GitHubService) DeleteIntegration(ctx context.Context, id string) error
- func (s *GitHubService) GetCommitsByTaskID(ctx context.Context, taskID string) ([]*domain.GitHubCommitLink, error)
- func (s *GitHubService) GetIntegrationByID(ctx context.Context, id string) (*domain.GitHubIntegration, error)
- func (s *GitHubService) GetIntegrationByProjectID(ctx context.Context, projectID string) (*domain.GitHubIntegration, error)
- func (s *GitHubService) GetPRsByTaskID(ctx context.Context, taskID string) (*domain.GitHubPRMapping, error)
- func (s *GitHubService) LinkCommitToTask(ctx context.Context, ...) error
- func (s *GitHubService) ParseTaskReferencesFromCommit(commitMessage string) []string
- func (s *GitHubService) SyncIssueToTask(ctx context.Context, integrationID string, issueNumber int, taskID string) error
- func (s *GitHubService) UpdateIntegration(ctx context.Context, integration *domain.GitHubIntegration) error
- type GitHubWebhookEventRepository
- type GitHubWebhookService
- type HTTPHealthChecker
- type HealthCheck
- type HealthChecker
- type HealthResponse
- type HealthService
- type HealthServiceInterface
- type HealthStatus
- type IndexAnalysisReport
- type IndexInfo
- type IndexUsageStat
- type IndexUsageStats
- type IntegrityError
- type IntegrityReport
- type IssueCommentEventHandler
- type IssuesEventHandler
- type KanbanBoard
- type KanbanService
- type MemoryCacheBackend
- func (m *MemoryCacheBackend) Delete(_ context.Context, key string) error
- func (m *MemoryCacheBackend) DeletePattern(_ context.Context, pattern string) error
- func (m *MemoryCacheBackend) Exists(_ context.Context, key string) bool
- func (m *MemoryCacheBackend) Flush(_ context.Context) error
- func (m *MemoryCacheBackend) Get(_ context.Context, key string) ([]byte, error)
- func (m *MemoryCacheBackend) Set(_ context.Context, key string, value []byte, ttl time.Duration) error
- func (m *MemoryCacheBackend) Stats(_ context.Context) (*BackendStats, error)
- type MigrationService
- type MoveTaskRequest
- type PerformanceMetrics
- type PerformanceService
- func (p *PerformanceService) GetIndexUsage(_ context.Context) ([]IndexUsageStats, error)
- func (p *PerformanceService) GetPerformanceMetrics(ctx context.Context) (*PerformanceMetrics, error)
- func (p *PerformanceService) GetTableSizes(_ context.Context) (map[string]int64, error)
- func (p *PerformanceService) OptimizeDatabase(_ context.Context) error
- func (p *PerformanceService) ScheduleOptimization(ctx context.Context, interval time.Duration)
- type PocketBaseHealthChecker
- type PocketBaseService
- func (p *PocketBaseService) GetApp() *pocketbase.PocketBase
- func (p *PocketBaseService) Initialize(_ context.Context) error
- func (p *PocketBaseService) SetupAPIPermissions()
- func (p *PocketBaseService) SetupAccessRules() error
- func (p *PocketBaseService) Start(_ context.Context, _ string) error
- func (p *PocketBaseService) Stop(_ context.Context) error
- type PositionManager
- type PositionRequest
- type ProjectRepository
- type ProjectService
- type PullRequestEventHandler
- type PullRequestReviewEventHandler
- type PushEventHandler
- type QueryOptimization
- type QueryOptimizationReport
- type QueryPlan
- type QueryPlanStep
- type RealtimeEventConfig
- type RealtimeEventHandler
- type RealtimeEventService
- func (s *RealtimeEventService) Cleanup()
- func (s *RealtimeEventService) GetMetrics() *EventMetrics
- func (s *RealtimeEventService) GetSubscriptions(_ context.Context, userID string) ([]*EventSubscription, error)
- func (s *RealtimeEventService) PublishTaskEvent(_ context.Context, event *domain.TaskEvent) error
- func (s *RealtimeEventService) RegisterEventHandler(eventType domain.TaskEventType, handler RealtimeEventHandler)
- func (s *RealtimeEventService) SetWebSocketBroadcaster(ws WebSocketBroadcaster)
- func (s *RealtimeEventService) StartCleanupWorker()
- func (s *RealtimeEventService) Subscribe(_ context.Context, req *SubscriptionRequest) (*EventSubscription, error)
- func (s *RealtimeEventService) Unsubscribe(_ context.Context, subscriptionID, userID string) error
- type RealtimeHealthChecker
- type RealtimeService
- type RealtimeTaskService
- type RecommendedIndex
- type RedisCacheBackend
- func (r *RedisCacheBackend) Delete(_ context.Context, _ string) error
- func (r *RedisCacheBackend) DeletePattern(_ context.Context, _ string) error
- func (r *RedisCacheBackend) Exists(_ context.Context, _ string) bool
- func (r *RedisCacheBackend) Flush(_ context.Context) error
- func (r *RedisCacheBackend) Get(_ context.Context, _ string) ([]byte, error)
- func (r *RedisCacheBackend) Set(_ context.Context, _ string, _ []byte, _ time.Duration) error
- func (r *RedisCacheBackend) Stats(_ context.Context) (*BackendStats, error)
- type SlowQuery
- type SubscriptionFilter
- func (f *SubscriptionFilter) Build() map[string]string
- func (f *SubscriptionFilter) ByAssignee(assigneeID string) *SubscriptionFilter
- func (f *SubscriptionFilter) ByStatus(status domain.TaskStatus) *SubscriptionFilter
- func (f *SubscriptionFilter) ByTaskID(taskID string) *SubscriptionFilter
- func (f *SubscriptionFilter) ByUserID(userID string) *SubscriptionFilter
- type SubscriptionManager
- type SubscriptionManagerConfig
- type SubscriptionManagerHealthChecker
- type SubscriptionRequest
- type TableIntegrity
- type TaskService
- type TaskStatus
- type TokenClaims
- type UpdateSubscriptionRequest
- type UserRepository
- type UserService
- type WIPLimits
- type WIPManager
- type WIPOverride
- type WIPOverrideReason
- type WIPStatus
- type WIPViolation
- type WebSocketBroadcaster
- type WebhookEventHandler
Constants ¶
const ( TaskCachePrefix = "task:" BoardCachePrefix = "board:" StatsCachePrefix = "stats:" QueryCachePrefix = "query:" UserTasksCachePrefix = "user_tasks:" // Cache key patterns for invalidation TaskPattern = "task:*" BoardPattern = "board:*" StatsPattern = "stats:*" UserPattern = "user_tasks:*" ProjectPattern = "project:%s:*" // Format with project ID )
Cache key constants and patterns
const ( MinPosition = 1000 // Minimum position value MaxPosition = 999999000 // Maximum position value DefaultIncrement = 1000 // Default increment between positions RebalanceThreshold = 100 // Minimum space before rebalancing )
Position constants for calculation
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface {
// Login authenticates a user and returns JWT tokens.
Login(ctx context.Context, req domain.LoginRequest) (*domain.TokenPair, error)
// Register creates a new user account.
Register(ctx context.Context, req domain.CreateUserRequest) (*domain.User, error)
// RefreshToken generates new tokens using a refresh token.
RefreshToken(ctx context.Context, refreshToken string) (*domain.TokenPair, error)
// ValidateToken validates a JWT token and returns user claims.
ValidateToken(ctx context.Context, tokenString string) (*domain.User, error)
// Logout invalidates tokens (placeholder for future blacklist implementation).
Logout(ctx context.Context, userID string) error
// ForgotPassword initiates the password reset flow.
ForgotPassword(ctx context.Context, email string) error
// ResetPassword resets the user's password using a reset token.
//nolint:gofumpt
ResetPassword(ctx context.Context, token string, newPassword string) error
// InvalidateAllUserTokens invalidates all tokens for a user
InvalidateAllUserTokens(ctx context.Context, userID string) error
}
AuthService defines the interface for authentication operations. Following Interface Segregation Principle.
func NewAuthService ¶
func NewAuthService( userRepo repository.UserRepository, blacklistRepo domain.TokenBlacklistRepository, resetTokenRepo domain.PasswordResetTokenRepository, cfg config.SecurityConfig, ) AuthService
NewAuthService creates a new authentication service.
type BackendStats ¶
type BackendStats struct {
Connected bool `json:"connected"`
Keys int64 `json:"keys"`
Memory int64 `json:"memory_bytes"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
BackendStats provides backend-specific statistics
type BoardStatistics ¶
type BoardStatistics struct {
TotalTasks int `json:"total_tasks"`
TasksByStatus map[domain.TaskStatus]int `json:"tasks_by_status"`
TasksByPriority map[domain.TaskPriority]int `json:"tasks_by_priority"`
OverdueTasks int `json:"overdue_tasks"`
UnassignedTasks int `json:"unassigned_tasks"`
}
BoardStatistics provides analytics about the board state
type BulkCreateRequest ¶
type BulkCreateRequest struct {
ProjectID string `json:"project_id"`
Tasks []domain.CreateTaskRequest `json:"tasks"`
Template *BulkCreateTemplate `json:"template,omitempty"`
}
BulkCreateRequest represents a request to create multiple tasks
type BulkCreateTemplate ¶
type BulkCreateTemplate struct {
TitlePattern string `json:"title_pattern"` // e.g., "Task {index}: {title}"
CommonFields map[string]interface{} `json:"common_fields"` // Fields applied to all tasks
Count int `json:"count"` // Number of tasks to create
StartIndex int `json:"start_index"` // Starting index for numbering
}
BulkCreateTemplate defines a template for bulk task creation
type BulkDeleteOptions ¶
type BulkDeleteOptions struct {
IncludeSubtasks bool `json:"include_subtasks"` // Delete subtasks too
Force bool `json:"force"` // Force delete even if there are dependencies
}
BulkDeleteOptions controls how bulk deletion is performed
type BulkOperationError ¶
type BulkOperationError struct {
TaskID string `json:"task_id,omitempty"`
Index int `json:"index"`
Operation string `json:"operation"`
Error string `json:"error"`
}
BulkOperationError represents an error in a bulk operation
type BulkOperationService ¶
type BulkOperationService interface {
// BulkUpdate performs multiple update operations in a single transaction
BulkUpdate(ctx context.Context, ops []BulkTaskOperation, userID string) (*BulkResult, error)
// BulkCreate creates multiple tasks from a list or CSV data
BulkCreate(ctx context.Context, req BulkCreateRequest, userID string) (*BulkResult, error)
// BulkStatusUpdate updates the status of multiple tasks
BulkStatusUpdate(
ctx context.Context, taskIDs []string, newStatus domain.TaskStatus, userID string,
) (*BulkResult, error)
// BulkAssign assigns multiple tasks to a user
BulkAssign(ctx context.Context, taskIDs []string, assigneeID string, userID string) (*BulkResult, error)
// BulkTagUpdate adds or removes tags from multiple tasks
BulkTagUpdate(ctx context.Context, req BulkTagUpdateRequest, userID string) (*BulkResult, error)
// BulkDelete deletes multiple tasks with cascade handling
BulkDelete(ctx context.Context, taskIDs []string, options BulkDeleteOptions, userID string) (*BulkResult, error)
// ImportFromCSV creates tasks from CSV data
ImportFromCSV(ctx context.Context, csvData io.Reader, projectID string, userID string) (*BulkResult, error)
// ExportToCSV exports tasks to CSV format
ExportToCSV(ctx context.Context, projectID string, filters repository.TaskFilters, userID string) ([]byte, error)
}
BulkOperationService defines the interface for bulk task operations
func NewBulkOperationService ¶
func NewBulkOperationService( taskRepo repository.TaskRepository, projectRepo repository.ProjectRepository, taskService TaskService, ) BulkOperationService
NewBulkOperationService creates a new bulk operation service
type BulkResult ¶
type BulkResult struct {
TotalRequested int `json:"total_requested"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Errors []BulkOperationError `json:"errors,omitempty"`
Results []interface{} `json:"results,omitempty"` // Successful operation results
Duration time.Duration `json:"duration"`
Summary map[string]interface{} `json:"summary,omitempty"`
}
BulkResult represents the result of a bulk operation
type BulkTagUpdateRequest ¶
type BulkTagUpdateRequest struct {
TaskIDs []string `json:"task_ids"`
TagsToAdd []string `json:"tags_to_add,omitempty"`
TagsToRemove []string `json:"tags_to_remove,omitempty"`
ReplaceAll bool `json:"replace_all"` // If true, replace all tags with tags_to_add
}
BulkTagUpdateRequest represents a request to update tags on multiple tasks
type BulkTaskOperation ¶
type BulkTaskOperation struct {
Operation string `json:"operation"` // "update", "delete", "assign", "tag", "status"
TaskIDs []string `json:"task_ids"`
Data map[string]interface{} `json:"data"`
}
BulkTaskOperation represents a single operation in a bulk update
type CacheBackend ¶
type CacheBackend interface {
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
Get(ctx context.Context, key string) ([]byte, error)
Delete(ctx context.Context, key string) error
DeletePattern(ctx context.Context, pattern string) error
Exists(ctx context.Context, key string) bool
Flush(ctx context.Context) error
Stats(ctx context.Context) (*BackendStats, error)
}
CacheBackend defines the interface for cache storage backends
type CacheConfig ¶
type CacheConfig struct {
TaskTTL time.Duration `json:"task_ttl"`
BoardTTL time.Duration `json:"board_ttl"`
StatsTTL time.Duration `json:"stats_ttl"`
QueryTTL time.Duration `json:"query_ttl"`
UserTasksTTL time.Duration `json:"user_tasks_ttl"`
MaxMemory int64 `json:"max_memory_bytes"`
Partitioning bool `json:"partitioning"`
}
CacheConfig configures cache behavior
type CacheManager ¶
type CacheManager interface {
// Task caching
CacheTask(ctx context.Context, task *domain.Task) error
GetCachedTask(ctx context.Context, taskID string) (*domain.Task, error)
InvalidateTask(ctx context.Context, taskID string) error
// Board state caching
CacheBoardState(ctx context.Context, projectID string, board *KanbanBoard) error
GetCachedBoardState(ctx context.Context, projectID string) (*KanbanBoard, error)
InvalidateBoardState(ctx context.Context, projectID string) error
// Query result caching
CacheQueryResult(ctx context.Context, key string, result interface{}, ttl time.Duration) error
GetCachedQueryResult(ctx context.Context, key string, dest interface{}) error
InvalidateQueryPattern(ctx context.Context, pattern string) error
// Statistics caching
CacheStatistics(ctx context.Context, projectID string, stats *BoardStatistics) error
GetCachedStatistics(ctx context.Context, projectID string) (*BoardStatistics, error)
InvalidateStatistics(ctx context.Context, projectID string) error
// User-specific caching
CacheUserTasks(ctx context.Context, userID string, tasks []*domain.Task) error
GetCachedUserTasks(ctx context.Context, userID string) ([]*domain.Task, error)
InvalidateUserCache(ctx context.Context, userID string) error
// Cache management
FlushCache(ctx context.Context) error
GetCacheStats(ctx context.Context) (*CacheStats, error)
}
CacheManager handles caching strategies for improved performance
func NewCacheManager ¶
func NewCacheManager(backend CacheBackend, config CacheConfig) CacheManager
NewCacheManager creates a new cache manager
type CacheStats ¶
type CacheStats struct {
Hits int64 `json:"hits"`
Misses int64 `json:"misses"`
HitRatio float64 `json:"hit_ratio"`
Keys int64 `json:"keys"`
Memory int64 `json:"memory_bytes"`
Evictions int64 `json:"evictions"`
LastFlush *time.Time `json:"last_flush,omitempty"`
AverageLatency time.Duration `json:"average_latency"`
}
CacheStats provides cache performance metrics
type Column ¶
type Column struct {
Status TaskStatus `json:"status"`
Title string `json:"title"`
Tasks []*domain.Task `json:"tasks"`
Count int `json:"count"`
WIP *WIPLimits `json:"wip_limits"`
}
Column represents a single column in the kanban board
type CommentService ¶
type CommentService interface {
// CreateComment creates a new comment on a task
CreateComment(ctx context.Context, req domain.CreateCommentRequest, userID string) (*domain.Comment, error)
// GetComment gets a comment by ID
GetComment(ctx context.Context, commentID string, userID string) (*domain.Comment, error)
// UpdateComment updates a comment
UpdateComment(
ctx context.Context,
commentID string,
req domain.UpdateCommentRequest,
userID string,
) (*domain.Comment, error)
// DeleteComment deletes a comment
DeleteComment(ctx context.Context, commentID string, userID string) error
// ListTaskComments lists comments for a task
ListTaskComments(ctx context.Context, taskID string, userID string, offset, limit int) ([]*domain.Comment, error)
// GetCommentThread gets a comment thread (comment and its replies)
GetCommentThread(ctx context.Context, commentID string, userID string) ([]*domain.Comment, error)
}
CommentService defines the interface for comment-related business logic.
func NewCommentService ¶
func NewCommentService( commentRepo repository.CommentRepository, taskRepo repository.TaskRepository, userRepo repository.UserRepository, ) CommentService
NewCommentService creates a new comment service.
type ConnectionPoolConfig ¶
type ConnectionPoolConfig struct {
MaxOpenConns int `json:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns"`
ConnMaxLifetime time.Duration `json:"conn_max_lifetime"`
ConnMaxIdleTime time.Duration `json:"conn_max_idle_time"`
}
ConnectionPoolConfig configures database connection pooling
type ConnectionStats ¶
type ConnectionStats struct {
OpenConnections int `json:"open_connections"`
InUseConnections int `json:"in_use_connections"`
IdleConnections int `json:"idle_connections"`
WaitCount int64 `json:"wait_count"`
WaitDuration time.Duration `json:"wait_duration"`
MaxIdleClosed int64 `json:"max_idle_closed"`
MaxLifetimeClosed int64 `json:"max_lifetime_closed"`
}
ConnectionStats provides connection pool statistics
type CreateSubscriptionRequest ¶
type CreateSubscriptionRequest struct {
UserID string `json:"user_id" binding:"required"`
ProjectID *string `json:"project_id,omitempty"`
EventTypes []domain.TaskEventType `json:"event_types" binding:"required,min=1"`
Filters map[string]string `json:"filters,omitempty"`
}
CreateSubscriptionRequest represents a request to create a new subscription
func (*CreateSubscriptionRequest) Validate ¶
func (r *CreateSubscriptionRequest) Validate() error
Validate validates the create subscription request
type DatabaseOptimizer ¶
type DatabaseOptimizer interface {
// Index management
AnalyzeIndexUsage(ctx context.Context) (*IndexAnalysisReport, error)
CreateRecommendedIndexes(ctx context.Context) error
OptimizeQueries(ctx context.Context) (*QueryOptimizationReport, error)
// Performance monitoring
GetSlowQueries(ctx context.Context, threshold time.Duration) ([]*SlowQuery, error)
AnalyzeQueryPlan(ctx context.Context, query string, args []interface{}) (*QueryPlan, error)
// Connection optimization
OptimizeConnectionPool(ctx context.Context, config *ConnectionPoolConfig) error
GetConnectionStats(ctx context.Context) (*ConnectionStats, error)
// Maintenance operations
RunVacuum(ctx context.Context, tables []string) error
UpdateTableStatistics(ctx context.Context, tables []string) error
CheckTableIntegrity(ctx context.Context) (*IntegrityReport, error)
}
DatabaseOptimizer handles database performance optimization
func NewDatabaseOptimizer ¶
func NewDatabaseOptimizer(db *sql.DB) DatabaseOptimizer
NewDatabaseOptimizer creates a new database optimizer
type DuplicationOptions ¶
type DuplicationOptions struct {
NewTitle string `json:"new_title,omitempty"`
IncludeSubtasks bool `json:"include_subtasks"`
IncludeComments bool `json:"include_comments"`
IncludeAttachments bool `json:"include_attachments"`
ResetProgress bool `json:"reset_progress"`
ResetTimeSpent bool `json:"reset_time_spent"`
}
DuplicationOptions controls how a task is duplicated
type EnhancedRealtimeHealthChecker ¶
type EnhancedRealtimeHealthChecker struct {
// contains filtered or unexported fields
}
EnhancedRealtimeHealthChecker checks the health of the enhanced real-time service
func NewEnhancedRealtimeHealthChecker ¶
func NewEnhancedRealtimeHealthChecker(service *EnhancedRealtimeService) *EnhancedRealtimeHealthChecker
NewEnhancedRealtimeHealthChecker creates a health checker for enhanced real-time functionality
func (*EnhancedRealtimeHealthChecker) Check ¶
func (h *EnhancedRealtimeHealthChecker) Check(_ context.Context) HealthCheck
Check performs the enhanced real-time health check
func (*EnhancedRealtimeHealthChecker) Name ¶
func (h *EnhancedRealtimeHealthChecker) Name() string
Name returns the checker name
type EnhancedRealtimeService ¶
type EnhancedRealtimeService struct {
// contains filtered or unexported fields
}
EnhancedRealtimeService provides comprehensive real-time functionality integrating with PocketBase's built-in real-time capabilities and our custom event system
func NewEnhancedRealtimeService ¶
func NewEnhancedRealtimeService( pbService *PocketBaseService, eventBroadcaster EventBroadcaster, subscriptionMgr SubscriptionManager, logger *slog.Logger, ) *EnhancedRealtimeService
NewEnhancedRealtimeService creates a new enhanced realtime service
func (*EnhancedRealtimeService) BroadcastTaskEvent ¶
func (r *EnhancedRealtimeService) BroadcastTaskEvent(ctx context.Context, event *domain.TaskEvent) error
BroadcastTaskEvent broadcasts a task event through both PocketBase and custom systems
func (*EnhancedRealtimeService) GetRealtimeEndpoint ¶
func (r *EnhancedRealtimeService) GetRealtimeEndpoint() string
GetRealtimeEndpoint returns the real-time subscription endpoint
func (*EnhancedRealtimeService) GetStats ¶
func (r *EnhancedRealtimeService) GetStats() map[string]interface{}
GetStats returns real-time service statistics
func (*EnhancedRealtimeService) GetSubscriptionURL ¶
func (r *EnhancedRealtimeService) GetSubscriptionURL(collection string) string
GetSubscriptionURL returns the subscription URL for a specific collection
func (*EnhancedRealtimeService) GetTaskEventEndpoint ¶
func (r *EnhancedRealtimeService) GetTaskEventEndpoint() string
GetTaskEventEndpoint returns the endpoint for task-specific events
func (*EnhancedRealtimeService) GetTaskSubscriptionURL ¶
func (r *EnhancedRealtimeService) GetTaskSubscriptionURL(projectID string) string
GetTaskSubscriptionURL returns the subscription URL for task events
func (*EnhancedRealtimeService) SetupRealtimeSubscriptions ¶
func (r *EnhancedRealtimeService) SetupRealtimeSubscriptions()
SetupRealtimeSubscriptions configures real-time subscriptions for live updates.
type EventBroadcaster ¶
type EventBroadcaster interface {
// BroadcastEvent broadcasts a task event to all relevant subscribers
BroadcastEvent(ctx context.Context, event *domain.TaskEvent) error
// Subscribe adds a new event subscription
Subscribe(ctx context.Context, subscription *domain.EventSubscription) error
// Unsubscribe removes an event subscription
Unsubscribe(ctx context.Context, subscriptionID string) error
// GetSubscription retrieves a subscription by ID
GetSubscription(ctx context.Context, subscriptionID string) (*domain.EventSubscription, error)
// GetUserSubscriptions retrieves all subscriptions for a user
GetUserSubscriptions(ctx context.Context, userID string) ([]*domain.EventSubscription, error)
// GetActiveSubscriptionCount returns the number of active subscriptions
GetActiveSubscriptionCount() int
// Cleanup removes inactive or expired subscriptions
Cleanup(ctx context.Context) error
}
EventBroadcaster defines the interface for broadcasting task events to subscribed clients
func NewEventBroadcaster ¶
func NewEventBroadcaster(pbService *PocketBaseService, config EventBroadcasterConfig) EventBroadcaster
NewEventBroadcaster creates a new event broadcaster service
type EventBroadcasterConfig ¶
type EventBroadcasterConfig struct {
MaxSubscriptionsPerUser int // Maximum subscriptions per user (default: 10)
SubscriptionTimeout time.Duration // Timeout for inactive subscriptions (default: 1 hour)
EventQueueSize int // Size of event queue per subscription (default: 100)
Logger *slog.Logger // Logger instance
}
EventBroadcasterConfig holds configuration for the event broadcaster
type EventBroadcasterHealthChecker ¶
type EventBroadcasterHealthChecker struct {
// contains filtered or unexported fields
}
EventBroadcasterHealthChecker provides health checking for the event broadcaster
func NewEventBroadcasterHealthChecker ¶
func NewEventBroadcasterHealthChecker(broadcaster EventBroadcaster) *EventBroadcasterHealthChecker
NewEventBroadcasterHealthChecker creates a health checker for the event broadcaster
func (*EventBroadcasterHealthChecker) Check ¶
func (h *EventBroadcasterHealthChecker) Check(_ context.Context) HealthCheck
Check performs the event broadcaster health check
func (*EventBroadcasterHealthChecker) Name ¶
func (h *EventBroadcasterHealthChecker) Name() string
Name returns the checker name
type EventHandler ¶
type EventHandler func(event *domain.TaskEvent, subscription *domain.EventSubscription) error
EventHandler is a callback function for processing events
type EventMetrics ¶
type EventMetrics struct {
EventsProcessed int64 `json:"events_processed"`
EventsByType map[domain.TaskEventType]int64 `json:"events_by_type"`
ActiveSubscriptions int `json:"active_subscriptions"`
SubscriptionsByType map[domain.TaskEventType]int `json:"subscriptions_by_type"`
AverageProcessingTime time.Duration `json:"average_processing_time"`
ErrorCount int64 `json:"error_count"`
LastEventTime time.Time `json:"last_event_time"`
WebSocketConnections int `json:"websocket_connections"`
}
EventMetrics tracks event system performance
type EventSubscription ¶
type EventSubscription struct {
ID string `json:"id"`
UserID string `json:"user_id"`
ProjectID string `json:"project_id,omitempty"`
EventTypes []domain.TaskEventType `json:"event_types"`
Filters map[string]interface{} `json:"filters,omitempty"`
Channel chan *domain.TaskEvent `json:"-"`
CreatedAt time.Time `json:"created_at"`
LastEvent *time.Time `json:"last_event,omitempty"`
Active bool `json:"active"`
}
EventSubscription represents an active event subscription
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
FileService handles file operations with PocketBase
func NewFileService ¶
func NewFileService(app *pocketbase.PocketBase) *FileService
NewFileService creates a new file service
func (*FileService) FileAccessMiddleware ¶
func (fs *FileService) FileAccessMiddleware() func(*core.RequestEvent) error
FileAccessMiddleware creates middleware for validating file access
func (*FileService) GetProtectedFileURL ¶
func (fs *FileService) GetProtectedFileURL(collectionName string, recordID string, filename string) (string, error)
GetProtectedFileURL generates a signed URL for a protected file This URL includes a token that allows temporary access to the protected file
func (*FileService) ValidateFileAccess ¶
func (fs *FileService) ValidateFileAccess(userID string, collectionName string, recordID string) (bool, error)
ValidateFileAccess checks if a user has access to a file
type GitHubAuthRequest ¶
type GitHubAuthRequest struct {
UserID string `json:"user_id"`
ProjectID *string `json:"project_id,omitempty"`
}
GitHubAuthRequest contains data needed to initiate OAuth flow
type GitHubAuthResponse ¶
GitHubAuthResponse contains the OAuth authorization URL
type GitHubCallbackRequest ¶
GitHubCallbackRequest contains data from OAuth callback
type GitHubCallbackResponse ¶
type GitHubCallbackResponse struct {
User *github.User `json:"user"`
Emails []*github.UserEmail `json:"emails"`
ProjectID *string `json:"project_id,omitempty"`
}
GitHubCallbackResponse contains the result of OAuth callback processing
type GitHubCommitLinkRepository ¶
type GitHubCommitLinkRepository interface {
Create(ctx context.Context, link *domain.GitHubCommitLink) error
GetByTaskID(ctx context.Context, taskID string) ([]*domain.GitHubCommitLink, error)
GetByCommitSHA(ctx context.Context, integrationID, commitSHA string) (*domain.GitHubCommitLink, error)
ListByIntegration(ctx context.Context, integrationID string) ([]*domain.GitHubCommitLink, error)
Delete(ctx context.Context, id string) error
}
GitHubCommitLinkRepository defines methods for GitHub commit link data persistence
type GitHubIntegrationRepository ¶
type GitHubIntegrationRepository interface {
Create(ctx context.Context, integration *domain.GitHubIntegration) error
GetByID(ctx context.Context, id string) (*domain.GitHubIntegration, error)
GetByProjectID(ctx context.Context, projectID string) (*domain.GitHubIntegration, error)
GetByRepoFullName(ctx context.Context, owner, name string) (*domain.GitHubIntegration, error)
Update(ctx context.Context, integration *domain.GitHubIntegration) error
Delete(ctx context.Context, id string) error
List(ctx context.Context, userID string) ([]*domain.GitHubIntegration, error)
}
GitHubIntegrationRepository defines methods for GitHub integration data persistence
type GitHubIssueMappingRepository ¶
type GitHubIssueMappingRepository interface {
Create(ctx context.Context, mapping *domain.GitHubIssueMapping) error
GetByTaskID(ctx context.Context, taskID string) (*domain.GitHubIssueMapping, error)
GetByIssueNumber(ctx context.Context, integrationID string, issueNumber int) (*domain.GitHubIssueMapping, error)
Update(ctx context.Context, mapping *domain.GitHubIssueMapping) error
Delete(ctx context.Context, id string) error
ListByIntegration(ctx context.Context, integrationID string) ([]*domain.GitHubIssueMapping, error)
}
type GitHubOAuthService ¶
type GitHubOAuthService struct {
// contains filtered or unexported fields
}
GitHubOAuthService handles GitHub OAuth2 authentication
func NewGitHubOAuthService ¶
func NewGitHubOAuthService( clientID, clientSecret, redirectURL string, stateStore GitHubOAuthStateRepository, authSessionRepo repository.GitHubAuthSessionRepository, userService UserService, ) *GitHubOAuthService
NewGitHubOAuthService creates a new GitHub OAuth service
func (*GitHubOAuthService) CleanupExpiredStates ¶
func (s *GitHubOAuthService) CleanupExpiredStates(ctx context.Context) error
CleanupExpiredStates removes expired OAuth states
func (*GitHubOAuthService) GetUserRepositories ¶
func (s *GitHubOAuthService) GetUserRepositories(ctx context.Context, accessToken string, page, perPage int) ([]*github.Repository, error)
GetUserRepositories gets repositories accessible to the user
func (*GitHubOAuthService) GetUserToken ¶
GetUserToken retrieves the stored GitHub token for a user
func (*GitHubOAuthService) HandleCallback ¶
func (s *GitHubOAuthService) HandleCallback(ctx context.Context, userID string, req *GitHubCallbackRequest) (*GitHubCallbackResponse, error)
HandleCallback processes the OAuth callback
func (*GitHubOAuthService) InitiateAuth ¶
func (s *GitHubOAuthService) InitiateAuth(ctx context.Context, req *GitHubAuthRequest) (*GitHubAuthResponse, error)
InitiateAuth starts the GitHub OAuth flow
func (*GitHubOAuthService) RefreshToken ¶
func (s *GitHubOAuthService) RefreshToken(ctx context.Context, refreshToken string) (*oauth2.Token, error)
RefreshToken is not supported for GitHub OAuth Apps as they don't issue refresh tokens GitHub OAuth Apps tokens do not expire, so refresh is not needed For GitHub App installations, use installation tokens instead
func (*GitHubOAuthService) ValidateToken ¶
func (s *GitHubOAuthService) ValidateToken(ctx context.Context, accessToken string) (*github.User, error)
ValidateToken validates a GitHub access token
type GitHubOAuthStateRepository ¶
type GitHubOAuthStateRepository interface {
Create(ctx context.Context, state *domain.GitHubOAuthState) error
GetByState(ctx context.Context, state string) (*domain.GitHubOAuthState, error)
DeleteByState(ctx context.Context, state string) error
CleanupExpired(ctx context.Context) error
}
GitHubOAuthStateRepository defines the interface for storing OAuth states
type GitHubPRMappingRepository ¶
type GitHubPRMappingRepository interface {
Create(ctx context.Context, mapping *domain.GitHubPRMapping) error
GetByTaskID(ctx context.Context, taskID string) (*domain.GitHubPRMapping, error)
GetByPRNumber(ctx context.Context, integrationID string, prNumber int) (*domain.GitHubPRMapping, error)
Update(ctx context.Context, mapping *domain.GitHubPRMapping) error
Delete(ctx context.Context, id string) error
ListByIntegration(ctx context.Context, integrationID string) ([]*domain.GitHubPRMapping, error)
}
type GitHubRateLimiter ¶
type GitHubRateLimiter struct {
// contains filtered or unexported fields
}
GitHubRateLimiter handles GitHub API rate limiting
type GitHubService ¶
type GitHubService struct {
// contains filtered or unexported fields
}
GitHubService provides GitHub API integration with rate limiting
func NewGitHubService ¶
func NewGitHubService( integrationRepo GitHubIntegrationRepository, issueMappingRepo GitHubIssueMappingRepository, commitLinkRepo GitHubCommitLinkRepository, prMappingRepo GitHubPRMappingRepository, webhookSecret string, ) *GitHubService
NewGitHubService creates a new GitHub service
func (*GitHubService) CreateBranchForTask ¶
func (s *GitHubService) CreateBranchForTask(ctx context.Context, integrationID, _ string, task *domain.Task) error
CreateBranchForTask creates a branch for a task
func (*GitHubService) CreateIntegration ¶
func (s *GitHubService) CreateIntegration(ctx context.Context, accessToken string, projectID, userID string, repoOwner, repoName string) (*domain.GitHubIntegration, error)
CreateIntegration creates a new GitHub integration
func (*GitHubService) CreateIssueFromTask ¶
func (s *GitHubService) CreateIssueFromTask(ctx context.Context, integrationID, taskID string, task *domain.Task) (*github.Issue, error)
CreateIssueFromTask creates a GitHub issue from a task
func (*GitHubService) DeleteIntegration ¶
func (s *GitHubService) DeleteIntegration(ctx context.Context, id string) error
DeleteIntegration deletes a GitHub integration
func (*GitHubService) GetCommitsByTaskID ¶
func (s *GitHubService) GetCommitsByTaskID(ctx context.Context, taskID string) ([]*domain.GitHubCommitLink, error)
GetCommitsByTaskID retrieves commits linked to a task
func (*GitHubService) GetIntegrationByID ¶
func (s *GitHubService) GetIntegrationByID(ctx context.Context, id string) (*domain.GitHubIntegration, error)
GetIntegrationByID retrieves a GitHub integration by ID
func (*GitHubService) GetIntegrationByProjectID ¶
func (s *GitHubService) GetIntegrationByProjectID(ctx context.Context, projectID string) (*domain.GitHubIntegration, error)
GetIntegrationByProjectID retrieves a GitHub integration by project ID
func (*GitHubService) GetPRsByTaskID ¶
func (s *GitHubService) GetPRsByTaskID(ctx context.Context, taskID string) (*domain.GitHubPRMapping, error)
GetPRsByTaskID retrieves pull requests linked to a task
func (*GitHubService) LinkCommitToTask ¶
func (s *GitHubService) LinkCommitToTask(ctx context.Context, integrationID, taskID, commitSHA, commitMessage, commitURL, authorLogin string) error
LinkCommitToTask links a commit to a task based on commit message references
func (*GitHubService) ParseTaskReferencesFromCommit ¶
func (s *GitHubService) ParseTaskReferencesFromCommit(commitMessage string) []string
ParseTaskReferencesFromCommit extracts task references from commit messages
func (*GitHubService) SyncIssueToTask ¶
func (s *GitHubService) SyncIssueToTask(ctx context.Context, integrationID string, issueNumber int, taskID string) error
SyncIssueToTask synchronizes a GitHub issue with a task
func (*GitHubService) UpdateIntegration ¶
func (s *GitHubService) UpdateIntegration(ctx context.Context, integration *domain.GitHubIntegration) error
UpdateIntegration updates a GitHub integration
type GitHubWebhookEventRepository ¶
type GitHubWebhookEventRepository interface {
Create(ctx context.Context, event *domain.GitHubWebhookEvent) error
GetByID(ctx context.Context, id string) (*domain.GitHubWebhookEvent, error)
MarkProcessed(ctx context.Context, id string, processedAt time.Time) error
MarkError(ctx context.Context, id string, errorMsg string) error
ListUnprocessed(ctx context.Context, limit int) ([]*domain.GitHubWebhookEvent, error)
CleanupOld(ctx context.Context, olderThan time.Time) error
}
GitHubWebhookEventRepository manages webhook event persistence
type GitHubWebhookService ¶
type GitHubWebhookService struct {
// contains filtered or unexported fields
}
GitHubWebhookService handles GitHub webhook events
func NewGitHubWebhookService ¶
func NewGitHubWebhookService( secret string, allowUnsigned bool, integrationRepo GitHubIntegrationRepository, webhookEventRepo GitHubWebhookEventRepository, githubService *GitHubService, taskService TaskService, ) *GitHubWebhookService
NewGitHubWebhookService creates a new webhook service
func (*GitHubWebhookService) HandleWebhook ¶
func (s *GitHubWebhookService) HandleWebhook(w http.ResponseWriter, r *http.Request)
HandleWebhook processes incoming webhook requests
func (*GitHubWebhookService) RegisterHandler ¶
func (s *GitHubWebhookService) RegisterHandler(handler WebhookEventHandler)
RegisterHandler registers a webhook event handler
type HTTPHealthChecker ¶
type HTTPHealthChecker struct {
// contains filtered or unexported fields
}
HTTPHealthChecker checks HTTP endpoints.
func NewHTTPHealthChecker ¶
func NewHTTPHealthChecker(name, url string, timeout time.Duration, expectedStatus int) *HTTPHealthChecker
NewHTTPHealthChecker creates a new HTTP health checker.
func (*HTTPHealthChecker) Check ¶
func (h *HTTPHealthChecker) Check(ctx context.Context) HealthCheck
Check performs the HTTP health check
func (*HTTPHealthChecker) Name ¶
func (h *HTTPHealthChecker) Name() string
Name returns the checker name.
type HealthCheck ¶
type HealthCheck struct {
LastChecked time.Time `json:"last_checked"`
Details map[string]interface{} `json:"details,omitempty"`
Name string `json:"name"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
Status HealthStatus `json:"status"`
Duration time.Duration `json:"duration"`
}
HealthCheck represents a single health check.
type HealthChecker ¶
type HealthChecker interface {
Check(ctx context.Context) HealthCheck
Name() string
}
HealthChecker defines the interface for health checkers.
type HealthResponse ¶
type HealthResponse struct {
Timestamp time.Time `json:"timestamp"`
System map[string]interface{} `json:"system"`
Version string `json:"version"`
Environment string `json:"environment"`
Status HealthStatus `json:"status"`
Checks []HealthCheck `json:"checks"`
Uptime time.Duration `json:"uptime"`
}
HealthResponse represents the overall health response.
type HealthService ¶
type HealthService struct {
// contains filtered or unexported fields
}
HealthService manages health checks for the application.
func (*HealthService) Check ¶
func (h *HealthService) Check(ctx context.Context) HealthResponse
Check performs all health checks and returns the overall health status.
func (*HealthService) Liveness ¶
func (h *HealthService) Liveness() HealthResponse
Liveness returns a simple liveness probe (application is running).
func (*HealthService) Readiness ¶
func (h *HealthService) Readiness(ctx context.Context) HealthResponse
Readiness returns readiness probe (application is ready to serve traffic).
func (*HealthService) RegisterChecker ¶
func (h *HealthService) RegisterChecker(checker HealthChecker)
RegisterChecker registers a health checker.
type HealthServiceInterface ¶
type HealthServiceInterface interface {
Check(ctx context.Context) HealthResponse
Liveness() HealthResponse
Readiness(ctx context.Context) HealthResponse
RegisterChecker(checker HealthChecker)
}
HealthServiceInterface defines the contract for health services.
func NewHealthService ¶
func NewHealthService(_ interface{}) HealthServiceInterface
NewHealthService creates a new health service.
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the health status of a component.
const ( // HealthStatusHealthy indicates the component is fully operational. HealthStatusHealthy HealthStatus = "healthy" // HealthStatusUnhealthy indicates the component is not operational. HealthStatusUnhealthy HealthStatus = "unhealthy" // HealthStatusDegraded indicates the component has issues but is still functional. HealthStatusDegraded HealthStatus = "degraded" )
type IndexAnalysisReport ¶
type IndexAnalysisReport struct {
Timestamp time.Time `json:"timestamp"`
UnusedIndexes []IndexInfo `json:"unused_indexes"`
MissingIndexes []RecommendedIndex `json:"missing_indexes"`
IndexUsageStats []IndexUsageStat `json:"index_usage_stats"`
Recommendations []string `json:"recommendations"`
TotalIndexes int `json:"total_indexes"`
TotalSize int64 `json:"total_size_bytes"`
}
IndexAnalysisReport contains index usage analysis
type IndexInfo ¶
type IndexInfo struct {
Name string `json:"name"`
Table string `json:"table"`
Columns string `json:"columns"`
Unique bool `json:"unique"`
Size int64 `json:"size_bytes"`
LastUsed *time.Time `json:"last_used,omitempty"`
UsageCount int64 `json:"usage_count"`
}
IndexInfo represents database index information
type IndexUsageStat ¶
type IndexUsageStat struct {
IndexName string `json:"index_name"`
Table string `json:"table"`
SeeksCount int64 `json:"seeks_count"`
ScansCount int64 `json:"scans_count"`
LastSeek *time.Time `json:"last_seek,omitempty"`
LastScan *time.Time `json:"last_scan,omitempty"`
Efficiency float64 `json:"efficiency"` // seeks/(seeks+scans)
}
IndexUsageStat represents index usage statistics
type IndexUsageStats ¶
type IndexUsageStats struct {
IndexName string `json:"index_name"`
TableName string `json:"table_name"`
Definition string `json:"definition"`
UsageCount int64 `json:"usage_count,omitempty"`
}
IndexUsageStats represents index usage statistics
type IntegrityError ¶
type IntegrityError struct {
Table string `json:"table"`
Type string `json:"type"` // "corruption", "constraint", "foreign_key", etc.
Description string `json:"description"`
Severity string `json:"severity"` // "critical", "warning", "info"
}
IntegrityError represents a database integrity error
type IntegrityReport ¶
type IntegrityReport struct {
Timestamp time.Time `json:"timestamp"`
Tables []TableIntegrity `json:"tables"`
Errors []IntegrityError `json:"errors"`
Warnings []string `json:"warnings"`
TotalTables int `json:"total_tables"`
ErrorCount int `json:"error_count"`
WarningCount int `json:"warning_count"`
}
IntegrityReport contains database integrity check results
type IssueCommentEventHandler ¶
type IssueCommentEventHandler struct {
// contains filtered or unexported fields
}
IssueCommentEventHandler handles issue comment events
func (*IssueCommentEventHandler) EventType ¶
func (h *IssueCommentEventHandler) EventType() string
EventType returns the GitHub event type this handler processes
func (*IssueCommentEventHandler) Handle ¶
func (h *IssueCommentEventHandler) Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
Handle processes GitHub issue comment events
type IssuesEventHandler ¶
type IssuesEventHandler struct {
// contains filtered or unexported fields
}
IssuesEventHandler handles issue events
func (*IssuesEventHandler) EventType ¶
func (h *IssuesEventHandler) EventType() string
EventType returns the GitHub event type this handler processes
func (*IssuesEventHandler) Handle ¶
func (h *IssuesEventHandler) Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
Handle processes GitHub issue events and manages issue-task mappings
type KanbanBoard ¶
type KanbanBoard struct {
ProjectID string `json:"project_id"`
Columns map[domain.TaskStatus]*Column `json:"columns"`
Stats *BoardStatistics `json:"stats"`
UpdatedAt time.Time `json:"updated_at"`
}
KanbanBoard represents the complete kanban board state
type KanbanService ¶
type KanbanService interface {
// GetBoard retrieves the complete kanban board for a project
GetBoard(ctx context.Context, projectID string, userID string) (*KanbanBoard, error)
// MoveTask moves a task between columns with position management
MoveTask(ctx context.Context, req MoveTaskRequest, userID string) error
// UpdateWIPLimits updates work-in-progress limits for a column
UpdateWIPLimits(ctx context.Context, projectID string, status domain.TaskStatus, limits WIPLimits, userID string) error
// GetBoardStatistics returns analytics for the board
GetBoardStatistics(ctx context.Context, projectID string, userID string) (*BoardStatistics, error)
// ValidateMove checks if a move is allowed based on WIP limits and business rules
ValidateMove(ctx context.Context, req MoveTaskRequest, userID string) error
}
KanbanService defines the interface for kanban board operations
func NewKanbanService ¶
func NewKanbanService( taskRepo repository.TaskRepository, projectRepo repository.ProjectRepository, taskService TaskService, ) KanbanService
NewKanbanService creates a new kanban service
type MemoryCacheBackend ¶
type MemoryCacheBackend struct {
// contains filtered or unexported fields
}
MemoryCacheBackend implements CacheBackend using in-memory storage This is a simple implementation for development/testing
func NewMemoryCacheBackend ¶
func NewMemoryCacheBackend(prefix string) *MemoryCacheBackend
NewMemoryCacheBackend creates a new in-memory cache backend
func (*MemoryCacheBackend) Delete ¶
func (m *MemoryCacheBackend) Delete(_ context.Context, key string) error
Delete removes a key from memory
func (*MemoryCacheBackend) DeletePattern ¶
func (m *MemoryCacheBackend) DeletePattern(_ context.Context, pattern string) error
DeletePattern deletes keys matching a pattern (simple implementation)
func (*MemoryCacheBackend) Exists ¶
func (m *MemoryCacheBackend) Exists(_ context.Context, key string) bool
Exists checks if a key exists in memory
func (*MemoryCacheBackend) Flush ¶
func (m *MemoryCacheBackend) Flush(_ context.Context) error
Flush clears all keys with the prefix
func (*MemoryCacheBackend) Set ¶
func (m *MemoryCacheBackend) Set(_ context.Context, key string, value []byte, ttl time.Duration) error
Set stores a value in memory with TTL
func (*MemoryCacheBackend) Stats ¶
func (m *MemoryCacheBackend) Stats(_ context.Context) (*BackendStats, error)
Stats returns memory cache statistics
type MigrationService ¶
type MigrationService struct {
// contains filtered or unexported fields
}
MigrationService handles database migrations
func NewMigrationService ¶
func NewMigrationService(pbService *PocketBaseService) *MigrationService
NewMigrationService creates a new migration service
func (*MigrationService) CreateMigrationFile ¶
func (m *MigrationService) CreateMigrationFile(name, migrationsDir string) error
CreateMigrationFile creates a new migration file template
func (*MigrationService) RegisterMigrations ¶
func (m *MigrationService) RegisterMigrations()
RegisterMigrations registers all migrations with PocketBase
type MoveTaskRequest ¶
type MoveTaskRequest struct {
TaskID string `json:"task_id" binding:"required"`
ProjectID string `json:"project_id" binding:"required"`
NewStatus domain.TaskStatus `json:"new_status" binding:"required"`
NewPosition int `json:"new_position" binding:"min=0"`
}
MoveTaskRequest represents a request to move a task between columns/statuses
type PerformanceMetrics ¶
type PerformanceMetrics struct {
LastOptimized time.Time `json:"last_optimized"`
TableSizes map[string]int64 `json:"table_sizes"`
RecordCounts map[string]int64 `json:"record_counts"`
IndexStats []IndexUsageStats `json:"index_stats"`
TotalSize int64 `json:"total_size"`
}
PerformanceMetrics holds various performance metrics
type PerformanceService ¶
type PerformanceService struct {
// contains filtered or unexported fields
}
PerformanceService handles database performance optimizations
func NewPerformanceService ¶
func NewPerformanceService(pbService *PocketBaseService) *PerformanceService
NewPerformanceService creates a new performance service
func (*PerformanceService) GetIndexUsage ¶
func (p *PerformanceService) GetIndexUsage(_ context.Context) ([]IndexUsageStats, error)
GetIndexUsage returns information about index usage
func (*PerformanceService) GetPerformanceMetrics ¶
func (p *PerformanceService) GetPerformanceMetrics(ctx context.Context) (*PerformanceMetrics, error)
GetPerformanceMetrics returns comprehensive performance metrics
func (*PerformanceService) GetTableSizes ¶
GetTableSizes returns the sizes of database tables
func (*PerformanceService) OptimizeDatabase ¶
func (p *PerformanceService) OptimizeDatabase(_ context.Context) error
OptimizeDatabase runs performance optimizations on the database
func (*PerformanceService) ScheduleOptimization ¶
func (p *PerformanceService) ScheduleOptimization(ctx context.Context, interval time.Duration)
ScheduleOptimization sets up periodic database optimization
type PocketBaseHealthChecker ¶
type PocketBaseHealthChecker struct {
// contains filtered or unexported fields
}
PocketBaseHealthChecker implements health checking for PocketBase services.
func NewPocketBaseHealthChecker ¶
func NewPocketBaseHealthChecker(service *PocketBaseService) *PocketBaseHealthChecker
NewPocketBaseHealthChecker creates a health checker for PocketBase
func (*PocketBaseHealthChecker) Check ¶
func (h *PocketBaseHealthChecker) Check(_ context.Context) HealthCheck
Check performs the PocketBase health check
func (*PocketBaseHealthChecker) Name ¶
func (h *PocketBaseHealthChecker) Name() string
Name returns the checker name
type PocketBaseService ¶
type PocketBaseService struct {
// contains filtered or unexported fields
}
PocketBaseService manages PocketBase operations
func NewPocketBaseService ¶
func NewPocketBaseService(dataDir string, embedded bool) *PocketBaseService
NewPocketBaseService creates a new PocketBase service
func (*PocketBaseService) GetApp ¶
func (p *PocketBaseService) GetApp() *pocketbase.PocketBase
GetApp returns the PocketBase app instance
func (*PocketBaseService) Initialize ¶
func (p *PocketBaseService) Initialize(_ context.Context) error
Initialize sets up PocketBase with collections and hooks
func (*PocketBaseService) SetupAPIPermissions ¶
func (p *PocketBaseService) SetupAPIPermissions()
SetupAPIPermissions configures API-level permissions and hooks. Currently exported but not used - kept for future implementation.
func (*PocketBaseService) SetupAccessRules ¶
func (p *PocketBaseService) SetupAccessRules() error
SetupAccessRules configures collection access rules and API permissions. Currently exported but not used - kept for future implementation.
type PositionManager ¶
type PositionManager interface {
// CalculateNewPosition calculates the optimal position for a task being moved
CalculateNewPosition(ctx context.Context, req PositionRequest) (int, error)
// RebalanceColumn rebalances positions in a column to prevent overflow
RebalanceColumn(ctx context.Context, projectID string, status domain.TaskStatus) error
// GetPositionBetween calculates a position between two existing positions
GetPositionBetween(beforePos, afterPos int) int
// ValidatePosition checks if a position is valid and available
ValidatePosition(ctx context.Context, projectID string, status domain.TaskStatus, position int) error
}
PositionManager handles sophisticated position management for drag-and-drop functionality
func NewPositionManager ¶
func NewPositionManager(taskRepo repository.TaskRepository) PositionManager
NewPositionManager creates a new position manager
type PositionRequest ¶
type PositionRequest struct {
ProjectID string `json:"project_id"`
TaskID string `json:"task_id"`
TargetStatus domain.TaskStatus `json:"target_status"`
InsertAtIndex int `json:"insert_at_index"` // 0-based index in the target column
BeforeTaskID *string `json:"before_task_id,omitempty"`
AfterTaskID *string `json:"after_task_id,omitempty"`
}
PositionRequest contains parameters for position calculation
type ProjectRepository ¶
type ProjectRepository interface {
GetByID(ctx context.Context, id string) (*domain.Project, error)
}
ProjectRepository interface for project access validation
type ProjectService ¶
type ProjectService interface {
// CreateProject creates a new project
CreateProject(ctx context.Context, req domain.CreateProjectRequest, ownerID string) (*domain.Project, error)
// GetProject gets a project by ID
GetProject(ctx context.Context, projectID string, userID string) (*domain.Project, error)
// GetProjectBySlug gets a project by slug
GetProjectBySlug(ctx context.Context, slug string, userID string) (*domain.Project, error)
// UpdateProject updates a project
UpdateProject(
ctx context.Context,
projectID string,
req domain.UpdateProjectRequest,
userID string,
) (*domain.Project, error)
// DeleteProject deletes a project
DeleteProject(ctx context.Context, projectID string, userID string) error
// ListUserProjects lists projects for a user
ListUserProjects(ctx context.Context, userID string, offset, limit int) ([]*domain.Project, error)
// AddMember adds a user to a project
AddMember(ctx context.Context, projectID string, userID string, requesterID string) error
// RemoveMember removes a user from a project
RemoveMember(ctx context.Context, projectID string, userID string, requesterID string) error
// ListMembers lists project members
ListMembers(ctx context.Context, projectID string, userID string) ([]*domain.User, error)
}
ProjectService defines the interface for project-related business logic.
func NewProjectService ¶
func NewProjectService(projectRepo repository.ProjectRepository, userRepo repository.UserRepository) ProjectService
NewProjectService creates a new project service.
type PullRequestEventHandler ¶
type PullRequestEventHandler struct {
// contains filtered or unexported fields
}
PullRequestEventHandler handles pull request events
func (*PullRequestEventHandler) EventType ¶
func (h *PullRequestEventHandler) EventType() string
EventType returns the GitHub event type this handler processes
func (*PullRequestEventHandler) Handle ¶
func (h *PullRequestEventHandler) Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
Handle processes GitHub pull request events and manages PR mappings
type PullRequestReviewEventHandler ¶
type PullRequestReviewEventHandler struct {
// contains filtered or unexported fields
}
PullRequestReviewEventHandler handles pull request review events
func (*PullRequestReviewEventHandler) EventType ¶
func (h *PullRequestReviewEventHandler) EventType() string
EventType returns the GitHub event type this handler processes
func (*PullRequestReviewEventHandler) Handle ¶
func (h *PullRequestReviewEventHandler) Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
Handle processes GitHub pull request review events
type PushEventHandler ¶
type PushEventHandler struct {
// contains filtered or unexported fields
}
PushEventHandler handles push events
func (*PushEventHandler) EventType ¶
func (h *PushEventHandler) EventType() string
EventType returns the GitHub event type this handler processes
func (*PushEventHandler) Handle ¶
func (h *PushEventHandler) Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
Handle processes GitHub push events and links commits to tasks
type QueryOptimization ¶
type QueryOptimization struct {
OriginalQuery string `json:"original_query"`
OptimizedQuery string `json:"optimized_query"`
Improvement time.Duration `json:"improvement"`
Description string `json:"description"`
}
QueryOptimization represents an optimized query
type QueryOptimizationReport ¶
type QueryOptimizationReport struct {
Timestamp time.Time `json:"timestamp"`
SlowQueries []*SlowQuery `json:"slow_queries"`
OptimizedQueries []*QueryOptimization `json:"optimized_queries"`
Recommendations []string `json:"recommendations"`
AverageLatency time.Duration `json:"average_latency"`
TotalQueries int64 `json:"total_queries"`
}
QueryOptimizationReport contains query optimization analysis
type QueryPlan ¶
type QueryPlan struct {
Query string `json:"query"`
Plan []QueryPlanStep `json:"plan"`
TotalCost float64 `json:"total_cost"`
Indexes []string `json:"indexes_used"`
Suggestions []string `json:"suggestions"`
}
QueryPlan represents a query execution plan
type QueryPlanStep ¶
type QueryPlanStep struct {
Operation string `json:"operation"`
Table string `json:"table,omitempty"`
Index string `json:"index,omitempty"`
Cost float64 `json:"cost"`
Rows int64 `json:"estimated_rows"`
Filter string `json:"filter,omitempty"`
}
QueryPlanStep represents a step in the query execution plan
type RealtimeEventConfig ¶
type RealtimeEventConfig struct {
QueueSize int
MaxSubscriptions int
EventRetention time.Duration
BroadcastTimeout time.Duration
EnableEventHistory bool
EnableMetrics bool
WebSocketIntegration bool
}
RealtimeEventConfig configures the real-time event service
type RealtimeEventHandler ¶
RealtimeEventHandler represents a function that handles specific event types
type RealtimeEventService ¶
type RealtimeEventService struct {
// contains filtered or unexported fields
}
RealtimeEventService manages real-time event broadcasting and subscription
func NewRealtimeEventService ¶
func NewRealtimeEventService(eventBroadcaster EventBroadcaster, config RealtimeEventConfig) *RealtimeEventService
NewRealtimeEventService creates a new real-time event service
func (*RealtimeEventService) Cleanup ¶
func (s *RealtimeEventService) Cleanup()
Cleanup removes inactive subscriptions and performs maintenance
func (*RealtimeEventService) GetMetrics ¶
func (s *RealtimeEventService) GetMetrics() *EventMetrics
GetMetrics returns event system metrics
func (*RealtimeEventService) GetSubscriptions ¶
func (s *RealtimeEventService) GetSubscriptions(_ context.Context, userID string) ([]*EventSubscription, error)
GetSubscriptions returns active subscriptions for a user
func (*RealtimeEventService) PublishTaskEvent ¶
PublishTaskEvent publishes a task event to the real-time system
func (*RealtimeEventService) RegisterEventHandler ¶
func (s *RealtimeEventService) RegisterEventHandler(eventType domain.TaskEventType, handler RealtimeEventHandler)
RegisterEventHandler registers a handler for a specific event type
func (*RealtimeEventService) SetWebSocketBroadcaster ¶
func (s *RealtimeEventService) SetWebSocketBroadcaster(ws WebSocketBroadcaster)
SetWebSocketBroadcaster sets the WebSocket broadcaster for real-time updates
func (*RealtimeEventService) StartCleanupWorker ¶
func (s *RealtimeEventService) StartCleanupWorker()
StartCleanupWorker starts a goroutine that periodically cleans up subscriptions
func (*RealtimeEventService) Subscribe ¶
func (s *RealtimeEventService) Subscribe(_ context.Context, req *SubscriptionRequest) (*EventSubscription, error)
Subscribe creates a new event subscription
func (*RealtimeEventService) Unsubscribe ¶
func (s *RealtimeEventService) Unsubscribe(_ context.Context, subscriptionID, userID string) error
Unsubscribe removes an event subscription
type RealtimeHealthChecker ¶
type RealtimeHealthChecker = EnhancedRealtimeHealthChecker
RealtimeHealthChecker checks the health of real-time subscriptions Deprecated: Use EnhancedRealtimeHealthChecker instead
func NewRealtimeHealthChecker ¶
func NewRealtimeHealthChecker(service *RealtimeService) *RealtimeHealthChecker
NewRealtimeHealthChecker creates a health checker for real-time functionality Deprecated: Use NewEnhancedRealtimeHealthChecker instead
type RealtimeService ¶
type RealtimeService = EnhancedRealtimeService
RealtimeService provides utilities for working with PocketBase real-time features Deprecated: Use EnhancedRealtimeService instead
func NewRealtimeService ¶
func NewRealtimeService(pbService *PocketBaseService) *RealtimeService
NewRealtimeService creates a new realtime service Deprecated: Use NewEnhancedRealtimeService instead
type RealtimeTaskService ¶
type RealtimeTaskService interface {
TaskService
// GetEventBroadcaster returns the event broadcaster for external use
GetEventBroadcaster() EventBroadcaster
// BroadcastTaskCommented broadcasts a task comment event (exported for external use)
BroadcastTaskCommented(ctx context.Context, task *domain.Task, commentID, comment, authorID string) error
}
RealtimeTaskService extends TaskService with real-time event broadcasting capabilities
func NewRealtimeTaskService ¶
func NewRealtimeTaskService( taskService TaskService, eventBroadcaster EventBroadcaster, logger *slog.Logger, ) RealtimeTaskService
NewRealtimeTaskService creates a task service with real-time event broadcasting
type RecommendedIndex ¶
type RecommendedIndex struct {
Table string `json:"table"`
Columns []string `json:"columns"`
Type string `json:"type"` // "btree", "partial", etc.
Reason string `json:"reason"`
Query string `json:"create_query"`
Impact string `json:"expected_impact"`
Priority int `json:"priority"` // 1-10, higher is more important
}
RecommendedIndex represents a recommended index for creation
type RedisCacheBackend ¶
type RedisCacheBackend struct {
// contains filtered or unexported fields
}
RedisCacheBackend provides a Redis-based cache implementation (placeholder)
func NewRedisCacheBackend ¶
func NewRedisCacheBackend(_, _ string, _ int, prefix string) *RedisCacheBackend
NewRedisCacheBackend creates a new Redis cache backend
func (*RedisCacheBackend) Delete ¶
func (r *RedisCacheBackend) Delete(_ context.Context, _ string) error
Delete removes a key from Redis
func (*RedisCacheBackend) DeletePattern ¶
func (r *RedisCacheBackend) DeletePattern(_ context.Context, _ string) error
DeletePattern deletes keys matching a pattern
func (*RedisCacheBackend) Exists ¶
func (r *RedisCacheBackend) Exists(_ context.Context, _ string) bool
Exists checks if a key exists in Redis
func (*RedisCacheBackend) Flush ¶
func (r *RedisCacheBackend) Flush(_ context.Context) error
Flush clears all keys with the prefix
func (*RedisCacheBackend) Stats ¶
func (r *RedisCacheBackend) Stats(_ context.Context) (*BackendStats, error)
Stats returns Redis-specific statistics
type SlowQuery ¶
type SlowQuery struct {
Query string `json:"query"`
Duration time.Duration `json:"duration"`
ExecutionPlan string `json:"execution_plan"`
Frequency int64 `json:"frequency"`
LastExecution time.Time `json:"last_execution"`
Recommendation string `json:"recommendation"`
}
SlowQuery represents a slow performing query
type SubscriptionFilter ¶
type SubscriptionFilter struct {
// contains filtered or unexported fields
}
SubscriptionFilter helps create common subscription filters
func NewSubscriptionFilter ¶
func NewSubscriptionFilter() *SubscriptionFilter
NewSubscriptionFilter creates a new subscription filter builder
func (*SubscriptionFilter) Build ¶
func (f *SubscriptionFilter) Build() map[string]string
Build returns the constructed filters
func (*SubscriptionFilter) ByAssignee ¶
func (f *SubscriptionFilter) ByAssignee(assigneeID string) *SubscriptionFilter
ByAssignee filters events for tasks assigned to a specific user
func (*SubscriptionFilter) ByStatus ¶
func (f *SubscriptionFilter) ByStatus(status domain.TaskStatus) *SubscriptionFilter
ByStatus filters events for tasks with a specific status
func (*SubscriptionFilter) ByTaskID ¶
func (f *SubscriptionFilter) ByTaskID(taskID string) *SubscriptionFilter
ByTaskID filters events for a specific task
func (*SubscriptionFilter) ByUserID ¶
func (f *SubscriptionFilter) ByUserID(userID string) *SubscriptionFilter
ByUserID filters events for a specific user
type SubscriptionManager ¶
type SubscriptionManager interface {
// CreateSubscription creates a new event subscription for a user
CreateSubscription(ctx context.Context, req CreateSubscriptionRequest) (*domain.EventSubscription, error)
// UpdateSubscription updates an existing subscription
UpdateSubscription(
ctx context.Context, subscriptionID string, req UpdateSubscriptionRequest,
) (*domain.EventSubscription, error)
// DeleteSubscription removes a subscription
DeleteSubscription(ctx context.Context, subscriptionID string, userID string) error
// GetSubscription retrieves a subscription by ID
GetSubscription(ctx context.Context, subscriptionID string, userID string) (*domain.EventSubscription, error)
// ListUserSubscriptions lists all subscriptions for a user
ListUserSubscriptions(ctx context.Context, userID string) ([]*domain.EventSubscription, error)
// ValidateSubscriptionAccess checks if a user can access a subscription
ValidateSubscriptionAccess(ctx context.Context, subscriptionID string, userID string) error
// StartCleanupRoutine starts background cleanup of expired subscriptions
StartCleanupRoutine(ctx context.Context, interval time.Duration)
}
SubscriptionManager defines the interface for managing real-time subscriptions
func NewSubscriptionManager ¶
func NewSubscriptionManager( broadcaster EventBroadcaster, projectRepo ProjectRepository, userRepo UserRepository, config SubscriptionManagerConfig, ) SubscriptionManager
NewSubscriptionManager creates a new subscription manager
type SubscriptionManagerConfig ¶
type SubscriptionManagerConfig struct {
Logger *slog.Logger
CleanupInterval time.Duration // Default cleanup interval (default: 5 minutes)
}
SubscriptionManagerConfig holds configuration for the subscription manager
type SubscriptionManagerHealthChecker ¶
type SubscriptionManagerHealthChecker struct {
// contains filtered or unexported fields
}
SubscriptionManagerHealthChecker provides health checking for subscription manager
func NewSubscriptionManagerHealthChecker ¶
func NewSubscriptionManagerHealthChecker(manager SubscriptionManager) *SubscriptionManagerHealthChecker
NewSubscriptionManagerHealthChecker creates a health checker
func (*SubscriptionManagerHealthChecker) Check ¶
func (h *SubscriptionManagerHealthChecker) Check(_ context.Context) HealthCheck
Check performs the health check
func (*SubscriptionManagerHealthChecker) Name ¶
func (h *SubscriptionManagerHealthChecker) Name() string
Name returns the checker name
type SubscriptionRequest ¶
type SubscriptionRequest struct {
UserID string `json:"user_id"`
ProjectID string `json:"project_id,omitempty"`
EventTypes []domain.TaskEventType `json:"event_types"`
Filters map[string]interface{} `json:"filters,omitempty"`
}
SubscriptionRequest represents a request to create an event subscription
type TableIntegrity ¶
type TableIntegrity struct {
Name string `json:"name"`
RowCount int64 `json:"row_count"`
IsCorrupted bool `json:"is_corrupted"`
Issues []IntegrityError `json:"issues"`
LastChecked time.Time `json:"last_checked"`
}
TableIntegrity represents integrity status of a table
type TaskService ¶
type TaskService interface {
// CreateTask creates a new task
CreateTask(ctx context.Context, req domain.CreateTaskRequest, userID string) (*domain.Task, error)
// GetTask gets a task by ID
GetTask(ctx context.Context, taskID string, userID string) (*domain.Task, error)
// UpdateTask updates a task
UpdateTask(ctx context.Context, taskID string, req domain.UpdateTaskRequest, userID string) (*domain.Task, error)
// DeleteTask deletes a task
DeleteTask(ctx context.Context, taskID string, userID string) error
// ListProjectTasks lists tasks for a project
ListProjectTasks(ctx context.Context, projectID string, userID string, offset, limit int) ([]*domain.Task, error)
// ListUserTasks lists tasks assigned to a user
ListUserTasks(ctx context.Context, userID string, offset, limit int) ([]*domain.Task, error)
// AssignTask assigns a task to a user
AssignTask(ctx context.Context, taskID string, assigneeID string, userID string) (*domain.Task, error)
// UnassignTask removes assignment from a task
UnassignTask(ctx context.Context, taskID string, userID string) (*domain.Task, error)
// UpdateTaskStatus updates a task's status
UpdateTaskStatus(ctx context.Context, taskID string, status domain.TaskStatus, userID string) (*domain.Task, error)
// MoveTask moves a task between statuses and positions (kanban functionality)
MoveTask(ctx context.Context, req MoveTaskRequest, userID string) error
// GetProjectTasksFiltered gets tasks for a project with advanced filtering
GetProjectTasksFiltered(
ctx context.Context,
projectID string,
filters repository.TaskFilters,
userID string,
) ([]*domain.Task, error)
// GetSubtasks retrieves subtasks for a parent task
GetSubtasks(ctx context.Context, parentTaskID string, userID string) ([]*domain.Task, error)
// GetTaskDependencies retrieves dependency tasks for a task
GetTaskDependencies(ctx context.Context, taskID string, userID string) ([]*domain.Task, error)
// DuplicateTask creates a copy of an existing task
DuplicateTask(ctx context.Context, taskID string, options DuplicationOptions, userID string) (*domain.Task, error)
// CreateFromTemplate creates a task from a predefined template
CreateFromTemplate(ctx context.Context, templateID string, projectID string, userID string) (*domain.Task, error)
// CreateSubtask creates a subtask under a parent task
CreateSubtask(
ctx context.Context, parentTaskID string, req domain.CreateTaskRequest, userID string,
) (*domain.Task, error)
// AddDependency adds a dependency to a task
AddDependency(ctx context.Context, taskID string, dependencyID string, userID string) error
// RemoveDependency removes a dependency from a task
RemoveDependency(ctx context.Context, taskID string, dependencyID string, userID string) error
}
TaskService defines the interface for task-related business logic.
func NewTaskService ¶
func NewTaskService( taskRepo repository.TaskRepository, projectRepo repository.ProjectRepository, userRepo repository.UserRepository, ) TaskService
NewTaskService creates a new task service.
type TokenClaims ¶
type TokenClaims struct {
jwt.RegisteredClaims
UserID string `json:"user_id"`
Email string `json:"email"`
Username string `json:"username"`
Role string `json:"role"`
TokenVersion int `json:"token_version"`
}
TokenClaims represents JWT token claims.
type UpdateSubscriptionRequest ¶
type UpdateSubscriptionRequest struct {
EventTypes *[]domain.TaskEventType `json:"event_types,omitempty"`
Filters *map[string]string `json:"filters,omitempty"`
Active *bool `json:"active,omitempty"`
}
UpdateSubscriptionRequest represents a request to update a subscription
type UserRepository ¶
UserRepository interface for user validation
type UserService ¶
type UserService interface {
// GetProfile gets a user's profile by ID
GetProfile(ctx context.Context, userID string) (*domain.User, error)
// UpdateProfile updates a user's profile
UpdateProfile(ctx context.Context, userID string, req domain.UpdateUserRequest) (*domain.User, error)
// ListUsers lists users with pagination
ListUsers(ctx context.Context, offset, limit int) ([]*domain.User, error)
// GetUserByEmail gets a user by email (admin only)
GetUserByEmail(ctx context.Context, email string, currentUserID string) (*domain.User, error)
// GetUserByUsername gets a user by username
GetUserByUsername(ctx context.Context, username string) (*domain.User, error)
// ExistsByEmail checks if a user exists by email
ExistsByEmail(ctx context.Context, email string) (bool, error)
// ExistsByUsername checks if a user exists by username
ExistsByUsername(ctx context.Context, username string) (bool, error)
}
UserService defines the interface for user-related business logic.
func NewUserService ¶
func NewUserService(userRepo repository.UserRepository, authService AuthService) UserService
NewUserService creates a new user service.
type WIPLimits ¶
type WIPLimits struct {
SoftLimit int `json:"soft_limit"`
HardLimit int `json:"hard_limit"`
Enabled bool `json:"enabled"`
}
WIPLimits defines work-in-progress limits for a column
type WIPManager ¶
type WIPManager interface {
// ValidateWIPLimit checks if moving a task would violate WIP limits
ValidateWIPLimit(ctx context.Context, projectID string, targetStatus domain.TaskStatus) error
// GetWIPLimits retrieves WIP limits for a project column
GetWIPLimits(ctx context.Context, projectID string, status domain.TaskStatus) (*WIPLimits, error)
// SetWIPLimits configures WIP limits for a project column
SetWIPLimits(ctx context.Context, projectID string, status domain.TaskStatus, limits WIPLimits) error
// GetWIPStatus returns current WIP status for all columns
GetWIPStatus(ctx context.Context, projectID string) (map[domain.TaskStatus]*WIPStatus, error)
// CheckWIPViolations identifies columns that are violating WIP limits
CheckWIPViolations(ctx context.Context, projectID string) ([]*WIPViolation, error)
}
WIPManager handles Work-in-Progress limit enforcement
func NewWIPManager ¶
func NewWIPManager( taskRepo repository.TaskRepository, projectRepo repository.ProjectRepository, ) WIPManager
NewWIPManager creates a new WIP manager
type WIPOverride ¶
type WIPOverride struct {
Reason WIPOverrideReason `json:"reason"`
Comment string `json:"comment"`
UserID string `json:"user_id"`
ExpiresAt *string `json:"expires_at,omitempty"`
}
WIPOverride represents a WIP limit override request
type WIPOverrideReason ¶
type WIPOverrideReason string
WIPOverrideReason represents reasons for overriding WIP limits
const ( // OverrideEmergency allows bypassing WIP limits for emergency tasks OverrideEmergency WIPOverrideReason = "emergency" // OverrideHotfix allows bypassing WIP limits for critical hotfixes OverrideHotfix WIPOverrideReason = "hotfix" // OverrideBlocker allows bypassing WIP limits for blocking issues OverrideBlocker WIPOverrideReason = "blocker" )
type WIPStatus ¶
type WIPStatus struct {
Status domain.TaskStatus `json:"status"`
CurrentCount int `json:"current_count"`
Limits *WIPLimits `json:"limits"`
IsViolating bool `json:"is_violating"`
ViolationType string `json:"violation_type,omitempty"` // "soft" or "hard"
}
WIPStatus represents the current WIP status for a column
type WIPViolation ¶
type WIPViolation struct {
ProjectID string `json:"project_id"`
Status domain.TaskStatus `json:"status"`
CurrentCount int `json:"current_count"`
Limit int `json:"limit"`
ViolationType string `json:"violation_type"` // "soft" or "hard"
Severity string `json:"severity"` // "warning" or "error"
}
WIPViolation represents a WIP limit violation
type WebSocketBroadcaster ¶
type WebSocketBroadcaster interface {
SendToUser(userID string, eventType domain.TaskEventType, data interface{})
SendToProject(projectID string, eventType domain.TaskEventType, data interface{})
BroadcastToAll(eventType domain.TaskEventType, data interface{})
GetActiveConnections() int
}
WebSocketBroadcaster interface for WebSocket integration
type WebhookEventHandler ¶
type WebhookEventHandler interface {
Handle(ctx context.Context, integration *domain.GitHubIntegration, payload interface{}) error
EventType() string
}
WebhookEventHandler defines the interface for handling specific webhook events
Source Files
¶
- auth_service.go
- bulk_operations.go
- cache_manager.go
- comment_service.go
- db_optimizer.go
- event_broadcaster.go
- file_service.go
- github_oauth_service.go
- github_service.go
- github_webhook_service.go
- health_service.go
- kanban_service.go
- migration_service.go
- performance_service.go
- pocketbase_realtime.go
- pocketbase_rules.go
- pocketbase_service.go
- position_manager.go
- project_service.go
- realtime_event_service.go
- redis_cache_backend.go
- subscription_manager.go
- task_service.go
- task_service_realtime.go
- user_service.go
- wip_manager.go