diff --git a/.replit b/.replit index 10e1957..c806144 100644 --- a/.replit +++ b/.replit @@ -40,4 +40,3 @@ args = "npm run dev" waitForPort = 5000 [agent] -integrations = ["javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0", "javascript_object_storage==1.0.0"] diff --git a/server/storage.ts b/server/storage.ts index 0af1e80..ec226a3 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -391,11 +391,16 @@ export class MemStorage implements IStorage { description: video.description || "", category: video.category || "", customThumbnailUrl: null, + faceCenterPosition: null, + facesDetected: 0, + faceConfidence: 0, videoUrlMp4: null, videoUrlIframe: null, tags: [], isPublic: true, views: video.views || 0, + contentType: video.contentType || 'video', + genre: video.genre || 'other', createdAt: new Date(), updatedAt: new Date(), uploadStatus: video.uploadStatus || "completed", @@ -442,11 +447,16 @@ export class MemStorage implements IStorage { description: video.description || "", category: video.category || "", customThumbnailUrl: null, + faceCenterPosition: null, + facesDetected: 0, + faceConfidence: 0, videoUrlMp4: null, videoUrlIframe: null, tags: video.tags || [], isPublic: video.isPublic ?? true, views: video.views || 0, + contentType: video.contentType || 'video', + genre: video.genre || 'other', uploadStatus: video.uploadStatus || "completed", originalFileName: video.originalFileName || null, fileSize: video.fileSize || null, @@ -526,6 +536,7 @@ export class MemStorage implements IStorage { lastName: user.lastName || null, profileImageUrl: user.profileImageUrl || null, isAdmin: user.isAdmin ?? false, + isSuperAdmin: user.isSuperAdmin ?? false, createdAt: new Date(), updatedAt: new Date() }; @@ -770,8 +781,8 @@ class BunnyStorage implements IStorage { } // Update views cache - if (views !== undefined) { - this.viewsCache.set(id, (this.viewsCache.get(id) || 0) + (views - (this.viewsCache.get(id) || 0))); + if (views !== undefined && typeof views === 'number') { + this.viewsCache.set(id, views); } // Return updated video @@ -899,14 +910,145 @@ class BunnyStorage implements IStorage { } } -// Storage selection logic - choose DatabaseStorage if PostgreSQL is available +// Hybrid storage implementation that uses Bunny.net for videos and Database for users +export class HybridStorage implements IStorage { + private bunnyStorage: BunnyStorage; + private databaseStorage: DatabaseStorage; + + constructor() { + this.bunnyStorage = new BunnyStorage(); + this.databaseStorage = new DatabaseStorage(); + } + + // Video operations - use Bunny.net + async getVideos(limit?: number, offset?: number, search?: string): Promise { + return this.bunnyStorage.getVideos(limit, offset, search); + } + + async getVideo(id: string): Promise