From 701e78145986cd6c0e2df6410cd1a071b6657166 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 11:13:10 +0000 Subject: [PATCH 1/2] fix(api): add missing Handler type and methods in collaboration.go Adds Handler struct definition with DB field and required methods to fix compilation errors in the collaboration handler: - Handler struct with *db.Database field - NewCollaborationHandler constructor function - canAccessSession method for session authorization - toJSONB helper function for JSONB conversion This resolves the build failures in the GitHub Actions workflow where Handler was referenced but not defined in the handlers package. Fixes: #47 --- api/internal/handlers/collaboration.go | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/api/internal/handlers/collaboration.go b/api/internal/handlers/collaboration.go index 43705a36..e5bc75ef 100644 --- a/api/internal/handlers/collaboration.go +++ b/api/internal/handlers/collaboration.go @@ -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 From a0a8ab5d4b6a3c61af8993b0d6c6591978e1bbe1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 11:14:34 +0000 Subject: [PATCH 2/2] fix(controller): use VolumeResourceRequirements for PVC resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes PVC.Spec.Resources from corev1.ResourceRequirements to corev1.VolumeResourceRequirements to match the Kubernetes API changes in k8s.io/api v0.34.2. The PersistentVolumeClaimSpec.Resources field now expects VolumeResourceRequirements instead of ResourceRequirements. Fixes compilation error: cannot use corev1.ResourceRequirements{…} as corev1.VolumeResourceRequirements value in struct literal Related to: #47 --- controller/controllers/session_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/controllers/session_controller.go b/controller/controllers/session_controller.go index c6036d1b..b1193792 100644 --- a/controller/controllers/session_controller.go +++ b/controller/controllers/session_controller.go @@ -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), },