Documentation
¶
Overview ¶
Package api provides HTTP handlers and API endpoints.
Package api provides shared utilities for API handlers.
Error Handling: All handlers should use SanitizedErrorResponse for consistent error handling, security sanitization, and structured logging. This prevents internal message leakage and ensures proper error tracking across the application.
Usage:
api.SanitizedErrorResponse(c, err)
Avoid direct c.JSON calls with error payloads - use SanitizedErrorResponse instead.
Index ¶
- func CreatedResponse(c *gin.Context, data interface{})
- func ErrorResponse(c *gin.Context, err error)
- func FormatSSEData(event *domain.TaskEvent) string
- func HealthMetricsMiddleware() gin.HandlerFunc
- func HealthMiddleware() gin.HandlerFunc
- func PingHandler(c *gin.Context)
- func RealtimeMiddleware() gin.HandlerFunc
- func RegisterGitHubRoutes(r *gin.RouterGroup, handler *GitHubHandler, authMiddleware gin.HandlerFunc)
- func SanitizedErrorResponse(c *gin.Context, err error)
- func StatusHandler(c *gin.Context)
- func SuccessResponse(c *gin.Context, data interface{})
- func ValidateEventStreamRequest(req *TaskEventStreamRequest) error
- func VersionHandler(c *gin.Context)
- type AuthHandler
- func (h *AuthHandler) ForgotPassword(c *gin.Context)
- func (h *AuthHandler) GetProfile(c *gin.Context)
- func (h *AuthHandler) Login(c *gin.Context)
- func (h *AuthHandler) Logout(c *gin.Context)
- func (h *AuthHandler) RefreshToken(c *gin.Context)
- func (h *AuthHandler) Register(c *gin.Context)
- func (h *AuthHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *AuthHandler) ResetPassword(c *gin.Context)
- type BroadcastMessage
- type ConnectionManager
- type ConnectionStats
- type ErrorSanitizer
- type GitHubHandler
- func (h *GitHubHandler) CreateBranchForTask(c *gin.Context)
- func (h *GitHubHandler) CreateIntegration(c *gin.Context)
- func (h *GitHubHandler) CreateIssueFromTask(c *gin.Context)
- func (h *GitHubHandler) DeleteIntegration(c *gin.Context)
- func (h *GitHubHandler) GetIntegrationByProject(c *gin.Context)
- func (h *GitHubHandler) GetTaskCommits(c *gin.Context)
- func (h *GitHubHandler) GetTaskPullRequests(c *gin.Context)
- func (h *GitHubHandler) GetUserRepositories(c *gin.Context)
- func (h *GitHubHandler) HandleGitHubCallback(c *gin.Context)
- func (h *GitHubHandler) HandleWebhook(c *gin.Context)
- func (h *GitHubHandler) InitiateGitHubAuth(c *gin.Context)
- func (h *GitHubHandler) SyncIssueToTask(c *gin.Context)
- func (h *GitHubHandler) UpdateIntegrationSettings(c *gin.Context)
- type GitHubIntegrationResponse
- type HealthHandler
- func (h *HealthHandler) DetailedHealth(c *gin.Context)
- func (h *HealthHandler) HealthCheck(c *gin.Context)
- func (h *HealthHandler) Liveness(c *gin.Context)
- func (h *HealthHandler) Readiness(c *gin.Context)
- func (h *HealthHandler) RegisterRoutes(router *gin.Engine)
- func (h *HealthHandler) SystemInfo(c *gin.Context)
- type ProjectHandler
- func (h *ProjectHandler) AddMember(c *gin.Context)
- func (h *ProjectHandler) CreateProject(c *gin.Context)
- func (h *ProjectHandler) DeleteProject(c *gin.Context)
- func (h *ProjectHandler) GetProject(c *gin.Context)
- func (h *ProjectHandler) ListProjects(c *gin.Context)
- func (h *ProjectHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *ProjectHandler) RemoveMember(c *gin.Context)
- func (h *ProjectHandler) UpdateProject(c *gin.Context)
- type RealtimeHandler
- func (h *RealtimeHandler) BroadcastToProject(ctx context.Context, _ string, event *domain.TaskEvent) error
- func (h *RealtimeHandler) CreateSubscription(c *gin.Context)
- func (h *RealtimeHandler) DeleteSubscription(c *gin.Context)
- func (h *RealtimeHandler) GetActiveConnections(c *gin.Context)
- func (h *RealtimeHandler) GetSubscription(c *gin.Context)
- func (h *RealtimeHandler) HealthCheck(c *gin.Context)
- func (h *RealtimeHandler) ListSubscriptions(c *gin.Context)
- func (h *RealtimeHandler) PocketBaseTaskEvents(c *gin.Context)
- func (h *RealtimeHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *RealtimeHandler) StreamEvents(c *gin.Context)
- func (h *RealtimeHandler) UpdateSubscription(c *gin.Context)
- func (h *RealtimeHandler) WebSocketUpgrade(c *gin.Context)
- type TaskEventStreamRequest
- type TaskHandler
- func (h *TaskHandler) AddDependency(c *gin.Context)
- func (h *TaskHandler) AssignTask(c *gin.Context)
- func (h *TaskHandler) CreateSubtask(c *gin.Context)
- func (h *TaskHandler) CreateTask(c *gin.Context)
- func (h *TaskHandler) DeleteTask(c *gin.Context)
- func (h *TaskHandler) DuplicateTask(c *gin.Context)
- func (h *TaskHandler) GetTask(c *gin.Context)
- func (h *TaskHandler) GetTaskHistory(c *gin.Context)
- func (h *TaskHandler) ListSubtasks(c *gin.Context)
- func (h *TaskHandler) ListTasks(c *gin.Context)
- func (h *TaskHandler) LogTimeSpent(c *gin.Context)
- func (h *TaskHandler) MoveTask(c *gin.Context)
- func (h *TaskHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *TaskHandler) RemoveDependency(c *gin.Context)
- func (h *TaskHandler) UnassignTask(c *gin.Context)
- func (h *TaskHandler) UpdateTask(c *gin.Context)
- func (h *TaskHandler) UpdateTaskPosition(c *gin.Context)
- func (h *TaskHandler) UpdateTaskStatus(c *gin.Context)
- type UserHandler
- func (h *UserHandler) DeleteUser(c *gin.Context)
- func (h *UserHandler) GetProfile(c *gin.Context)
- func (h *UserHandler) GetUserByID(c *gin.Context)
- func (h *UserHandler) ListUsers(c *gin.Context)
- func (h *UserHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *UserHandler) RemoveAvatar(c *gin.Context)
- func (h *UserHandler) UpdateAvatar(c *gin.Context)
- func (h *UserHandler) UpdatePreferences(c *gin.Context)
- func (h *UserHandler) UpdateProfile(c *gin.Context)
- func (h *UserHandler) UpdateUserRole(c *gin.Context)
- type WebSocketConnection
- type WebSocketHandler
- func (h *WebSocketHandler) BroadcastMessage(c *gin.Context)
- func (h *WebSocketHandler) BroadcastToAll(eventType domain.TaskEventType, data interface{})
- func (h *WebSocketHandler) CleanupStaleConnections()
- func (h *WebSocketHandler) GetActiveConnections() int
- func (h *WebSocketHandler) GetConnectionStats(c *gin.Context)
- func (h *WebSocketHandler) HandleWebSocketUpgrade(c *gin.Context)
- func (h *WebSocketHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
- func (h *WebSocketHandler) SendToProject(projectID string, eventType domain.TaskEventType, data interface{})
- func (h *WebSocketHandler) SendToUser(userID string, eventType domain.TaskEventType, data interface{})
- func (h *WebSocketHandler) StartCleanupWorker()
- type WebSocketMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatedResponse ¶
CreatedResponse returns a standardized created response.
func ErrorResponse ¶
ErrorResponse handles domain errors with improved security and logging. Deprecated: Use SanitizedErrorResponse for better security. This function is kept for backward compatibility but should be replaced.
func FormatSSEData ¶
FormatSSEData formats data for Server-Sent Events
func HealthMetricsMiddleware ¶
func HealthMetricsMiddleware() gin.HandlerFunc
HealthMetricsMiddleware tracks request metrics for health monitoring
func HealthMiddleware ¶
func HealthMiddleware() gin.HandlerFunc
HealthMiddleware is a middleware that adds health check headers
func RealtimeMiddleware ¶
func RealtimeMiddleware() gin.HandlerFunc
RealtimeMiddleware provides middleware for real-time connections
func RegisterGitHubRoutes ¶
func RegisterGitHubRoutes(r *gin.RouterGroup, handler *GitHubHandler, authMiddleware gin.HandlerFunc)
RegisterGitHubRoutes registers GitHub integration routes
func SanitizedErrorResponse ¶
SanitizedErrorResponse handles errors with security-focused sanitization and structured logging
func SuccessResponse ¶
SuccessResponse returns a standardized success response.
func ValidateEventStreamRequest ¶
func ValidateEventStreamRequest(req *TaskEventStreamRequest) error
ValidateEventStreamRequest validates the event stream request
func VersionHandler ¶
VersionHandler returns version information
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication-related HTTP requests.
func NewAuthHandler ¶
func NewAuthHandler(authService services.AuthService) *AuthHandler
NewAuthHandler creates a new authentication handler.
func (*AuthHandler) ForgotPassword ¶
func (h *AuthHandler) ForgotPassword(c *gin.Context)
ForgotPassword handles password reset request initiation.
func (*AuthHandler) GetProfile ¶
func (h *AuthHandler) GetProfile(c *gin.Context)
GetProfile handles get user profile requests.
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(c *gin.Context)
Login handles user login requests.
func (*AuthHandler) Logout ¶
func (h *AuthHandler) Logout(c *gin.Context)
Logout handles user logout requests.
func (*AuthHandler) RefreshToken ¶
func (h *AuthHandler) RefreshToken(c *gin.Context)
RefreshToken handles token refresh requests.
func (*AuthHandler) Register ¶
func (h *AuthHandler) Register(c *gin.Context)
Register handles user registration requests.
func (*AuthHandler) RegisterRoutes ¶
func (h *AuthHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers authentication routes with the router.
func (*AuthHandler) ResetPassword ¶
func (h *AuthHandler) ResetPassword(c *gin.Context)
ResetPassword handles password reset with token.
type BroadcastMessage ¶
type BroadcastMessage struct { ProjectID string EventType domain.TaskEventType Data interface{} TargetUserID string // Optional: send to specific user only }
BroadcastMessage represents a message to broadcast to connections
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
ConnectionManager manages active WebSocket connections
type ConnectionStats ¶
type ConnectionStats struct { TotalConnections int `json:"total_connections"` ConnectionsByUser map[string]int `json:"connections_by_user"` ConnectionsByProject map[string]int `json:"connections_by_project"` EventTypeStats map[domain.TaskEventType]int `json:"event_type_stats"` LastUpdated time.Time `json:"last_updated"` }
ConnectionStats provides connection statistics
type ErrorSanitizer ¶
type ErrorSanitizer struct {
// contains filtered or unexported fields
}
ErrorSanitizer provides safe error handling that prevents information disclosure
func NewErrorSanitizer ¶
func NewErrorSanitizer(logger *slog.Logger) *ErrorSanitizer
NewErrorSanitizer creates a new error sanitizer with structured logging
func (*ErrorSanitizer) SanitizedErrorResponse ¶
func (s *ErrorSanitizer) SanitizedErrorResponse(c *gin.Context, err error)
SanitizedErrorResponse provides safe error responses that prevent information disclosure while logging detailed errors server-side with correlation IDs
type GitHubHandler ¶
type GitHubHandler struct {
// contains filtered or unexported fields
}
GitHubHandler handles GitHub integration endpoints
func NewGitHubHandler ¶
func NewGitHubHandler( githubOAuthService *services.GitHubOAuthService, githubService *services.GitHubService, githubWebhookService *services.GitHubWebhookService, ) *GitHubHandler
NewGitHubHandler creates a new GitHub handler
func (*GitHubHandler) CreateBranchForTask ¶
func (h *GitHubHandler) CreateBranchForTask(c *gin.Context)
CreateBranchForTask creates a branch for a task
func (*GitHubHandler) CreateIntegration ¶
func (h *GitHubHandler) CreateIntegration(c *gin.Context)
CreateIntegration creates a new GitHub integration
func (*GitHubHandler) CreateIssueFromTask ¶
func (h *GitHubHandler) CreateIssueFromTask(c *gin.Context)
CreateIssueFromTask creates a GitHub issue from a task
func (*GitHubHandler) DeleteIntegration ¶
func (h *GitHubHandler) DeleteIntegration(c *gin.Context)
DeleteIntegration deletes a GitHub integration
func (*GitHubHandler) GetIntegrationByProject ¶
func (h *GitHubHandler) GetIntegrationByProject(c *gin.Context)
GetIntegrationByProject gets GitHub integration for a project
func (*GitHubHandler) GetTaskCommits ¶
func (h *GitHubHandler) GetTaskCommits(c *gin.Context)
GetTaskCommits gets commits linked to a task
func (*GitHubHandler) GetTaskPullRequests ¶
func (h *GitHubHandler) GetTaskPullRequests(c *gin.Context)
GetTaskPullRequests gets pull requests linked to a task
func (*GitHubHandler) GetUserRepositories ¶
func (h *GitHubHandler) GetUserRepositories(c *gin.Context)
GetUserRepositories gets GitHub repositories accessible to the user
func (*GitHubHandler) HandleGitHubCallback ¶
func (h *GitHubHandler) HandleGitHubCallback(c *gin.Context)
HandleGitHubCallback processes GitHub OAuth callback
func (*GitHubHandler) HandleWebhook ¶
func (h *GitHubHandler) HandleWebhook(c *gin.Context)
HandleWebhook processes GitHub webhooks
func (*GitHubHandler) InitiateGitHubAuth ¶
func (h *GitHubHandler) InitiateGitHubAuth(c *gin.Context)
InitiateGitHubAuth starts the GitHub OAuth flow
func (*GitHubHandler) SyncIssueToTask ¶
func (h *GitHubHandler) SyncIssueToTask(c *gin.Context)
SyncIssueToTask synchronizes a GitHub issue with a task
func (*GitHubHandler) UpdateIntegrationSettings ¶
func (h *GitHubHandler) UpdateIntegrationSettings(c *gin.Context)
UpdateIntegrationSettings updates GitHub integration settings
type GitHubIntegrationResponse ¶
type GitHubIntegrationResponse struct { ID string `json:"id"` ProjectID string `json:"project_id"` UserID string `json:"user_id"` RepoOwner string `json:"repo_owner"` RepoName string `json:"repo_name"` RepoID int64 `json:"repo_id"` InstallID *int64 `json:"install_id,omitempty"` Settings domain.GitHubSettings `json:"settings"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
GitHubIntegrationResponse represents a GitHub integration for API responses (without access token)
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
HealthHandler handles health check endpoints.
func NewHealthHandler ¶
func NewHealthHandler(healthService *services.HealthService) *HealthHandler
NewHealthHandler creates a new health handler.
func (*HealthHandler) DetailedHealth ¶
func (h *HealthHandler) DetailedHealth(c *gin.Context)
DetailedHealth returns detailed health information including system metrics.
func (*HealthHandler) HealthCheck ¶
func (h *HealthHandler) HealthCheck(c *gin.Context)
HealthCheck performs a comprehensive health check.
func (*HealthHandler) Liveness ¶
func (h *HealthHandler) Liveness(c *gin.Context)
Liveness returns the liveness status.
func (*HealthHandler) Readiness ¶
func (h *HealthHandler) Readiness(c *gin.Context)
Readiness returns the readiness status.
func (*HealthHandler) RegisterRoutes ¶
func (h *HealthHandler) RegisterRoutes(router *gin.Engine)
RegisterRoutes registers health check routes.
func (*HealthHandler) SystemInfo ¶
func (h *HealthHandler) SystemInfo(c *gin.Context)
SystemInfo returns system information only.
type ProjectHandler ¶
type ProjectHandler struct {
// contains filtered or unexported fields
}
ProjectHandler handles project-related HTTP requests.
func NewProjectHandler ¶
func NewProjectHandler( projectService services.ProjectService, projectRepo repository.ProjectRepository, ) *ProjectHandler
NewProjectHandler creates a new project handler.
func (*ProjectHandler) AddMember ¶
func (h *ProjectHandler) AddMember(c *gin.Context)
AddMember handles POST /api/projects/:id/members requests.
func (*ProjectHandler) CreateProject ¶
func (h *ProjectHandler) CreateProject(c *gin.Context)
CreateProject handles POST /api/projects requests.
func (*ProjectHandler) DeleteProject ¶
func (h *ProjectHandler) DeleteProject(c *gin.Context)
DeleteProject handles DELETE /api/projects/:id requests.
func (*ProjectHandler) GetProject ¶
func (h *ProjectHandler) GetProject(c *gin.Context)
GetProject handles GET /api/projects/:id requests.
func (*ProjectHandler) ListProjects ¶
func (h *ProjectHandler) ListProjects(c *gin.Context)
ListProjects handles GET /api/projects requests.
func (*ProjectHandler) RegisterRoutes ¶
func (h *ProjectHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers project routes with the router.
func (*ProjectHandler) RemoveMember ¶
func (h *ProjectHandler) RemoveMember(c *gin.Context)
RemoveMember handles DELETE /api/projects/:id/members/:memberID requests.
func (*ProjectHandler) UpdateProject ¶
func (h *ProjectHandler) UpdateProject(c *gin.Context)
UpdateProject handles PUT /api/projects/:id requests.
type RealtimeHandler ¶
type RealtimeHandler struct {
// contains filtered or unexported fields
}
RealtimeHandler provides HTTP handlers for real-time subscriptions
func NewRealtimeHandler ¶
func NewRealtimeHandler( subscriptionManager services.SubscriptionManager, eventBroadcaster services.EventBroadcaster, app core.App, ) *RealtimeHandler
NewRealtimeHandler creates a new realtime handler
func (*RealtimeHandler) BroadcastToProject ¶
func (h *RealtimeHandler) BroadcastToProject(ctx context.Context, _ string, event *domain.TaskEvent) error
BroadcastToProject broadcasts an event to all subscribers of a project
func (*RealtimeHandler) CreateSubscription ¶
func (h *RealtimeHandler) CreateSubscription(c *gin.Context)
CreateSubscription creates a new event subscription
func (*RealtimeHandler) DeleteSubscription ¶
func (h *RealtimeHandler) DeleteSubscription(c *gin.Context)
DeleteSubscription deletes a subscription
func (*RealtimeHandler) GetActiveConnections ¶
func (h *RealtimeHandler) GetActiveConnections(c *gin.Context)
GetActiveConnections returns information about active real-time connections
func (*RealtimeHandler) GetSubscription ¶
func (h *RealtimeHandler) GetSubscription(c *gin.Context)
GetSubscription retrieves a specific subscription
func (*RealtimeHandler) HealthCheck ¶
func (h *RealtimeHandler) HealthCheck(c *gin.Context)
HealthCheck provides health status for real-time services
func (*RealtimeHandler) ListSubscriptions ¶
func (h *RealtimeHandler) ListSubscriptions(c *gin.Context)
ListSubscriptions lists all subscriptions for the authenticated user
func (*RealtimeHandler) PocketBaseTaskEvents ¶
func (h *RealtimeHandler) PocketBaseTaskEvents(c *gin.Context)
PocketBaseTaskEvents integrates with PocketBase's built-in real-time system
func (*RealtimeHandler) RegisterRoutes ¶
func (h *RealtimeHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers all real-time related routes
func (*RealtimeHandler) StreamEvents ¶
func (h *RealtimeHandler) StreamEvents(c *gin.Context)
StreamEvents provides Server-Sent Events stream for real-time updates
func (*RealtimeHandler) UpdateSubscription ¶
func (h *RealtimeHandler) UpdateSubscription(c *gin.Context)
UpdateSubscription updates an existing subscription
func (*RealtimeHandler) WebSocketUpgrade ¶
func (h *RealtimeHandler) WebSocketUpgrade(c *gin.Context)
WebSocketUpgrade handles WebSocket upgrade requests (future enhancement)
type TaskEventStreamRequest ¶
type TaskEventStreamRequest struct { ProjectID *string `json:"project_id,omitempty"` EventTypes []domain.TaskEventType `json:"event_types,omitempty"` Filters map[string]string `json:"filters,omitempty"` }
TaskEventStreamRequest represents the structure for creating event streams
type TaskHandler ¶
type TaskHandler struct {
// contains filtered or unexported fields
}
TaskHandler handles task-related HTTP requests.
func NewTaskHandler ¶
func NewTaskHandler( taskService services.TaskService, taskRepo repository.TaskRepository, ) *TaskHandler
NewTaskHandler creates a new task handler.
func (*TaskHandler) AddDependency ¶
func (h *TaskHandler) AddDependency(c *gin.Context)
AddDependency handles POST /api/projects/:projectId/tasks/:id/dependencies requests.
func (*TaskHandler) AssignTask ¶
func (h *TaskHandler) AssignTask(c *gin.Context)
AssignTask handles POST /api/projects/:projectId/tasks/:id/assign requests.
func (*TaskHandler) CreateSubtask ¶
func (h *TaskHandler) CreateSubtask(c *gin.Context)
CreateSubtask handles POST /api/projects/:projectId/tasks/:id/subtasks requests.
func (*TaskHandler) CreateTask ¶
func (h *TaskHandler) CreateTask(c *gin.Context)
CreateTask handles POST /api/projects/:projectId/tasks requests.
func (*TaskHandler) DeleteTask ¶
func (h *TaskHandler) DeleteTask(c *gin.Context)
DeleteTask handles DELETE /api/projects/:projectId/tasks/:id requests.
func (*TaskHandler) DuplicateTask ¶
func (h *TaskHandler) DuplicateTask(c *gin.Context)
DuplicateTask handles POST /api/projects/:projectId/tasks/:id/duplicate requests.
func (*TaskHandler) GetTask ¶
func (h *TaskHandler) GetTask(c *gin.Context)
GetTask handles GET /api/projects/:projectId/tasks/:id requests.
func (*TaskHandler) GetTaskHistory ¶
func (h *TaskHandler) GetTaskHistory(c *gin.Context)
GetTaskHistory handles GET /api/projects/:projectId/tasks/:id/history requests.
func (*TaskHandler) ListSubtasks ¶
func (h *TaskHandler) ListSubtasks(c *gin.Context)
ListSubtasks handles GET /api/projects/:projectId/tasks/:id/subtasks requests.
func (*TaskHandler) ListTasks ¶
func (h *TaskHandler) ListTasks(c *gin.Context)
ListTasks handles GET /api/projects/:projectId/tasks requests.
func (*TaskHandler) LogTimeSpent ¶
func (h *TaskHandler) LogTimeSpent(c *gin.Context)
LogTimeSpent handles POST /api/projects/:projectId/tasks/:id/time-log requests.
func (*TaskHandler) MoveTask ¶
func (h *TaskHandler) MoveTask(c *gin.Context)
MoveTask handles POST /api/projects/:projectId/tasks/:id/move requests.
func (*TaskHandler) RegisterRoutes ¶
func (h *TaskHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers task routes with the router.
func (*TaskHandler) RemoveDependency ¶
func (h *TaskHandler) RemoveDependency(c *gin.Context)
RemoveDependency handles DELETE /api/projects/:projectId/tasks/:id/dependencies/:depId requests.
func (*TaskHandler) UnassignTask ¶
func (h *TaskHandler) UnassignTask(c *gin.Context)
UnassignTask handles DELETE /api/projects/:projectId/tasks/:id/assign requests.
func (*TaskHandler) UpdateTask ¶
func (h *TaskHandler) UpdateTask(c *gin.Context)
UpdateTask handles PUT /api/projects/:projectId/tasks/:id requests.
func (*TaskHandler) UpdateTaskPosition ¶
func (h *TaskHandler) UpdateTaskPosition(c *gin.Context)
UpdateTaskPosition handles PUT /api/projects/:projectId/tasks/:id/position requests.
func (*TaskHandler) UpdateTaskStatus ¶
func (h *TaskHandler) UpdateTaskStatus(c *gin.Context)
UpdateTaskStatus handles PUT /api/projects/:projectId/tasks/:id/status requests.
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
UserHandler handles user profile-related HTTP requests.
func NewUserHandler ¶
func NewUserHandler(userRepo repository.UserRepository) *UserHandler
NewUserHandler creates a new user handler.
func (*UserHandler) DeleteUser ¶
func (h *UserHandler) DeleteUser(c *gin.Context)
DeleteUser handles DELETE /api/users/:id requests (admin only).
func (*UserHandler) GetProfile ¶
func (h *UserHandler) GetProfile(c *gin.Context)
GetProfile handles GET /api/users/profile requests.
func (*UserHandler) GetUserByID ¶
func (h *UserHandler) GetUserByID(c *gin.Context)
GetUserByID handles GET /api/users/:id requests (admin only).
func (*UserHandler) ListUsers ¶
func (h *UserHandler) ListUsers(c *gin.Context)
ListUsers handles GET /api/users requests (admin only).
func (*UserHandler) RegisterRoutes ¶
func (h *UserHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers user profile routes with the router.
func (*UserHandler) RemoveAvatar ¶
func (h *UserHandler) RemoveAvatar(c *gin.Context)
RemoveAvatar handles DELETE /api/users/avatar requests.
func (*UserHandler) UpdateAvatar ¶
func (h *UserHandler) UpdateAvatar(c *gin.Context)
UpdateAvatar handles POST /api/users/avatar requests.
func (*UserHandler) UpdatePreferences ¶
func (h *UserHandler) UpdatePreferences(c *gin.Context)
UpdatePreferences handles PUT /api/users/preferences requests.
func (*UserHandler) UpdateProfile ¶
func (h *UserHandler) UpdateProfile(c *gin.Context)
UpdateProfile handles PUT /api/users/profile requests.
func (*UserHandler) UpdateUserRole ¶
func (h *UserHandler) UpdateUserRole(c *gin.Context)
UpdateUserRole handles PUT /api/users/:id/role requests (admin only).
type WebSocketConnection ¶
type WebSocketConnection struct { ID string UserID string ProjectID string Connection *websocket.Conn Send chan []byte EventTypes []domain.TaskEventType LastPing time.Time Subscriptions map[string]*domain.EventSubscription // contains filtered or unexported fields }
WebSocketConnection represents a single WebSocket connection
type WebSocketHandler ¶
type WebSocketHandler struct {
// contains filtered or unexported fields
}
WebSocketHandler provides WebSocket functionality for real-time features
func NewWebSocketHandler ¶
func NewWebSocketHandler( subscriptionManager services.SubscriptionManager, eventBroadcaster services.EventBroadcaster, app core.App, ) *WebSocketHandler
NewWebSocketHandler creates a new WebSocket handler
func (*WebSocketHandler) BroadcastMessage ¶
func (h *WebSocketHandler) BroadcastMessage(c *gin.Context)
BroadcastMessage broadcasts a message to all relevant connections
func (*WebSocketHandler) BroadcastToAll ¶
func (h *WebSocketHandler) BroadcastToAll(eventType domain.TaskEventType, data interface{})
BroadcastToAll sends a message to all active connections
func (*WebSocketHandler) CleanupStaleConnections ¶
func (h *WebSocketHandler) CleanupStaleConnections()
CleanupStaleConnections removes connections that haven't pinged recently
func (*WebSocketHandler) GetActiveConnections ¶
func (h *WebSocketHandler) GetActiveConnections() int
GetActiveConnections returns the current number of active connections
func (*WebSocketHandler) GetConnectionStats ¶
func (h *WebSocketHandler) GetConnectionStats(c *gin.Context)
GetConnectionStats returns connection statistics
func (*WebSocketHandler) HandleWebSocketUpgrade ¶
func (h *WebSocketHandler) HandleWebSocketUpgrade(c *gin.Context)
HandleWebSocketUpgrade upgrades HTTP connection to WebSocket
func (*WebSocketHandler) RegisterRoutes ¶
func (h *WebSocketHandler) RegisterRoutes(router *gin.RouterGroup, authMiddleware *middleware.AuthMiddleware)
RegisterRoutes registers WebSocket routes
func (*WebSocketHandler) SendToProject ¶
func (h *WebSocketHandler) SendToProject(projectID string, eventType domain.TaskEventType, data interface{})
SendToProject sends a message to all connections for a specific project
func (*WebSocketHandler) SendToUser ¶
func (h *WebSocketHandler) SendToUser(userID string, eventType domain.TaskEventType, data interface{})
SendToUser sends a message to all connections for a specific user
func (*WebSocketHandler) StartCleanupWorker ¶
func (h *WebSocketHandler) StartCleanupWorker()
StartCleanupWorker starts the cleanup worker in a goroutine
type WebSocketMessage ¶
type WebSocketMessage struct { Type string `json:"type"` Action string `json:"action,omitempty"` Data map[string]interface{} `json:"data,omitempty"` Error string `json:"error,omitempty"` Timestamp time.Time `json:"timestamp"` }
WebSocketMessage represents incoming/outgoing WebSocket messages
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package middleware provides HTTP middleware functions for authentication and authorization.
|
Package middleware provides HTTP middleware functions for authentication and authorization. |