Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions api/internal/handlers/collaboration.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,44 @@ import (
"time"

"github.com/gin-gonic/gin"
"github.com/streamspace/streamspace/api/internal/db"
)

// Handler handles collaboration-related HTTP requests.
type Handler struct {
// DB is the database connection for collaboration queries and updates.
DB *db.Database
}

// NewCollaborationHandler creates a new collaboration handler.
func NewCollaborationHandler(database *db.Database) *Handler {
return &Handler{DB: database}
}

// canAccessSession checks if a user has access to a session.
// This is a placeholder implementation - replace with actual authorization logic.
func (h *Handler) canAccessSession(userID, sessionID string) bool {
// TODO: Implement proper session access check
// For now, query the sessions table to see if user owns the session
var exists bool
err := h.DB.QueryRow(`
SELECT EXISTS(SELECT 1 FROM sessions WHERE id = $1 AND user_id = $2)
`, sessionID, userID).Scan(&exists)
return err == nil && exists
}

// toJSONB converts a Go value to JSON string for JSONB storage.
func toJSONB(v interface{}) string {
if v == nil {
return "{}"
}
data, err := json.Marshal(v)
if err != nil {
return "{}"
}
return string(data)
}

// CollaborationSession represents a collaborative multi-user session.
//
// A collaboration session wraps a regular StreamSpace session with real-time
Expand Down
2 changes: 1 addition & 1 deletion controller/controllers/session_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ func (r *SessionReconciler) createUserPVC(session *streamv1alpha1.Session) *core
AccessModes: []corev1.PersistentVolumeAccessMode{
corev1.ReadWriteMany, // NFS support
},
Resources: corev1.ResourceRequirements{
Resources: corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse(storageSize),
},
Expand Down
Loading