Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add folders to spaces (#738)
Ameer Al Ashhabd167a2036af7
diff --git a/apps/tasks/.eslintrc b/apps/tasks/.eslintrcindex f92987032..2d07b1233 100644--- a/apps/tasks/.eslintrc+++ b/apps/tasks/.eslintrc@@ -34,4 +34,4 @@"typescript": {}}}-}\ No newline at end of file+}diff --git a/apps/web/actions/folders/createFolder.ts b/apps/web/actions/folders/createFolder.tsindex 978c1f387..a38d43d7e 100644--- a/apps/web/actions/folders/createFolder.ts+++ b/apps/web/actions/folders/createFolder.ts@@ -10,10 +10,12 @@ import { revalidatePath } from "next/cache";export async function createFolder({name,color,+ spaceId,parentId,}: {name: string;color: "normal" | "blue" | "red" | "yellow";+ spaceId?: string;parentId?: string;}) {const user = await getCurrentUser();@@ -50,6 +52,7 @@ export async function createFolder({parentId: parentId || null,createdAt: now,updatedAt: now,+ spaceId: spaceId || null,};await db().insert(folders).values(folder);diff --git a/apps/web/actions/folders/deleteFolder.ts b/apps/web/actions/folders/deleteFolder.tsindex 0b9accfac..aca5ec71b 100644--- a/apps/web/actions/folders/deleteFolder.ts+++ b/apps/web/actions/folders/deleteFolder.ts@@ -1,12 +1,12 @@"use server";import { db } from "@cap/database";-import { folders, videos } from "@cap/database/schema";-import { eq } from "drizzle-orm";+import { folders, videos, spaceVideos } from "@cap/database/schema";+import { eq, and } from "drizzle-orm";import { revalidatePath } from "next/cache";import { getFolderById } from "./getFolderById";-export async function deleteFolder(folderId: string) {+export async function deleteFolder(folderId: string, spaceId?: string | null) {if (!folderId) throw new Error("Folder ID is required");// Get the folder to find its parent@@ -22,13 +22,30 @@ export async function deleteFolder(folderId: string) {await deleteFolder(child.id);}- // Set folderId to parentId for all videos in this folder+ // Always update videos.folderId so videos move up to parent folderawait db().update(videos).set({ folderId: parentId }).where(eq(videos.folderId, folderId));+ // If spaceId is provided, also update spaceVideos.folderId for consistency+ if (spaceId) {+ await db()+ .update(spaceVideos)+ .set({ folderId: parentId })+ .where(+ and(+ eq(spaceVideos.folderId, folderId),+ eq(spaceVideos.spaceId, spaceId)+ )+ );+ }+// Delete the folder itselfawait db().delete(folders).where(eq(folders.id, folderId));- revalidatePath(`/dashboard/caps`);+ if (spaceId) {+ revalidatePath(`/dashboard/spaces/${spaceId}`);+ } else {+ revalidatePath(`/dashboard/caps`);+ }}diff --git a/apps/web/actions/folders/duplicateFolder.ts b/apps/web/actions/folders/duplicateFolder.tsindex c698e1669..faa43fd0a 100644--- a/apps/web/actions/folders/duplicateFolder.ts+++ b/apps/web/actions/folders/duplicateFolder.ts@@ -9,7 +9,8 @@ import { getFolderById } from "./getFolderById";export async function duplicateFolder(folderId: string,- parentId?: string | null+ parentId?: string | null,+ spaceId?: string | null): Promise<string> {if (!folderId) throw new Error("Folder ID is required");@@ -29,6 +30,7 @@ export async function duplicateFolder(createdAt: now,updatedAt: now,parentId: parentId ?? null,+ spaceId: spaceId ?? null,};await db().insert(folders).values(newFolder);@@ -39,13 +41,15 @@ export async function duplicateFolder(.where(eq(videos.folderId, folderId));for (const video of videosInFolder) {const newVideoId = nanoId();- await db().insert(videos).values({- ...video,- id: newVideoId,- folderId: newFolderId,- createdAt: now,- updatedAt: now,- });+ await db()+ .insert(videos)+ .values({+ ...video,+ id: newVideoId,+ folderId: newFolderId,+ createdAt: now,+ updatedAt: now,+ });// --- S3 Asset Duplication ---// Copy all S3 objects from old video to new video@@ -56,7 +60,10 @@ export async function duplicateFolder(let newPrefix: string | null = null;if (video.bucket) {// Modern: use custom bucket- const [bucketRow] = await db().select().from(s3Buckets).where(eq(s3Buckets.id, video.bucket));+ const [bucketRow] = await db()+ .select()+ .from(s3Buckets)+ .where(eq(s3Buckets.id, video.bucket));if (bucketRow) {bucketProvider = await createBucketProvider(bucketRow);prefix = `${video.ownerId}/${video.id}/`;@@ -74,7 +81,10 @@ export async function duplicateFolder(for (const obj of objects.Contents) {if (!obj.Key) continue;const newKey = obj.Key.replace(prefix, newPrefix);- await bucketProvider.copyObject(`${bucketProvider.name}/${obj.Key}`, newKey);+ await bucketProvider.copyObject(+ `${bucketProvider.name}/${obj.Key}`,+ newKey+ );}}}diff --git a/apps/web/actions/folders/moveVideoToFolder.ts b/apps/web/actions/folders/moveVideoToFolder.tsindex d17ea8deb..45ab39d38 100644--- a/apps/web/actions/folders/moveVideoToFolder.ts+++ b/apps/web/actions/folders/moveVideoToFolder.ts@@ -1,7 +1,7 @@"use server";import { db } from "@cap/database";-import { folders, videos } from "@cap/database/schema";+import { folders, videos, spaceVideos } from "@cap/database/schema";import { eq, and } from "drizzle-orm";import { getCurrentUser } from "@cap/database/auth/session";import { revalidatePath } from "next/cache";@@ -9,9 +9,11 @@ import { revalidatePath } from "next/cache";export async function moveVideoToFolder({videoId,folderId,+ spaceId,}: {videoId: string;folderId: string | null;+ spaceId?: string | null;}) {const user = await getCurrentUser();if (!user || !user.activeOrganizationId)@@ -44,6 +46,15 @@ export async function moveVideoToFolder({}}+ if (spaceId) {+ await db()+ .update(spaceVideos)+ .set({+ folderId: folderId === null ? null : folderId,+ })+ .where(eq(spaceVideos.videoId, videoId));+ }+// Update the video's folderIdawait db().update(videos)@@ -56,6 +67,10 @@ export async function moveVideoToFolder({// Always revalidate the main caps pagerevalidatePath(`/dashboard/caps`);+ if (spaceId) {+ revalidatePath(`/dashboard/spaces/${spaceId}/folder/${folderId}`);+ }+// Revalidate the target folder if it existsif (folderId) {revalidatePath(`/dashboard/folder/${folderId}`);diff --git a/apps/web/actions/organization/delete-space.ts b/apps/web/actions/organization/delete-space.tsindex c651901a3..e242a1ba1 100644--- a/apps/web/actions/organization/delete-space.ts+++ b/apps/web/actions/organization/delete-space.ts@@ -2,7 +2,12 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";-import { spaces, spaceMembers, spaceVideos } from "@cap/database/schema";+import {+ spaces,+ spaceMembers,+ spaceVideos,+ folders,+} from "@cap/database/schema";import { eq } from "drizzle-orm";import { revalidatePath } from "next/cache";import { createBucketProvider } from "@/utils/s3";@@ -50,13 +55,17 @@ export async function deleteSpace(}// Delete in order to maintain referential integrity:+// 1. First delete all space videosawait db().delete(spaceVideos).where(eq(spaceVideos.spaceId, spaceId));// 2. Delete all space membersawait db().delete(spaceMembers).where(eq(spaceMembers.spaceId, spaceId));- // 3. Delete space icons from S3+ // 3. Delete all space folders+ await db().delete(folders).where(eq(folders.spaceId, spaceId));++ // 4. Delete space icons from S3try {const bucketProvider = await createBucketProvider();diff --git a/apps/web/actions/spaces/remove-videos.ts b/apps/web/actions/spaces/remove-videos.tsindex 3d46b8f65..de47b7882 100644--- a/apps/web/actions/spaces/remove-videos.ts+++ b/apps/web/actions/spaces/remove-videos.ts@@ -1,12 +1,15 @@"use server";import { getCurrentUser } from "@cap/database/auth/session";-import { spaceVideos, videos } from "@cap/database/schema";+import { spaceVideos, videos, folders } from "@cap/database/schema";import { db } from "@cap/database";import { eq, and, inArray } from "drizzle-orm";import { revalidatePath } from "next/cache";-export async function removeVideosFromSpace(spaceId: string, videoIds: string[]) {+export async function removeVideosFromSpace(+ spaceId: string,+ videoIds: string[]+) {try {const user = await getCurrentUser();@@ -24,28 +27,49 @@ export async function removeVideosFromSpace(spaceId: string, videoIds: string[]).from(videos).where(and(eq(videos.ownerId, user.id), inArray(videos.id, videoIds)));- const validVideoIds = userVideos.map(v => v.id);+ const validVideoIds = userVideos.map((v) => v.id);if (validVideoIds.length === 0) {throw new Error("No valid videos found");}// Remove from spaceVideos- const deleted = await db()+ await db().delete(spaceVideos)- .where(and(- eq(spaceVideos.spaceId, spaceId),- inArray(spaceVideos.videoId, validVideoIds)- ));+ .where(+ and(+ eq(spaceVideos.spaceId, spaceId),+ inArray(spaceVideos.videoId, validVideoIds)+ )+ );++ // Set folderId to null for any removed videos that are in folders belonging to this space+ // Find all folder IDs in this space+ const folderRows = await db()+ .select({ id: folders.id })+ .from(folders)+ .where(eq(folders.spaceId, spaceId));+ const folderIds = folderRows.map((f) => f.id);++ if (folderIds.length > 0) {+ await db()+ .update(videos)+ .set({ folderId: null })+ .where(+ and(+ inArray(videos.id, validVideoIds),+ inArray(videos.folderId, folderIds)+ )+ );+ }revalidatePath(`/dashboard/spaces/${spaceId}`);return {success: true,- message: `Removed ${validVideoIds.length} video(s) from space`,+ message: `Removed ${validVideoIds.length} video(s) from space and folders`,deletedCount: validVideoIds.length,};-} catch (error: any) {return {success: false,diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsxindex 8cdc1fd48..019514bb3 100644--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx@@ -21,7 +21,7 @@ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";import type { FolderDataType } from "./components/Folder";import { useUploadingContext } from "./UploadingContext";-type VideoData = {+export type VideoData = {id: string;ownerId: string;name: string;@@ -295,9 +295,6 @@ export const Caps = ({{isUploading && (<UploadPlaceholderCardkey={"upload-placeholder"}- id={uploadingCapId || undefined}- thumbnailUrl={uploadingThumbnailUrl}- progress={uploadProgress}/>)}{data.map((cap) => (diff --git a/apps/web/app/(org)/dashboard/caps/components/Folder.tsx b/apps/web/app/(org)/dashboard/caps/components/Folder.tsxindex 90bea94bf..623792e21 100644--- a/apps/web/app/(org)/dashboard/caps/components/Folder.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/Folder.tsx@@ -19,10 +19,11 @@ export type FolderDataType = {id: string;color: "normal" | "blue" | "red" | "yellow";videoCount: number;+ spaceId?: string | null;parentId?: string | null;};-const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {+const Folder = ({ name, color, id, parentId, videoCount, spaceId }: FolderDataType) => {const { theme } = useTheme();const [confirmDeleteFolderOpen, setConfirmDeleteFolderOpen] = useState(false);const [deleteFolderLoading, setDeleteFolderLoading] = useState(false);@@ -61,7 +62,7 @@ const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {const deleteFolderHandler = async () => {try {setDeleteFolderLoading(true);- await deleteFolder(id);+ await deleteFolder(id, spaceId);toast.success("Folder deleted successfully");} catch (error) {toast.error("Failed to delete folder");@@ -90,7 +91,7 @@ const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {try {setIsMovingVideo(true);- await moveVideoToFolder({ videoId: data.id, folderId: id });+ await moveVideoToFolder({ videoId: data.id, folderId: id, spaceId });toast.success(`"${data.name}" moved to "${name}" folder`);} catch (error) {console.error("Error moving video to folder:", error);@@ -248,7 +249,7 @@ const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {if (!capData.id) return;setIsMovingVideo(true);- await moveVideoToFolder({ videoId: capData.id, folderId: id });+ await moveVideoToFolder({ videoId: capData.id, folderId: id, spaceId });toast.success(`"${capData.name}" moved to "${name}" folder`);} catch (error) {console.error("Error moving video to folder:", error);@@ -258,8 +259,11 @@ const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {}};+return (- <Link legacyBehavior prefetch={false} href={`/dashboard/folder/${id}`}>+ <Link legacyBehavior prefetch={false} href={+ spaceId ? `/dashboard/spaces/${spaceId}/folder/${id}` : `/dashboard/folder/${id}`+ }><divref={folderRef}onMouseEnter={() => {diff --git a/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx b/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsxindex 971490636..0fe123c2f 100644--- a/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx@@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { RefObject } from "react";import { toast } from "sonner";import { duplicateFolder } from "@/actions/folders/duplicateFolder";+import { useDashboardContext } from "../../Contexts";interface FoldersDropdownProps {id: string;@@ -22,6 +23,7 @@ export const FoldersDropdown = ({setConfirmDeleteFolderOpen,nameRef,}: FoldersDropdownProps) => {+ const { activeSpace } = useDashboardContext()return (<divonClick={(e) => e.stopPropagation()}@@ -38,46 +40,54 @@ export const FoldersDropdown = ({</div></DropdownMenuTrigger><DropdownMenuContent>- {[- {- label: "Rename",- icon: faPencil,- onClick: () => {- setIsRenaming(true)- // Use setTimeout to ensure the textarea is rendered before focusing- setTimeout(() => {- nameRef.current?.focus()- nameRef.current?.select()- }, 0)- }- },- {- label: "Duplicate",- icon: faCopy,- onClick: async () => {- try {- await duplicateFolder(id, parentId);- toast.success("Folder duplicated successfully");- } catch (error) {- toast.error("Failed to duplicate folder");+ {(() => {+ type FolderDropdownItem = {+ label: string;+ icon: any;+ onClick: () => void | Promise<void>;+ };+ const items: FolderDropdownItem[] = [+ {+ label: "Rename",+ icon: faPencil,+ onClick: () => {+ setIsRenaming(true)+ setTimeout(() => {+ nameRef.current?.focus()+ nameRef.current?.select()+ }, 0)+ }+ },+ // Only show Duplicate if there is NO active space+ ...(!activeSpace ? [{+ label: "Duplicate",+ icon: faCopy,+ onClick: async () => {+ try {+ await duplicateFolder(id, parentId);+ toast.success("Folder duplicated successfully");+ } catch (error) {+ toast.error("Failed to duplicate folder");+ }}+ }] : []),+ {+ label: "Delete",+ icon: faTrash,+ onClick: () => setConfirmDeleteFolderOpen(true)}- },- {- label: "Delete",- icon: faTrash,- onClick: () => setConfirmDeleteFolderOpen(true)- }- ].map((item, index) => (- <DropdownMenuItem- key={item.label}- onClick={item.onClick}- className="rounded-lg"- >- <FontAwesomeIcon className="mr-1.5 text-gray-10 size-3" icon={item.icon} />- {item.label}- </DropdownMenuItem>- ))}+ ];+ return items.map((item) => (+ <DropdownMenuItem+ key={item.label}+ onClick={item.onClick}+ className="rounded-lg"+ >+ <FontAwesomeIcon className="mr-1.5 text-gray-10 size-3" icon={item.icon} />+ {item.label}+ </DropdownMenuItem>+ ));+ })()}</DropdownMenuContent></DropdownMenu></div>diff --git a/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsxindex fc00b4062..0e7a81a96 100644--- a/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx@@ -18,6 +18,7 @@ import { BlueFolder, NormalFolder, RedFolder, YellowFolder } from "./Folders";interface Props {open: boolean;onOpenChange: (open: boolean) => void;+ spaceId?: string;}const FolderOptions = [@@ -43,7 +44,7 @@ const FolderOptions = [},] as const;-export const NewFolderDialog: React.FC<Props> = ({ open, onOpenChange }) => {+export const NewFolderDialog: React.FC<Props> = ({ open, onOpenChange, spaceId }) => {const [selectedColor, setSelectedColor] = useState<(typeof FolderOptions)[number]["value"] | null>(null);@@ -62,6 +63,7 @@ export const NewFolderDialog: React.FC<Props> = ({ open, onOpenChange }) => {await createFolder({name: folderName,color: selectedColor,+ spaceId,});setFolderName("");setSelectedColor(null);diff --git a/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx b/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsxindex b4bf053c4..65ff18270 100644--- a/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx@@ -4,35 +4,25 @@ import { LogoSpinner } from "@cap/ui";import {getProgressCircleConfig,calculateStrokeDashoffset,- getUploadStatus,- getDisplayProgress,+ getUploadStatus} from "@cap/utils";+import { useUploadingContext } from "../UploadingContext";-export const UploadPlaceholderCard = ({- thumbnail,- progress,- uploadProgress,-}: {- thumbnail?: string;- progress: number;- uploadProgress?: number;-}) => {+export const UploadPlaceholderCard = () => {+ const { uploadingThumbnailUrl, uploadProgress } = useUploadingContext();const { circumference } = getProgressCircleConfig();const status = getUploadStatus(uploadProgress);- const displayProgress = getDisplayProgress(uploadProgress, progress);const strokeDashoffset = calculateStrokeDashoffset(- displayProgress,+ uploadProgress,circumference);- console.log(displayProgress, 'display progress')-return (<div className="flex flex-col gap-4 w-full h-full rounded-xl bg-gray-1 border-gray-3 border-[1px]"><div className="overflow-hidden relative w-full bg-black rounded-t-xl border-b border-gray-3 aspect-video group">- {thumbnail ? (+ {uploadingThumbnailUrl ? (<img- src={thumbnail}+ src={uploadingThumbnailUrl}alt="Uploading thumbnail"className="object-cover w-full h-full"/>diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsxindex 7c30fabc8..f32652c16 100644--- a/apps/web/app/(org)/dashboard/caps/page.tsx+++ b/apps/web/app/(org)/dashboard/caps/page.tsx@@ -187,7 +187,8 @@ export default async function CapsPage({.where(and(eq(folders.organizationId, user.activeOrganizationId),- isNull(folders.parentId)+ isNull(folders.parentId),+ isNull(folders.spaceId)));diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsxindex 38b092513..1415cd476 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx@@ -7,6 +7,7 @@ import { moveVideoToFolder } from "@/actions/folders/moveVideoToFolder";import { toast } from "sonner";import clsx from "clsx";import { useRouter } from "next/navigation";+import { useDashboardContext } from "../../../Contexts";interface BreadcrumbItemProps {id: string;@@ -19,6 +20,7 @@ export function BreadcrumbItem({ id, name, color, isLast }: BreadcrumbItemProps)const [isDragOver, setIsDragOver] = useState(false);const [isMoving, setIsMoving] = useState(false);const router = useRouter();+ const { activeSpace } = useDashboardContext();const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {e.preventDefault();@@ -90,7 +92,7 @@ export function BreadcrumbItem({ id, name, color, isLast }: BreadcrumbItemProps)})}><Link- href={`/dashboard/folder/${id}`}+ href={activeSpace ? `/dashboard/spaces/${activeSpace.id}/folder/${id}` : `/dashboard/folder/${id}`}className="flex gap-1.5 items-center transition-colors duration-200 z-10 relative"><AllFolders color={color} className="size-5" />diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsxindex 6bb40f89a..b7ff7c3ad 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx@@ -1,6 +1,9 @@"use client";-import { CapCard, CapCardProps } from "../../../caps/components/CapCard/CapCard";+import {+ CapCard,+ CapCardProps,+} from "../../../caps/components/CapCard/CapCard";import { deleteVideo } from "@/actions/videos/delete";import { useState, useRef } from "react";import { createPortal } from "react-dom";@@ -31,7 +34,7 @@ export function registerDropTarget() {dropTargets.push({ element, onDrop, onDragOver, onDragLeave });return () => {- dropTargets = dropTargets.filter(target => target.element !== element);+ dropTargets = dropTargets.filter((target) => target.element !== element);};}@@ -48,27 +51,27 @@ export function ClientCapCard(props: ClientCapCardProps) {try {await deleteVideo(videoId);router.refresh();- toast.success('Video deleted successfully');+ toast.success("Video deleted successfully");} catch (error) {- console.error('Error deleting video:', error);- toast.error('Failed to delete video');+ console.error("Error deleting video:", error);+ toast.error("Failed to delete video");}};-// Create a drag preview element with thumbnailconst createDragPreview = (text: string): HTMLElement => {// Create the container element- const container = document.createElement('div');- container.className = 'flex gap-2 items-center px-3 py-2 rounded-lg border shadow-md bg-gray-1 border-gray-4';- container.style.position = 'absolute';- container.style.top = '-9999px';- container.style.left = '-9999px';+ const container = document.createElement("div");+ container.className =+ "flex gap-2 items-center px-3 py-2 rounded-lg border shadow-md bg-gray-1 border-gray-4";+ container.style.position = "absolute";+ container.style.top = "-9999px";+ container.style.left = "-9999px";// Add the text- const textElement = document.createElement('span');+ const textElement = document.createElement("span");textElement.textContent = text;- textElement.className = 'text-sm font-medium text-gray-12';+ textElement.className = "text-sm font-medium text-gray-12";container.appendChild(textElement);return container;@@ -79,7 +82,7 @@ export function ClientCapCard(props: ClientCapCardProps) {return {id: videoId,name: props.cap.name,- type: "application/cap"+ type: "application/cap",};};@@ -95,7 +98,7 @@ export function ClientCapCard(props: ClientCapCardProps) {);// Set drag effect to 'move'- e.dataTransfer.effectAllowed = 'move';+ e.dataTransfer.effectAllowed = "move";// Set the drag imagetry {@@ -108,7 +111,7 @@ export function ClientCapCard(props: ClientCapCardProps) {// Clean up after a short delaysetTimeout(() => document.body.removeChild(dragPreview), 100);} catch (error) {- console.error('Error setting drag image:', error);+ console.error("Error setting drag image:", error);}setIsDragging(true);@@ -140,7 +143,7 @@ export function ClientCapCard(props: ClientCapCardProps) {// Clear the timer if the touch ends quickly (tap)const clearTimer = () => clearTimeout(timer);- document.addEventListener('touchend', clearTimer, { once: true });+ document.addEventListener("touchend", clearTimer, { once: true });}}};@@ -171,7 +174,10 @@ export function ClientCapCard(props: ClientCapCardProps) {const lastTouch = e.changedTouches[0];// Safely access touch propertiesif (lastTouch) {- const dropTarget = findDropTargetAtPosition(lastTouch.clientX, lastTouch.clientY);+ const dropTarget = findDropTargetAtPosition(+ lastTouch.clientX,+ lastTouch.clientY+ );if (dropTarget && dragDataRef.current) {dropTarget.onDrop(dragDataRef.current);@@ -187,19 +193,20 @@ export function ClientCapCard(props: ClientCapCardProps) {// Helper function to check if we're over a drop targetconst checkDropTargets = (x: number, y: number) => {// Highlight the drop target we're over (if any)- dropTargets.forEach(target => {+ dropTargets.forEach((target) => {const rect = target.element.getBoundingClientRect();- const isOver = x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;+ const isOver =+ x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;// Add/remove a class to highlight the drop targetif (isOver) {- target.element.classList.add('drag-over');+ target.element.classList.add("drag-over");// Trigger the onDragOver callback if providedif (target.onDragOver) {target.onDragOver();}- } else if (target.element.classList.contains('drag-over')) {- target.element.classList.remove('drag-over');+ } else if (target.element.classList.contains("drag-over")) {+ target.element.classList.remove("drag-over");// Trigger the onDragLeave callback if providedif (target.onDragLeave) {target.onDragLeave();@@ -210,9 +217,11 @@ export function ClientCapCard(props: ClientCapCardProps) {// Helper function to find a drop target at a positionconst findDropTargetAtPosition = (x: number, y: number) => {- return dropTargets.find(target => {+ return dropTargets.find((target) => {const rect = target.element.getBoundingClientRect();- return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;+ return (+ x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom+ );});};@@ -232,18 +241,22 @@ export function ClientCapCard(props: ClientCapCardProps) {</div>{/* Mobile drag preview */}- {touchDragging && typeof document !== 'undefined' && createPortal(- <div- className="flex fixed z-50 gap-2 items-center px-3 py-2 rounded-lg border shadow-md pointer-events-none bg-gray-1 border-gray-4"- style={{- left: `${touchPosition.x - 20}px`,- top: `${touchPosition.y - 30}px`,- }}- >- <span className="text-sm font-medium text-gray-12">{props.cap.name}</span>- </div>,- document.body- )}+ {touchDragging &&+ typeof document !== "undefined" &&+ createPortal(+ <div+ className="flex fixed z-50 gap-2 items-center px-3 py-2 rounded-lg border shadow-md pointer-events-none bg-gray-1 border-gray-4"+ style={{+ left: `${touchPosition.x - 20}px`,+ top: `${touchPosition.y - 30}px`,+ }}+ >+ <span className="text-sm font-medium text-gray-12">+ {props.cap.name}+ </span>+ </div>,+ document.body+ )}</>);}diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsxindex ea4f025ea..2c46a259f 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx@@ -7,12 +7,16 @@ import { toast } from "sonner";import clsx from "clsx";import { registerDropTarget } from "./ClientCapCard";import { useRouter } from "next/navigation";+import { useDashboardContext } from "../../../Contexts";+import { Avatar } from "@cap/ui";+import Image from "next/image";export function ClientMyCapsLink() {const [isDragOver, setIsDragOver] = useState(false);const [isMovingVideo, setIsMovingVideo] = useState(false);const linkRef = useRef<HTMLAnchorElement>(null);const router = useRouter();+ const { activeSpace } = useDashboardContext();// Register this component as a drop target for mobile drag and dropuseEffect(() => {@@ -82,11 +86,15 @@ export function ClientMyCapsLink() {// Move the video to the root folder (null parentId)await moveVideoToFolder({videoId: capData.id,- folderId: null+ folderId: null,+ spaceId: activeSpace?.id,});router.refresh();-- toast.success(`Moved "${capData.name}" to My Caps`);+ if (activeSpace) {+ toast.success(`Moved "${capData.name}" to "${activeSpace.name}"`);+ } else {+ toast.success(`Moved "${capData.name}" to My Caps`);+ }} catch (error) {console.error("Error moving video:", error);toast.error("Failed to move video");@@ -98,9 +106,9 @@ export function ClientMyCapsLink() {return (<Linkref={linkRef}- href="/dashboard/caps"+ href={activeSpace ? `/dashboard/spaces/${activeSpace.id}` : "/dashboard/caps"}className={clsx(- "text-xl whitespace-nowrap transition-colors duration-200 hover:text-gray-12",+ "text-xl whitespace-nowrap flex items-center gap-1.5 transition-colors duration-200 hover:text-gray-12",isDragOver ? "text-blue-10" : "text-gray-9",isMovingVideo && "opacity-70","drag-target" // Add a class for styling when used as a drop target@@ -109,7 +117,22 @@ export function ClientMyCapsLink() {onDragLeave={handleDragLeave}onDrop={handleDrop}>- My Caps+ {activeSpace && activeSpace.iconUrl ? (+ <Image+ src={activeSpace.iconUrl}+ alt={activeSpace.name || "Space"}+ width={20}+ height={20}+ className="rounded-full"+ />+ ) : activeSpace && !activeSpace.iconUrl && (+ <Avatar+ letterClass="text-xs"+ className="relative flex-shrink-0 size-5"+ name={activeSpace?.name}+ />+ )}+ {activeSpace ? activeSpace.name : "My Caps"}</Link>);}diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsxindex b42baf3c7..415ea174b 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx@@ -9,17 +9,27 @@ import { deleteVideo } from "@/actions/videos/delete";import { SelectedCapsBar } from "../../../caps/components/SelectedCapsBar";import { useApiClient } from "@/utils/web-api";import { useUploadingContext } from "../../../caps/UploadingContext";+import { type VideoData } from "../../../caps/Caps";+import { useDashboardContext } from "@/app/(org)/dashboard/Contexts";+import { SharedCapCard } from "../../../spaces/[spaceId]/components/SharedCapCard";interface FolderVideosSectionProps {- folderId: string;- initialVideos: Array<any>; // Replace 'any' with your Video type if available+ initialVideos: VideoData;dubApiKeyEnabled: boolean;+ cardType?: "shared" | "default";+ userId?: string;}-export default function FolderVideosSection({ folderId, initialVideos, dubApiKeyEnabled }: FolderVideosSectionProps) {+export default function FolderVideosSection({+ initialVideos,+ dubApiKeyEnabled,+ cardType = "default",+ userId,+}: FolderVideosSectionProps) {const router = useRouter();const apiClient = useApiClient();- const { isUploading, uploadingCapId, uploadingThumbnailUrl, uploadProgress } = useUploadingContext();+ const { isUploading } = useUploadingContext();+ const { activeOrganization } = useDashboardContext();const [selectedCaps, setSelectedCaps] = useState<string[]>([]);const previousCountRef = useRef<number>(0);@@ -122,30 +132,42 @@ export default function FolderVideosSection({ folderId, initialVideos, dubApiKey</div><div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">{initialVideos.length === 0 && !isUploading ? (- <p className="col-span-full text-gray-9">No videos in this folder yet. Drag and drop into the folder or upload.</p>+ <p className="col-span-full text-gray-9">+ No videos in this folder yet. Drag and drop into the folder or+ upload.+ </p>) : (<>{isUploading && (- <UploadPlaceholderCard- key={"upload-placeholder"}- id={uploadingCapId || undefined}- thumbnailUrl={uploadingThumbnailUrl}- progress={uploadProgress}- />+ <UploadPlaceholderCard key={"upload-placeholder"} />+ )}++ {cardType === "shared" ? (+ initialVideos.map((video) => (+ <SharedCapCard+ key={video.id}+ cap={video}+ hideSharedStatus+ analytics={analytics[video.id] || 0}+ organizationName={activeOrganization?.organization.name || ""}+ userId={userId}+ />+ ))+ ) : (+ initialVideos.map((video) => (+ <ClientCapCard+ key={video.id}+ videoId={video.id}+ cap={video}+ analytics={analytics[video.id] || 0}+ isSelected={selectedCaps.includes(video.id)}+ anyCapSelected={selectedCaps.length > 0}+ isDeleting={isDeleting}+ onSelectToggle={() => handleCapSelection(video.id)}+ onDelete={deleteSelectedCaps}+ />+ )))}- {initialVideos.map((video: any) => (- <ClientCapCard- key={video.id}- videoId={video.id}- cap={video}- analytics={analytics[video.id] || 0}- isSelected={selectedCaps.includes(video.id)}- anyCapSelected={selectedCaps.length > 0}- isDeleting={isDeleting}- onSelectToggle={() => handleCapSelection(video.id)}- onDelete={deleteSelectedCaps}- />- ))}</>)}</div>diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsxindex 9de1231a9..b6efe0980 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx@@ -16,6 +16,7 @@ import clsx from "clsx";import { createFolder } from "@/actions/folders/createFolder";import { toast } from "sonner";import { BlueFolder, NormalFolder, RedFolder, YellowFolder } from "../../../caps/components/Folders";+import { useDashboardContext } from "../../../Contexts";interface Props {open: boolean;@@ -53,6 +54,7 @@ export const SubfolderDialog: React.FC<Props> = ({ open, onOpenChange, parentFolconst [folderName, setFolderName] = useState<string>("");const folderRefs = useRef<Record<string, any>>({});const [loading, setLoading] = useState<boolean>(false);+ const { activeSpace } = useDashboardContext();useEffect(() => {if (!open) {@@ -69,6 +71,7 @@ export const SubfolderDialog: React.FC<Props> = ({ open, onOpenChange, parentFolname: folderName,color: selectedColor,parentId: parentFolderId,+ spaceId: activeSpace?.id,});setFolderName("");setSelectedColor(null);diff --git a/apps/web/app/(org)/dashboard/folder/[id]/page.tsx b/apps/web/app/(org)/dashboard/folder/[id]/page.tsxindex 22b93310d..adebf916c 100644--- a/apps/web/app/(org)/dashboard/folder/[id]/page.tsx+++ b/apps/web/app/(org)/dashboard/folder/[id]/page.tsx@@ -61,7 +61,6 @@ const FolderPage = async ({ params }: { params: { id: string } }) => {{/* Display Videos */}<FolderVideosSection- folderId={params.id}initialVideos={videosData}dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}/>diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsxindex 9a2cde070..dc9d209da 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx@@ -5,10 +5,10 @@ import { VideoMetadata } from "@cap/database/types";import { useSearchParams, useRouter } from "next/navigation";import { useEffect, useState } from "react";import { CapPagination } from "../../caps/components/CapPagination";-import { EmptySharedCapState } from "./components/EmptySharedCapState";import { SharedCapCard } from "./components/SharedCapCard";import { MembersIndicator } from "./components/MembersIndicator";import { AddVideosDialog } from "./components/AddVideosDialog";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import {OrganizationIndicator,OrganizationMemberData,@@ -16,6 +16,12 @@ import {import { AddVideosToOrganizationDialog } from "./components/AddVideosToOrganizationDialog";import { SpaceMemberData } from "./page";import { useDashboardContext } from "../../Contexts";+import { FolderDataType } from "../../caps/components/Folder";+import { EmptySharedCapState } from "./components/EmptySharedCapState";+import { NewFolderDialog } from "../../caps/components/NewFolderDialog";+import { Button } from "@cap/ui";+import { faFolderPlus, faInfoCircle } from "@fortawesome/free-solid-svg-icons";+import Folder from "../../caps/components/Folder";type SharedVideoData = {id: string;@@ -42,8 +48,8 @@ export const SharedCaps = ({spaceMembers,organizationMembers,currentUserId,+ folders,organizationData,- hideSharedWith,}: {data: SharedVideoData;count: number;@@ -52,6 +58,7 @@ export const SharedCaps = ({spaceMembers?: SpaceMemberData[];organizationMembers?: OrganizationMemberData[];currentUserId?: string;+ folders?: FolderDataType[];organizationData?: {id: string;name: string;@@ -64,6 +71,7 @@ export const SharedCaps = ({const [analytics, setAnalytics] = useState<Record<string, number>>({});const { activeOrganization } = useDashboardContext();const limit = 15;+ const [openNewFolderDialog, setOpenNewFolderDialog] = useState(false);const totalPages = Math.ceil(count / limit);const [isDraggingCap, setIsDraggingCap] = useState(false);const [isAddVideosDialogOpen, setIsAddVideosDialogOpen] = useState(false);@@ -110,41 +118,39 @@ export const SharedCaps = ({router.refresh();};- if (data.length === 0) {+ if (data.length === 0 && folders?.length === 0) {return (- <>- <div className="flex relative flex-col w-full h-full">- {spaceData && spaceMembers && (- <MembersIndicator- memberCount={spaceMemberCount}- members={spaceMembers}- organizationMembers={organizationMembers || []}- spaceId={spaceData.id}- canManageMembers={isSpaceOwner}- onAddVideos={() => setIsAddVideosDialogOpen(true)}- />- )}- {organizationData && organizationMembers && !spaceData && (- <OrganizationIndicator- memberCount={organizationMemberCount}- members={organizationMembers}- organizationName={organizationData.name}- canManageMembers={isOrgOwner}- onAddVideos={() => setIsAddOrganizationVideosDialogOpen(true)}- />- )}- <EmptySharedCapState- organizationName={activeOrganization?.organization.name || ""}- type={spaceData ? "space" : "organization"}- spaceData={spaceData}- currentUserId={currentUserId}- onAddVideos={- spaceData- ? () => setIsAddVideosDialogOpen(true)- : () => setIsAddOrganizationVideosDialogOpen(true)- }+ <div className="flex relative flex-col w-full h-full">+ {spaceData && spaceMembers && (+ <MembersIndicator+ memberCount={spaceMemberCount}+ members={spaceMembers}+ organizationMembers={organizationMembers || []}+ spaceId={spaceData.id}+ canManageMembers={isSpaceOwner}+ onAddVideos={() => setIsAddVideosDialogOpen(true)}/>- </div>+ )}+ {organizationData && organizationMembers && !spaceData && (+ <OrganizationIndicator+ memberCount={organizationMemberCount}+ members={organizationMembers}+ organizationName={organizationData.name}+ canManageMembers={isOrgOwner}+ onAddVideos={() => setIsAddOrganizationVideosDialogOpen(true)}+ />+ )}+ <EmptySharedCapState+ organizationName={activeOrganization?.organization.name || ""}+ type={spaceData ? "space" : "organization"}+ spaceData={spaceData}+ currentUserId={currentUserId}+ onAddVideos={+ spaceData+ ? () => setIsAddVideosDialogOpen(true)+ : () => setIsAddOrganizationVideosDialogOpen(true)+ }+ />{spaceData && (<AddVideosDialogopen={isAddVideosDialogOpen}@@ -163,7 +169,7 @@ export const SharedCaps = ({onVideosAdded={handleVideosAdded}/>)}- </>+ </div>);}@@ -172,49 +178,83 @@ export const SharedCaps = ({{isDraggingCap && (<div className="fixed inset-0 z-50 pointer-events-none"><div className="flex justify-center items-center w-full h-full">- <div className="px-5 py-3 text-sm font-medium rounded-lg border backdrop-blur-md bg-gray-1/80 border-gray-4 text-gray-12">- Drag to a space to share+ <div className="flex gap-2 items-center px-5 py-3 text-sm font-medium text-white rounded-xl bg-blue-12">+ <FontAwesomeIcon+ className="size-3.5 text-white opacity-50"+ icon={faInfoCircle}+ />+ <p className="text-white">+ Drag to a space to share or folder to move+ </p></div></div></div>)}- {spaceData && spaceMembers && (- <MembersIndicator- memberCount={spaceMemberCount}- members={spaceMembers}- organizationMembers={organizationMembers || []}- spaceId={spaceData.id}- canManageMembers={isSpaceOwner}- onAddVideos={() => setIsAddVideosDialogOpen(true)}- />- )}- {organizationData && organizationMembers && !spaceData && (- <OrganizationIndicator- memberCount={organizationMemberCount}- members={organizationMembers}- organizationName={organizationData.name}- canManageMembers={isOrgOwner}- onAddVideos={() => setIsAddOrganizationVideosDialogOpen(true)}- />- )}- {spaceData && (- <AddVideosDialog- open={isAddVideosDialogOpen}- onClose={() => setIsAddVideosDialogOpen(false)}- spaceId={spaceData.id}- spaceName={spaceData.name}- onVideosAdded={handleVideosAdded}- />- )}- {organizationData && (- <AddVideosToOrganizationDialog- open={isAddOrganizationVideosDialogOpen}- onClose={() => setIsAddOrganizationVideosDialogOpen(false)}- organizationId={organizationData.id}- organizationName={organizationData.name}- onVideosAdded={handleVideosAdded}- />+ <NewFolderDialog+ open={openNewFolderDialog}+ spaceId={spaceData?.id}+ onOpenChange={setOpenNewFolderDialog}+ />+ <div className="flex flex-wrap gap-3 mb-10">+ {spaceData && spaceMembers && (+ <MembersIndicator+ memberCount={spaceMemberCount}+ members={spaceMembers}+ organizationMembers={organizationMembers || []}+ spaceId={spaceData.id}+ canManageMembers={isSpaceOwner}+ onAddVideos={() => setIsAddVideosDialogOpen(true)}+ />+ )}+ {organizationData && organizationMembers && !spaceData && (+ <OrganizationIndicator+ memberCount={organizationMemberCount}+ members={organizationMembers}+ organizationName={organizationData.name}+ canManageMembers={isOrgOwner}+ onAddVideos={() => setIsAddOrganizationVideosDialogOpen(true)}+ />+ )}+ {spaceData && (+ <AddVideosDialog+ open={isAddVideosDialogOpen}+ onClose={() => setIsAddVideosDialogOpen(false)}+ spaceId={spaceData.id}+ spaceName={spaceData.name}+ onVideosAdded={handleVideosAdded}+ />+ )}+ {organizationData && (+ <AddVideosToOrganizationDialog+ open={isAddOrganizationVideosDialogOpen}+ onClose={() => setIsAddOrganizationVideosDialogOpen(false)}+ organizationId={organizationData.id}+ organizationName={organizationData.name}+ onVideosAdded={handleVideosAdded}+ />+ )}+ <Button+ onClick={() => setOpenNewFolderDialog(true)}+ size="sm"+ variant="dark"+ className="flex gap-2 items-center w-fit"+ >+ <FontAwesomeIcon className="size-3.5" icon={faFolderPlus} />+ New Folder+ </Button>+ </div>+ {folders && folders.length > 0 && (+ <>+ <h1 className="mb-6 text-2xl font-medium text-gray-12">Folders</h1>+ <div className="grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-4 mb-10">+ {folders.map((folder) => (+ <Folder key={folder.id} {...folder} />+ ))}+ </div>+ </>)}++ <h1 className="mb-4 text-2xl font-medium text-gray-12">Videos</h1><div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">{data.map((cap) => (<SharedCapCard@@ -223,6 +263,7 @@ export const SharedCaps = ({hideSharedStatusanalytics={analytics[cap.id] || 0}organizationName={activeOrganization?.organization.name || ""}+ spaceName={spaceData?.name || ""}userId={currentUserId}/>))}diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/MembersIndicator.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/MembersIndicator.tsxindex ae1400293..5c7e7327c 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/MembersIndicator.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/MembersIndicator.tsx@@ -107,7 +107,7 @@ export const MembersIndicator = ({);return (- <div className="flex gap-3 items-center mb-4">+ <div className="flex gap-3 items-center"><Dialog open={open} onOpenChange={setOpen}><DialogTrigger asChild><Button variant="gray" size="sm" className="z-10">diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/OrganizationIndicator.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/OrganizationIndicator.tsxindex 45b81e7ef..b47e846a1 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/OrganizationIndicator.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/OrganizationIndicator.tsx@@ -45,7 +45,7 @@ export const OrganizationIndicator = ({const [open, setOpen] = useState(false);return (- <div className="flex gap-3 items-center mb-4">+ <div className="flex gap-3 items-center"><Dialog open={open} onOpenChange={setOpen}><DialogTrigger asChild><Button variant="gray" size="sm" className="z-10">diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsxindex 9c093e643..c6a402d74 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx@@ -18,6 +18,7 @@ interface SharedCapCardProps {organizationName: string;userId?: string;hideSharedStatus?: boolean;+ spaceName?: string;}export const SharedCapCard: React.FC<SharedCapCardProps> = ({@@ -26,6 +27,7 @@ export const SharedCapCard: React.FC<SharedCapCardProps> = ({organizationName,userId,hideSharedStatus,+ spaceName,}) => {const displayCount =analytics === 0@@ -55,9 +57,9 @@ export const SharedCapCard: React.FC<SharedCapCardProps> = ({className="text-gray-10 size-2.5"/><p className="text-sm pointer-events-none text-gray-10">- Shared with{" "}+ Shared with{" "}<span className="text-sm font-medium text-gray-12">- {organizationName}+ {spaceName || organizationName}</span></p></div>diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsxnew file mode 100644index 000000000..50186defd--- /dev/null+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx@@ -0,0 +1,70 @@+import { ClientMyCapsLink, NewSubfolderButton, BreadcrumbItem } from "../../../../folder/[id]/components";+import Folder from "@/app/(org)/dashboard/caps/components/Folder";+import { getFolderBreadcrumb } from "@/actions/folders/getFolderBreadcrumb";+import { getChildFolders } from "@/actions/folders/getChildFolders";+import { getVideosByFolderId } from "@/actions/folders/getVideosByFolderId";+import { serverEnv } from "@cap/env";+import FolderVideosSection from "../../../../folder/[id]/components/FolderVideosSection";+import { getCurrentUser } from "@cap/database/auth/session";++const FolderPage = async ({ params }: { params: { spaceId: string; folderId: string } }) => {+ const [childFolders, breadcrumb, videosData] = await Promise.all([+ getChildFolders(params.folderId),+ getFolderBreadcrumb(params.folderId),+ getVideosByFolderId(params.folderId),+ ]);+ const user = await getCurrentUser();+ const userId = user?.id as string;++ return (+ <div>+ <div className="flex gap-2 items-center mb-10">+ <NewSubfolderButton parentFolderId={params.folderId} />+ </div>+ <div className="flex justify-between items-center mb-6 w-full">+ <div className="flex overflow-x-auto items-center font-medium">+ <ClientMyCapsLink />+ {breadcrumb.map((folder, index) => (+ <div key={folder.id} className="flex items-center">+ <p className="mx-2 text-gray-10">/</p>+ <BreadcrumbItem+ id={folder.id}+ name={folder.name}+ color={folder.color}+ isLast={index === breadcrumb.length - 1}+ />+ </div>+ ))}+ </div>+ </div>+ {/* Display Child Folders */}+ {childFolders.length > 0 && (+ <>+ <h1 className="mb-6 text-xl font-medium text-gray-12">Subfolders</h1>+ <div className="grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-4 mb-10">+ {childFolders.map((folder) => (+ <Folder+ key={folder.id}+ name={folder.name}+ color={folder.color}+ spaceId={params.spaceId}+ id={folder.id}+ parentId={folder.parentId}+ videoCount={folder.videoCount}+ />+ ))}+ </div>+ </>+ )}+ {/* Display Videos */}+ <FolderVideosSection+ cardType="shared"+ initialVideos={videosData}+ dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}+ userId={userId}+ />+ </div>+ );+};++export default FolderPage;diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsxindex f7ce78e67..092b24e51 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx@@ -10,8 +10,9 @@ import {spaces,spaceMembers,spaceVideos,+ folders,} from "@cap/database/schema";-import { count, desc, eq, sql, and } from "drizzle-orm";+import { count, desc, eq, sql, and, isNull } from "drizzle-orm";import { Metadata } from "next";import { SharedCaps } from "./SharedCaps";import { notFound } from "next/navigation";@@ -70,6 +71,27 @@ async function fetchOrganizationData(id: string) {.limit(1);}+async function fetchFolders(spaceId: string) {+ return db()+ .select({+ id: folders.id,+ name: folders.name,+ color: folders.color,+ parentId: folders.parentId,+ spaceId: folders.spaceId,+ videoCount: sql<number>`(+ SELECT COUNT(*) FROM videos WHERE videos.folderId = folders.id+ )`,+ })+ .from(folders)+ .where(+ and(+ eq(folders.spaceId, spaceId),+ isNull(folders.parentId)+ )+ );+}+async function fetchSpaceMembers(spaceId: string) {return db().select({@@ -156,9 +178,10 @@ export default async function SharedCapsPage({if (!hasAccess) notFound();// Fetch members in parallel- const [spaceMembersData, organizationMembersData] = await Promise.all([+ const [spaceMembersData, organizationMembersData, foldersData] = await Promise.all([fetchSpaceMembers(id),fetchOrganizationMembers(space.organizationId),+ fetchFolders(id),]);// --- Video fetching helpers ---@@ -185,7 +208,7 @@ export default async function SharedCapsPage({.innerJoin(videos, eq(spaceVideos.videoId, videos.id)).leftJoin(comments, eq(videos.id, comments.videoId)).leftJoin(users, eq(videos.ownerId, users.id))- .where(eq(spaceVideos.spaceId, spaceId))+ .where(and(eq(spaceVideos.spaceId, spaceId), isNull(spaceVideos.folderId))).groupBy(videos.id,videos.ownerId,@@ -204,7 +227,7 @@ export default async function SharedCapsPage({db().select({ count: count() }).from(spaceVideos)- .where(eq(spaceVideos.spaceId, spaceId)),+ .where(and(eq(spaceVideos.spaceId, spaceId), isNull(spaceVideos.folderId))),]);return {videos: videoRows,@@ -224,7 +247,7 @@ export default async function SharedCapsPage({...videoWithoutEffectiveDate,ownerName: video.ownerName ?? null,metadata: video.metadata as- | { customCreatedAt?: string; [key: string]: any }+ | { customCreatedAt?: string;[key: string]: any }| undefined,};});@@ -237,6 +260,7 @@ export default async function SharedCapsPage({spaceMembers={spaceMembersData}organizationMembers={organizationMembersData}currentUserId={userId}+ folders={foldersData}/>);} else {@@ -260,6 +284,7 @@ export default async function SharedCapsPage({}}+// --- Organization video fetching helper ---async function fetchOrganizationVideos(orgId: string,@@ -311,26 +336,27 @@ export default async function SharedCapsPage({};}+// Fetch videos and count in parallel- const { videos: orgVideoData, totalCount } = await fetchOrganizationVideos(- id,- page,- limit- );++ const [organizationVideos, organizationMembersData, foldersData] = await Promise.all([+ fetchOrganizationVideos(id, page, limit),+ fetchOrganizationMembers(id),+ fetchFolders(id),+ ]);++ const { videos: orgVideoData, totalCount } = organizationVideos;const processedVideoData = orgVideoData.map((video) => {const { effectiveDate, ...videoWithoutEffectiveDate } = video;return {...videoWithoutEffectiveDate,ownerName: video.ownerName ?? null,metadata: video.metadata as- | { customCreatedAt?: string; [key: string]: any }+ | { customCreatedAt?: string;[key: string]: any }| undefined,};});- // Fetch organization members- const organizationMembersData = await fetchOrganizationMembers(id);-return (<SharedCapsdata={processedVideoData}@@ -339,6 +365,7 @@ export default async function SharedCapsPage({organizationData={organization}organizationMembers={organizationMembersData}currentUserId={userId}+ folders={foldersData}/>);}diff --git a/packages/database/migrations/0005_graceful_fenris.sql b/packages/database/migrations/0005_graceful_fenris.sqlnew file mode 100644index 000000000..ea0381b17--- /dev/null+++ b/packages/database/migrations/0005_graceful_fenris.sql@@ -0,0 +1,2 @@+ALTER TABLE `folders` ADD `spaceId` varchar(15);--> statement-breakpoint+CREATE INDEX `space_id_idx` ON `folders` (`spaceId`);\ No newline at end of filediff --git a/packages/database/migrations/0006_woozy_jamie_braddock.sql b/packages/database/migrations/0006_woozy_jamie_braddock.sqlnew file mode 100644index 000000000..5e607cc4b--- /dev/null+++ b/packages/database/migrations/0006_woozy_jamie_braddock.sql@@ -0,0 +1,2 @@+ALTER TABLE `space_videos` ADD `folderId` varchar(15);--> statement-breakpoint+CREATE INDEX `folder_id_idx` ON `space_videos` (`folderId`);\ No newline at end of filediff --git a/packages/database/migrations/meta/0005_snapshot.json b/packages/database/migrations/meta/0005_snapshot.jsonnew file mode 100644index 000000000..409a6daea--- /dev/null+++ b/packages/database/migrations/meta/0005_snapshot.json@@ -0,0 +1,1770 @@+{+ "version": "5",+ "dialect": "mysql",+ "id": "fd21ec29-1327-4043-83d4-a594e87a437a",+ "prevId": "49ce971d-dbc0-4954-80d1-15c0ede03235",+ "tables": {+ "accounts": {+ "name": "accounts",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_in": {+ "name": "expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_in": {+ "name": "refresh_token_expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "tempColumn": {+ "name": "tempColumn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "provider_account_id_idx": {+ "name": "provider_account_id_idx",+ "columns": [+ "providerAccountId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "accounts_id": {+ "name": "accounts_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "accounts_id_unique": {+ "name": "accounts_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "auth_api_keys": {+ "name": "auth_api_keys",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(36)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "auth_api_keys_id": {+ "name": "auth_api_keys_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "auth_api_keys_id_unique": {+ "name": "auth_api_keys_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "comments": {+ "name": "comments",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(6)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "timestamp": {+ "name": "timestamp",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "authorId": {+ "name": "authorId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "parentCommentId": {+ "name": "parentCommentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "author_id_idx": {+ "name": "author_id_idx",+ "columns": [+ "authorId"+ ],+ "isUnique": false+ },+ "parent_comment_id_idx": {+ "name": "parent_comment_id_idx",+ "columns": [+ "parentCommentId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "comments_id": {+ "name": "comments_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "comments_id_unique": {+ "name": "comments_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "folders": {+ "name": "folders",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "varchar(16)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'normal'"+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "parentId": {+ "name": "parentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": [+ "createdById"+ ],+ "isUnique": false+ },+ "parent_id_idx": {+ "name": "parent_id_idx",+ "columns": [+ "parentId"+ ],+ "isUnique": false+ },+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "folders_id": {+ "name": "folders_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "folders_id_unique": {+ "name": "folders_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organization_invites": {+ "name": "organization_invites",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedEmail": {+ "name": "invitedEmail",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedByUserId": {+ "name": "invitedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "invited_email_idx": {+ "name": "invited_email_idx",+ "columns": [+ "invitedEmail"+ ],+ "isUnique": false+ },+ "invited_by_user_id_idx": {+ "name": "invited_by_user_id_idx",+ "columns": [+ "invitedByUserId"+ ],+ "isUnique": false+ },+ "status_idx": {+ "name": "status_idx",+ "columns": [+ "status"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_invites_id": {+ "name": "organization_invites_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organization_invites_id_unique": {+ "name": "organization_invites_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organization_members": {+ "name": "organization_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "user_id_organization_id_idx": {+ "name": "user_id_organization_id_idx",+ "columns": [+ "userId",+ "organizationId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_members_id": {+ "name": "organization_members_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organization_members_id_unique": {+ "name": "organization_members_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organizations": {+ "name": "organizations",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "allowedEmailDomain": {+ "name": "allowedEmailDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customDomain": {+ "name": "customDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "domainVerified": {+ "name": "domainVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(1024)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "workosOrganizationId": {+ "name": "workosOrganizationId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workosConnectionId": {+ "name": "workosConnectionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": [+ "ownerId"+ ],+ "isUnique": false+ },+ "custom_domain_idx": {+ "name": "custom_domain_idx",+ "columns": [+ "customDomain"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organizations_id": {+ "name": "organizations_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organizations_id_unique": {+ "name": "organizations_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "s3_buckets": {+ "name": "s3_buckets",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "endpoint": {+ "name": "endpoint",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucketName": {+ "name": "bucketName",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "accessKeyId": {+ "name": "accessKeyId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "secretAccessKey": {+ "name": "secretAccessKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('aws')"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "s3_buckets_id": {+ "name": "s3_buckets_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "s3_buckets_id_unique": {+ "name": "s3_buckets_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "sessions": {+ "name": "sessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sessionToken": {+ "name": "sessionToken",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "session_token_idx": {+ "name": "session_token_idx",+ "columns": [+ "sessionToken"+ ],+ "isUnique": true+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "sessions_id": {+ "name": "sessions_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "sessions_id_unique": {+ "name": "sessions_id_unique",+ "columns": [+ "id"+ ]+ },+ "sessions_sessionToken_unique": {+ "name": "sessions_sessionToken_unique",+ "columns": [+ "sessionToken"+ ]+ }+ },+ "checkConstraint": {}+ },+ "shared_videos": {+ "name": "shared_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedByUserId": {+ "name": "sharedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedAt": {+ "name": "sharedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "shared_by_user_id_idx": {+ "name": "shared_by_user_id_idx",+ "columns": [+ "sharedByUserId"+ ],+ "isUnique": false+ },+ "video_id_organization_id_idx": {+ "name": "video_id_organization_id_idx",+ "columns": [+ "videoId",+ "organizationId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "shared_videos_id": {+ "name": "shared_videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "shared_videos_id_unique": {+ "name": "shared_videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "space_members": {+ "name": "space_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "space_id_user_id_idx": {+ "name": "space_id_user_id_idx",+ "columns": [+ "spaceId",+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_members_id": {+ "name": "space_members_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "space_members_id_unique": {+ "name": "space_members_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "space_videos": {+ "name": "space_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedById": {+ "name": "addedById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedAt": {+ "name": "addedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ },+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "added_by_id_idx": {+ "name": "added_by_id_idx",+ "columns": [+ "addedById"+ ],+ "isUnique": false+ },+ "space_id_video_id_idx": {+ "name": "space_id_video_id_idx",+ "columns": [+ "spaceId",+ "videoId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_videos_id": {+ "name": "space_videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "space_videos_id_unique": {+ "name": "space_videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "spaces": {+ "name": "spaces",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "primary": {+ "name": "primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "privacy": {+ "name": "privacy",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'Private'"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": [+ "createdById"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "spaces_id": {+ "name": "spaces_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "spaces_id_unique": {+ "name": "spaces_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "lastName": {+ "name": "lastName",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionId": {+ "name": "stripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thirdPartyStripeSubscriptionId": {+ "name": "thirdPartyStripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionStatus": {+ "name": "stripeSubscriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionPriceId": {+ "name": "stripeSubscriptionPriceId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "onboarding_completed_at": {+ "name": "onboarding_completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customBucket": {+ "name": "customBucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "inviteQuota": {+ "name": "inviteQuota",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 1+ }+ },+ "indexes": {+ "email_idx": {+ "name": "email_idx",+ "columns": [+ "email"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "users_id": {+ "name": "users_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "users_id_unique": {+ "name": "users_id_unique",+ "columns": [+ "id"+ ]+ },+ "users_email_unique": {+ "name": "users_email_unique",+ "columns": [+ "email"+ ]+ }+ },+ "checkConstraint": {}+ },+ "verification_tokens": {+ "name": "verification_tokens",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verification_tokens_identifier": {+ "name": "verification_tokens_identifier",+ "columns": [+ "identifier"+ ]+ }+ },+ "uniqueConstraints": {+ "verification_tokens_token_unique": {+ "name": "verification_tokens_token_unique",+ "columns": [+ "token"+ ]+ }+ },+ "checkConstraint": {}+ },+ "videos": {+ "name": "videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'My Video'"+ },+ "awsRegion": {+ "name": "awsRegion",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "awsBucket": {+ "name": "awsBucket",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucket": {+ "name": "bucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoStartTime": {+ "name": "videoStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "audioStartTime": {+ "name": "audioStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "xStreamInfo": {+ "name": "xStreamInfo",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobId": {+ "name": "jobId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobStatus": {+ "name": "jobStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "isScreenshot": {+ "name": "isScreenshot",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "skipProcessing": {+ "name": "skipProcessing",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "transcriptionStatus": {+ "name": "transcriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "source": {+ "name": "source",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('{\"type\":\"MediaConvert\"}')"+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "id_idx": {+ "name": "id_idx",+ "columns": [+ "id"+ ],+ "isUnique": false+ },+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": [+ "ownerId"+ ],+ "isUnique": false+ },+ "is_public_idx": {+ "name": "is_public_idx",+ "columns": [+ "public"+ ],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": [+ "folderId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "videos_id": {+ "name": "videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "videos_id_unique": {+ "name": "videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ }+ },+ "views": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "tables": {},+ "indexes": {}+ }+}\ No newline at end of filediff --git a/packages/database/migrations/meta/0006_snapshot.json b/packages/database/migrations/meta/0006_snapshot.jsonnew file mode 100644index 000000000..8e6769e08--- /dev/null+++ b/packages/database/migrations/meta/0006_snapshot.json@@ -0,0 +1,1784 @@+{+ "version": "5",+ "dialect": "mysql",+ "id": "140a5aa9-5b37-4435-baeb-5fd016ef5c6e",+ "prevId": "fd21ec29-1327-4043-83d4-a594e87a437a",+ "tables": {+ "accounts": {+ "name": "accounts",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "providerAccountId": {+ "name": "providerAccountId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_in": {+ "name": "expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_in": {+ "name": "refresh_token_expires_in",+ "type": "int",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "tempColumn": {+ "name": "tempColumn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "provider_account_id_idx": {+ "name": "provider_account_id_idx",+ "columns": [+ "providerAccountId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "accounts_id": {+ "name": "accounts_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "accounts_id_unique": {+ "name": "accounts_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "auth_api_keys": {+ "name": "auth_api_keys",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(36)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "auth_api_keys_id": {+ "name": "auth_api_keys_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "auth_api_keys_id_unique": {+ "name": "auth_api_keys_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "comments": {+ "name": "comments",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "varchar(6)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "timestamp": {+ "name": "timestamp",+ "type": "float",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "authorId": {+ "name": "authorId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "parentCommentId": {+ "name": "parentCommentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "author_id_idx": {+ "name": "author_id_idx",+ "columns": [+ "authorId"+ ],+ "isUnique": false+ },+ "parent_comment_id_idx": {+ "name": "parent_comment_id_idx",+ "columns": [+ "parentCommentId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "comments_id": {+ "name": "comments_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "comments_id_unique": {+ "name": "comments_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "folders": {+ "name": "folders",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "varchar(16)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'normal'"+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "parentId": {+ "name": "parentId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": [+ "createdById"+ ],+ "isUnique": false+ },+ "parent_id_idx": {+ "name": "parent_id_idx",+ "columns": [+ "parentId"+ ],+ "isUnique": false+ },+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "folders_id": {+ "name": "folders_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "folders_id_unique": {+ "name": "folders_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organization_invites": {+ "name": "organization_invites",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedEmail": {+ "name": "invitedEmail",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "invitedByUserId": {+ "name": "invitedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "invited_email_idx": {+ "name": "invited_email_idx",+ "columns": [+ "invitedEmail"+ ],+ "isUnique": false+ },+ "invited_by_user_id_idx": {+ "name": "invited_by_user_id_idx",+ "columns": [+ "invitedByUserId"+ ],+ "isUnique": false+ },+ "status_idx": {+ "name": "status_idx",+ "columns": [+ "status"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_invites_id": {+ "name": "organization_invites_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organization_invites_id_unique": {+ "name": "organization_invites_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organization_members": {+ "name": "organization_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "user_id_organization_id_idx": {+ "name": "user_id_organization_id_idx",+ "columns": [+ "userId",+ "organizationId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organization_members_id": {+ "name": "organization_members_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organization_members_id_unique": {+ "name": "organization_members_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "organizations": {+ "name": "organizations",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "allowedEmailDomain": {+ "name": "allowedEmailDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customDomain": {+ "name": "customDomain",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "domainVerified": {+ "name": "domainVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(1024)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "workosOrganizationId": {+ "name": "workosOrganizationId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workosConnectionId": {+ "name": "workosConnectionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": [+ "ownerId"+ ],+ "isUnique": false+ },+ "custom_domain_idx": {+ "name": "custom_domain_idx",+ "columns": [+ "customDomain"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "organizations_id": {+ "name": "organizations_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "organizations_id_unique": {+ "name": "organizations_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "s3_buckets": {+ "name": "s3_buckets",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "endpoint": {+ "name": "endpoint",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucketName": {+ "name": "bucketName",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "accessKeyId": {+ "name": "accessKeyId",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "secretAccessKey": {+ "name": "secretAccessKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('aws')"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "s3_buckets_id": {+ "name": "s3_buckets_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "s3_buckets_id_unique": {+ "name": "s3_buckets_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "sessions": {+ "name": "sessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sessionToken": {+ "name": "sessionToken",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "session_token_idx": {+ "name": "session_token_idx",+ "columns": [+ "sessionToken"+ ],+ "isUnique": true+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "sessions_id": {+ "name": "sessions_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "sessions_id_unique": {+ "name": "sessions_id_unique",+ "columns": [+ "id"+ ]+ },+ "sessions_sessionToken_unique": {+ "name": "sessions_sessionToken_unique",+ "columns": [+ "sessionToken"+ ]+ }+ },+ "checkConstraint": {}+ },+ "shared_videos": {+ "name": "shared_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedByUserId": {+ "name": "sharedByUserId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "sharedAt": {+ "name": "sharedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "shared_by_user_id_idx": {+ "name": "shared_by_user_id_idx",+ "columns": [+ "sharedByUserId"+ ],+ "isUnique": false+ },+ "video_id_organization_id_idx": {+ "name": "video_id_organization_id_idx",+ "columns": [+ "videoId",+ "organizationId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "shared_videos_id": {+ "name": "shared_videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "shared_videos_id_unique": {+ "name": "shared_videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "space_members": {+ "name": "space_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "userId": {+ "name": "userId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ },+ "user_id_idx": {+ "name": "user_id_idx",+ "columns": [+ "userId"+ ],+ "isUnique": false+ },+ "space_id_user_id_idx": {+ "name": "space_id_user_id_idx",+ "columns": [+ "spaceId",+ "userId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_members_id": {+ "name": "space_members_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "space_members_id_unique": {+ "name": "space_members_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "space_videos": {+ "name": "space_videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "spaceId": {+ "name": "spaceId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoId": {+ "name": "videoId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedById": {+ "name": "addedById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "addedAt": {+ "name": "addedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ }+ },+ "indexes": {+ "space_id_idx": {+ "name": "space_id_idx",+ "columns": [+ "spaceId"+ ],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": [+ "folderId"+ ],+ "isUnique": false+ },+ "video_id_idx": {+ "name": "video_id_idx",+ "columns": [+ "videoId"+ ],+ "isUnique": false+ },+ "added_by_id_idx": {+ "name": "added_by_id_idx",+ "columns": [+ "addedById"+ ],+ "isUnique": false+ },+ "space_id_video_id_idx": {+ "name": "space_id_video_id_idx",+ "columns": [+ "spaceId",+ "videoId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "space_videos_id": {+ "name": "space_videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "space_videos_id_unique": {+ "name": "space_videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "spaces": {+ "name": "spaces",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "primary": {+ "name": "primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "createdById": {+ "name": "createdById",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "iconUrl": {+ "name": "iconUrl",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "varchar(1000)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "privacy": {+ "name": "privacy",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'Private'"+ }+ },+ "indexes": {+ "organization_id_idx": {+ "name": "organization_id_idx",+ "columns": [+ "organizationId"+ ],+ "isUnique": false+ },+ "created_by_id_idx": {+ "name": "created_by_id_idx",+ "columns": [+ "createdById"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "spaces_id": {+ "name": "spaces_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "spaces_id_unique": {+ "name": "spaces_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "lastName": {+ "name": "lastName",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionId": {+ "name": "stripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "thirdPartyStripeSubscriptionId": {+ "name": "thirdPartyStripeSubscriptionId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionStatus": {+ "name": "stripeSubscriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripeSubscriptionPriceId": {+ "name": "stripeSubscriptionPriceId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "onboarding_completed_at": {+ "name": "onboarding_completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "customBucket": {+ "name": "customBucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "inviteQuota": {+ "name": "inviteQuota",+ "type": "int",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 1+ }+ },+ "indexes": {+ "email_idx": {+ "name": "email_idx",+ "columns": [+ "email"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "users_id": {+ "name": "users_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "users_id_unique": {+ "name": "users_id_unique",+ "columns": [+ "id"+ ]+ },+ "users_email_unique": {+ "name": "users_email_unique",+ "columns": [+ "email"+ ]+ }+ },+ "checkConstraint": {}+ },+ "verification_tokens": {+ "name": "verification_tokens",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "datetime",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verification_tokens_identifier": {+ "name": "verification_tokens_identifier",+ "columns": [+ "identifier"+ ]+ }+ },+ "uniqueConstraints": {+ "verification_tokens_token_unique": {+ "name": "verification_tokens_token_unique",+ "columns": [+ "token"+ ]+ }+ },+ "checkConstraint": {}+ },+ "videos": {+ "name": "videos",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ownerId": {+ "name": "ownerId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'My Video'"+ },+ "awsRegion": {+ "name": "awsRegion",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "awsBucket": {+ "name": "awsBucket",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "bucket": {+ "name": "bucket",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "metadata": {+ "name": "metadata",+ "type": "json",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "videoStartTime": {+ "name": "videoStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "audioStartTime": {+ "name": "audioStartTime",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "xStreamInfo": {+ "name": "xStreamInfo",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobId": {+ "name": "jobId",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "jobStatus": {+ "name": "jobStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "isScreenshot": {+ "name": "isScreenshot",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "skipProcessing": {+ "name": "skipProcessing",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "transcriptionStatus": {+ "name": "transcriptionStatus",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(now())"+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "onUpdate": true,+ "default": "(now())"+ },+ "source": {+ "name": "source",+ "type": "json",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "('{\"type\":\"MediaConvert\"}')"+ },+ "folderId": {+ "name": "folderId",+ "type": "varchar(15)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "id_idx": {+ "name": "id_idx",+ "columns": [+ "id"+ ],+ "isUnique": false+ },+ "owner_id_idx": {+ "name": "owner_id_idx",+ "columns": [+ "ownerId"+ ],+ "isUnique": false+ },+ "is_public_idx": {+ "name": "is_public_idx",+ "columns": [+ "public"+ ],+ "isUnique": false+ },+ "folder_id_idx": {+ "name": "folder_id_idx",+ "columns": [+ "folderId"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "videos_id": {+ "name": "videos_id",+ "columns": [+ "id"+ ]+ }+ },+ "uniqueConstraints": {+ "videos_id_unique": {+ "name": "videos_id_unique",+ "columns": [+ "id"+ ]+ }+ },+ "checkConstraint": {}+ }+ },+ "views": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "tables": {},+ "indexes": {}+ }+}\ No newline at end of filediff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex faaa038cb..818cb035b 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -36,6 +36,20 @@"when": 1751299325634,"tag": "0004_optimal_eddie_brock","breakpoints": true+ },+ {+ "idx": 5,+ "version": "5",+ "when": 1751979972128,+ "tag": "0005_graceful_fenris",+ "breakpoints": true+ },+ {+ "idx": 6,+ "version": "5",+ "when": 1751982995648,+ "tag": "0006_woozy_jamie_braddock",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/database/schema.ts b/packages/database/schema.tsindex d7b2a3dc3..2db1a7fef 100644--- a/packages/database/schema.ts+++ b/packages/database/schema.ts@@ -196,10 +196,16 @@ export const folders = mysqlTable({id: nanoId("id").notNull().primaryKey().unique(),name: varchar("name", { length: 255 }).notNull(),- color: varchar("color", { length: 16, enum: ["normal", "blue", "red", "yellow"] }).notNull().default("normal"),+ color: varchar("color", {+ length: 16,+ enum: ["normal", "blue", "red", "yellow"],+ })+ .notNull()+ .default("normal"),organizationId: nanoId("organizationId").notNull(),createdById: nanoId("createdById").notNull(),parentId: nanoIdNullable("parentId"),+ spaceId: nanoIdNullable("spaceId"),createdAt: timestamp("createdAt").notNull().defaultNow(),updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),},@@ -207,6 +213,7 @@ export const folders = mysqlTable(organizationIdIndex: index("organization_id_idx").on(table.organizationId),createdByIdIndex: index("created_by_id_idx").on(table.createdById),parentIdIndex: index("parent_id_idx").on(table.parentId),+ spaceIdIndex: index("space_id_idx").on(table.spaceId),}));@@ -436,8 +443,6 @@ export const sharedVideosRelations = relations(sharedVideos, ({ one }) => ({}),}));--export const spaces = mysqlTable("spaces",{@@ -485,12 +490,14 @@ export const spaceVideos = mysqlTable({id: nanoId("id").notNull().primaryKey().unique(),spaceId: nanoId("spaceId").notNull(),+ folderId: nanoIdNullable("folderId"),videoId: nanoId("videoId").notNull(),addedById: nanoId("addedById").notNull(),addedAt: timestamp("addedAt").notNull().defaultNow(),},(table) => ({spaceIdIndex: index("space_id_idx").on(table.spaceId),+ folderIdIndex: index("folder_id_idx").on(table.folderId),videoIdIndex: index("video_id_idx").on(table.videoId),addedByIdIndex: index("added_by_id_idx").on(table.addedById),spaceIdVideoIdIndex: index("space_id_video_id_idx").on(@@ -551,7 +558,7 @@ export const foldersRelations = relations(folders, ({ one, many }) => ({parentFolder: one(folders, {fields: [folders.parentId],references: [folders.id],- relationName: "parentChild"+ relationName: "parentChild",}),childFolders: many(folders, { relationName: "parentChild" }),videos: many(videos),