From 1e0ee34130c568af55ae3c625488469a00700f6d Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:37:00 +0000 Subject: [PATCH 01/27] feat(database): add note caps and a table for their content --- .../migrations/0068_concerned_blue_marvel.sql | 18 + .../migrations/meta/0068_snapshot.json | 6896 +++++++++++++++++ .../database/migrations/meta/_journal.json | 7 + packages/database/schema.ts | 31 + 4 files changed, 6952 insertions(+) create mode 100644 packages/database/migrations/0068_concerned_blue_marvel.sql create mode 100644 packages/database/migrations/meta/0068_snapshot.json diff --git a/packages/database/migrations/0068_concerned_blue_marvel.sql b/packages/database/migrations/0068_concerned_blue_marvel.sql new file mode 100644 index 00000000000..8ebb75458fe --- /dev/null +++ b/packages/database/migrations/0068_concerned_blue_marvel.sql @@ -0,0 +1,18 @@ +CREATE TABLE `video_notes` ( + `videoId` varchar(15) NOT NULL, + `ownerId` varchar(15) NOT NULL, + `documentId` varchar(64) NOT NULL, + `excerpt` varchar(512) NOT NULL DEFAULT '', + `summaryMarkdown` mediumtext, + `notesMarkdown` mediumtext, + `transcript` json, + `participants` json, + `meetingStartedAt` timestamp, + `createdAt` timestamp NOT NULL DEFAULT (now()), + `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, + CONSTRAINT `video_notes_videoId` PRIMARY KEY(`videoId`), + CONSTRAINT `owner_document_idx` UNIQUE(`ownerId`,`documentId`) +); +--> statement-breakpoint +ALTER TABLE `videos` ADD `isNote` boolean DEFAULT false NOT NULL;--> statement-breakpoint +ALTER TABLE `video_notes` ADD CONSTRAINT `video_notes_videoId_videos_id_fk` FOREIGN KEY (`videoId`) REFERENCES `videos`(`id`) ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/packages/database/migrations/meta/0068_snapshot.json b/packages/database/migrations/meta/0068_snapshot.json new file mode 100644 index 00000000000..21580c2d841 --- /dev/null +++ b/packages/database/migrations/meta/0068_snapshot.json @@ -0,0 +1,6896 @@ +{ + "version": "5", + "dialect": "mysql", + "id": "82df3051-e0f5-46f3-8f0d-debf387ba52d", + "prevId": "6b499e71-fe96-4123-8a0a-6efafb6c93ac", + "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": {}, + "checkConstraint": {} + }, + "agent_api_authorization_codes": { + "name": "agent_api_authorization_codes", + "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 + }, + "codeHash": { + "name": "codeHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "codeChallenge": { + "name": "codeChallenge", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "redirectUri": { + "name": "redirectUri", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scopes": { + "name": "scopes", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "consumedAt": { + "name": "consumedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "code_hash_idx": { + "name": "code_hash_idx", + "columns": ["codeHash"], + "isUnique": true + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + }, + "user_created_at_idx": { + "name": "user_created_at_idx", + "columns": ["userId", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "agent_api_authorization_codes_id": { + "name": "agent_api_authorization_codes_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "agent_api_idempotency": { + "name": "agent_api_idempotency", + "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 + }, + "operation": { + "name": "operation", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "keyHash": { + "name": "keyHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "requestHash": { + "name": "requestHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "statusCode": { + "name": "statusCode", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response": { + "name": "response", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "timestamp", + "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_operation_key_idx": { + "name": "user_operation_key_idx", + "columns": ["userId", "operation", "keyHash"], + "isUnique": true + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "agent_api_idempotency_id": { + "name": "agent_api_idempotency_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "agent_api_keys": { + "name": "agent_api_keys", + "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 + }, + "tokenHash": { + "name": "tokenHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'Cap CLI'" + }, + "scopes": { + "name": "scopes", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revokedAt": { + "name": "revokedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "lastUsedAt": { + "name": "lastUsedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "token_hash_idx": { + "name": "token_hash_idx", + "columns": ["tokenHash"], + "isUnique": true + }, + "user_created_at_idx": { + "name": "user_created_at_idx", + "columns": ["userId", "createdAt"], + "isUnique": false + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "agent_api_keys_id": { + "name": "agent_api_keys_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "agent_api_operations": { + "name": "agent_api_operations", + "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 + }, + "kind": { + "name": "kind", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resourceId": { + "name": "resourceId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resultResourceId": { + "name": "resultResourceId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'queued'" + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "result": { + "name": "result", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errorCode": { + "name": "errorCode", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errorMessage": { + "name": "errorMessage", + "type": "text", + "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())" + }, + "completedAt": { + "name": "completedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "user_created_at_idx": { + "name": "user_created_at_idx", + "columns": ["userId", "createdAt"], + "isUnique": false + }, + "state_updated_at_idx": { + "name": "state_updated_at_idx", + "columns": ["state", "updatedAt"], + "isUnique": false + }, + "resource_id_idx": { + "name": "resource_id_idx", + "columns": ["resourceId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "agent_api_operations_id": { + "name": "agent_api_operations_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "source": { + "name": "source", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "user_id_created_at_idx": { + "name": "user_id_created_at_idx", + "columns": ["userId", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "auth_api_keys_id": { + "name": "auth_api_keys_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "auth_challenges": { + "name": "auth_challenges", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purpose": { + "name": "purpose", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secretHash": { + "name": "secretHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "attempts": { + "name": "attempts", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expiresAt": { + "name": "expiresAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "secret_hash_idx": { + "name": "secret_hash_idx", + "columns": ["secretHash"], + "isUnique": true + }, + "user_purpose_idx": { + "name": "user_purpose_idx", + "columns": ["userId", "purpose"], + "isUnique": false + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "auth_challenges_id": { + "name": "auth_challenges_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "mediaKey": { + "name": "mediaKey", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mediaDuration": { + "name": "mediaDuration", + "type": "float", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mediaMeta": { + "name": "mediaMeta", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "video_type_created_idx": { + "name": "video_type_created_idx", + "columns": ["videoId", "type", "createdAt", "id"], + "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": {}, + "checkConstraint": {} + }, + "developer_api_keys": { + "name": "developer_api_keys", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "keyType": { + "name": "keyType", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "keyPrefix": { + "name": "keyPrefix", + "type": "varchar(12)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "keyHash": { + "name": "keyHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encryptedKey": { + "name": "encryptedKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lastUsedAt": { + "name": "lastUsedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revokedAt": { + "name": "revokedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "key_hash_idx": { + "name": "key_hash_idx", + "columns": ["keyHash"], + "isUnique": true + }, + "app_key_type_idx": { + "name": "app_key_type_idx", + "columns": ["appId", "keyType"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_api_keys_appId_developer_apps_id_fk": { + "name": "developer_api_keys_appId_developer_apps_id_fk", + "tableFrom": "developer_api_keys", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_api_keys_id": { + "name": "developer_api_keys_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_app_domains": { + "name": "developer_app_domains", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "domain": { + "name": "domain", + "type": "varchar(253)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": {}, + "foreignKeys": { + "developer_app_domains_appId_developer_apps_id_fk": { + "name": "developer_app_domains_appId_developer_apps_id_fk", + "tableFrom": "developer_app_domains", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_app_domains_id": { + "name": "developer_app_domains_id", + "columns": ["id"] + } + }, + "uniqueConstraints": { + "app_domain_unique": { + "name": "app_domain_unique", + "columns": ["appId", "domain"] + } + }, + "checkConstraint": {} + }, + "developer_apps": { + "name": "developer_apps", + "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 + }, + "environment": { + "name": "environment", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "logoUrl": { + "name": "logoUrl", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deletedAt": { + "name": "deletedAt", + "type": "timestamp", + "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": { + "owner_deleted_idx": { + "name": "owner_deleted_idx", + "columns": ["ownerId", "deletedAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "developer_apps_id": { + "name": "developer_apps_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_credit_accounts": { + "name": "developer_credit_accounts", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ownerId": { + "name": "ownerId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "balanceMicroCredits": { + "name": "balanceMicroCredits", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "stripeCustomerId": { + "name": "stripeCustomerId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripePaymentMethodId": { + "name": "stripePaymentMethodId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "autoTopUpEnabled": { + "name": "autoTopUpEnabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "autoTopUpThresholdMicroCredits": { + "name": "autoTopUpThresholdMicroCredits", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "autoTopUpAmountCents": { + "name": "autoTopUpAmountCents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "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": { + "app_id_unique": { + "name": "app_id_unique", + "columns": ["appId"], + "isUnique": true + }, + "owner_idx": { + "name": "owner_idx", + "columns": ["ownerId"], + "isUnique": false + }, + "auto_top_up_idx": { + "name": "auto_top_up_idx", + "columns": ["autoTopUpEnabled"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_credit_accounts_appId_developer_apps_id_fk": { + "name": "developer_credit_accounts_appId_developer_apps_id_fk", + "tableFrom": "developer_credit_accounts", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_credit_accounts_id": { + "name": "developer_credit_accounts_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_credit_transactions": { + "name": "developer_credit_transactions", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accountId": { + "name": "accountId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "amountMicroCredits": { + "name": "amountMicroCredits", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "balanceAfterMicroCredits": { + "name": "balanceAfterMicroCredits", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "referenceId": { + "name": "referenceId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "referenceType": { + "name": "referenceType", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "account_type_created_idx": { + "name": "account_type_created_idx", + "columns": ["accountId", "type", "createdAt"], + "isUnique": false + }, + "account_created_idx": { + "name": "account_created_idx", + "columns": ["accountId", "createdAt"], + "isUnique": false + }, + "account_ref_dedup_idx": { + "name": "account_ref_dedup_idx", + "columns": ["accountId", "referenceId", "referenceType"], + "isUnique": false + }, + "reference_type_id_idx": { + "name": "reference_type_id_idx", + "columns": ["referenceType", "referenceId"], + "isUnique": false + } + }, + "foreignKeys": { + "dev_credit_txn_account_fk": { + "name": "dev_credit_txn_account_fk", + "tableFrom": "developer_credit_transactions", + "tableTo": "developer_credit_accounts", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_credit_transactions_id": { + "name": "developer_credit_transactions_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_daily_storage_snapshots": { + "name": "developer_daily_storage_snapshots", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "snapshotDate": { + "name": "snapshotDate", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "totalDurationMinutes": { + "name": "totalDurationMinutes", + "type": "float", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "videoCount": { + "name": "videoCount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "microCreditsCharged": { + "name": "microCreditsCharged", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "processedAt": { + "name": "processedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": {}, + "foreignKeys": { + "developer_daily_storage_snapshots_appId_developer_apps_id_fk": { + "name": "developer_daily_storage_snapshots_appId_developer_apps_id_fk", + "tableFrom": "developer_daily_storage_snapshots", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_daily_storage_snapshots_id": { + "name": "developer_daily_storage_snapshots_id", + "columns": ["id"] + } + }, + "uniqueConstraints": { + "app_date_unique": { + "name": "app_date_unique", + "columns": ["appId", "snapshotDate"] + } + }, + "checkConstraint": {} + }, + "developer_delivery_daily": { + "name": "developer_delivery_daily", + "columns": { + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "day": { + "name": "day", + "type": "date", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tier": { + "name": "tier", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "seconds": { + "name": "seconds", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "bytes": { + "name": "bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "requests": { + "name": "requests", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "abandonedBytes": { + "name": "abandonedBytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "final": { + "name": "final", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "finalizedAt": { + "name": "finalizedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "day_idx": { + "name": "day_idx", + "columns": ["day"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_delivery_daily_appId_developer_apps_id_fk": { + "name": "developer_delivery_daily_appId_developer_apps_id_fk", + "tableFrom": "developer_delivery_daily", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_delivery_daily_appId_day_tier_pk": { + "name": "developer_delivery_daily_appId_day_tier_pk", + "columns": ["appId", "day", "tier"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_delivery_log_files": { + "name": "developer_delivery_log_files", + "columns": { + "logFile": { + "name": "logFile", + "type": "varchar(191)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "etag": { + "name": "etag", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "logHour": { + "name": "logHour", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parts": { + "name": "parts", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "processedAt": { + "name": "processedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "log_hour_idx": { + "name": "log_hour_idx", + "columns": ["logHour"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "developer_delivery_log_files_logFile": { + "name": "developer_delivery_log_files_logFile", + "columns": ["logFile"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_transcripts": { + "name": "developer_transcripts", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "externalUserId": { + "name": "externalUserId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'Untitled'" + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sourceType": { + "name": "sourceType", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sourceUrl": { + "name": "sourceUrl", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "requestedAt": { + "name": "requestedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "s3Key": { + "name": "s3Key", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resultKey": { + "name": "resultKey", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sourceBytes": { + "name": "sourceBytes", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "durationSeconds": { + "name": "durationSeconds", + "type": "float", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "requestedLanguage": { + "name": "requestedLanguage", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "language": { + "name": "language", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "text": { + "name": "text", + "type": "mediumtext", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "wordCount": { + "name": "wordCount", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reservedMicroCredits": { + "name": "reservedMicroCredits", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "billedMicroCredits": { + "name": "billedMicroCredits", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "errorCode": { + "name": "errorCode", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errorMessage": { + "name": "errorMessage", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "runId": { + "name": "runId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "queuedAt": { + "name": "queuedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "startedAt": { + "name": "startedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completedAt": { + "name": "completedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deletedAt": { + "name": "deletedAt", + "type": "timestamp", + "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": { + "dev_transcripts_app_list_idx": { + "name": "dev_transcripts_app_list_idx", + "columns": ["appId", "deletedAt", "createdAt", "id"], + "isUnique": false + }, + "dev_transcripts_app_user_idx": { + "name": "dev_transcripts_app_user_idx", + "columns": ["appId", "externalUserId", "createdAt"], + "isUnique": false + }, + "dev_transcripts_app_status_idx": { + "name": "dev_transcripts_app_status_idx", + "columns": ["appId", "status", "createdAt"], + "isUnique": false + }, + "dev_transcripts_status_updated_idx": { + "name": "dev_transcripts_status_updated_idx", + "columns": ["status", "updatedAt"], + "isUnique": false + }, + "dev_transcripts_app_completed_idx": { + "name": "dev_transcripts_app_completed_idx", + "columns": [ + "appId", + "status", + "completedAt", + "durationSeconds", + "billedMicroCredits" + ], + "isUnique": false + }, + "dev_transcripts_app_status_held_idx": { + "name": "dev_transcripts_app_status_held_idx", + "columns": [ + "appId", + "status", + "createdAt", + "deletedAt", + "reservedMicroCredits" + ], + "isUnique": false + }, + "dev_transcripts_app_video_idx": { + "name": "dev_transcripts_app_video_idx", + "columns": ["appId", "videoId", "requestedAt", "id"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_transcripts_appId_developer_apps_id_fk": { + "name": "developer_transcripts_appId_developer_apps_id_fk", + "tableFrom": "developer_transcripts", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_transcripts_id": { + "name": "developer_transcripts_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_video_imports": { + "name": "developer_video_imports", + "columns": { + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "keyId": { + "name": "keyId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sourceUrl": { + "name": "sourceUrl", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'downloading'" + }, + "bytes": { + "name": "bytes", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errorCode": { + "name": "errorCode", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "startedAt": { + "name": "startedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "finishedAt": { + "name": "finishedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "dev_imports_app_state_idx": { + "name": "dev_imports_app_state_idx", + "columns": ["appId", "state"], + "isUnique": false + }, + "dev_imports_key_created_idx": { + "name": "dev_imports_key_created_idx", + "columns": ["keyId", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_video_imports_appId_developer_apps_id_fk": { + "name": "developer_video_imports_appId_developer_apps_id_fk", + "tableFrom": "developer_video_imports", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_video_imports_videoId": { + "name": "developer_video_imports_videoId", + "columns": ["videoId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_videos": { + "name": "developer_videos", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "externalUserId": { + "name": "externalUserId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'Untitled'" + }, + "duration": { + "name": "duration", + "type": "float", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "width": { + "name": "width", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "height": { + "name": "height", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fps": { + "name": "fps", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "s3Key": { + "name": "s3Key", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "transcriptionStatus": { + "name": "transcriptionStatus", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'uploading'" + }, + "playbackId": { + "name": "playbackId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "maxResolutionTier": { + "name": "maxResolutionTier", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'1080p'" + }, + "renditions": { + "name": "renditions", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "storedBytes": { + "name": "storedBytes", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errorReason": { + "name": "errorReason", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "processing": { + "name": "processing", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "storagePaidUntil": { + "name": "storagePaidUntil", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deletedAt": { + "name": "deletedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "filesDeletedAt": { + "name": "filesDeletedAt", + "type": "timestamp", + "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": { + "app_created_idx": { + "name": "app_created_idx", + "columns": ["appId", "createdAt"], + "isUnique": false + }, + "app_user_idx": { + "name": "app_user_idx", + "columns": ["appId", "externalUserId"], + "isUnique": false + }, + "app_deleted_idx": { + "name": "app_deleted_idx", + "columns": ["appId", "deletedAt"], + "isUnique": false + }, + "playback_id_idx": { + "name": "playback_id_idx", + "columns": ["playbackId"], + "isUnique": true + }, + "files_pending_idx": { + "name": "files_pending_idx", + "columns": ["filesDeletedAt", "deletedAt"], + "isUnique": false + }, + "app_storage_idx": { + "name": "app_storage_idx", + "columns": [ + "appId", + "deletedAt", + "status", + "maxResolutionTier", + "width", + "height", + "storagePaidUntil", + "duration", + "createdAt" + ], + "isUnique": false + }, + "first_month_due_idx": { + "name": "first_month_due_idx", + "columns": ["storagePaidUntil", "status", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_videos_appId_developer_apps_id_fk": { + "name": "developer_videos_appId_developer_apps_id_fk", + "tableFrom": "developer_videos", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_videos_id": { + "name": "developer_videos_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "developer_webhook_endpoints": { + "name": "developer_webhook_endpoints", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appId": { + "name": "appId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secretPrefix": { + "name": "secretPrefix", + "type": "varchar(12)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encryptedSecret": { + "name": "encryptedSecret", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "events": { + "name": "events", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "disabledReason": { + "name": "disabledReason", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastDeliveryAt": { + "name": "lastDeliveryAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastDeliveryStatus": { + "name": "lastDeliveryStatus", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastResponseStatus": { + "name": "lastResponseStatus", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastErrorCode": { + "name": "lastErrorCode", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "consecutiveFailures": { + "name": "consecutiveFailures", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "failingSince": { + "name": "failingSince", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deletedAt": { + "name": "deletedAt", + "type": "timestamp", + "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": { + "dev_webhooks_app_list_idx": { + "name": "dev_webhooks_app_list_idx", + "columns": ["appId", "deletedAt", "createdAt", "id"], + "isUnique": false + } + }, + "foreignKeys": { + "developer_webhook_endpoints_appId_developer_apps_id_fk": { + "name": "developer_webhook_endpoints_appId_developer_apps_id_fk", + "tableFrom": "developer_webhook_endpoints", + "tableTo": "developer_apps", + "columnsFrom": ["appId"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "developer_webhook_endpoints_id": { + "name": "developer_webhook_endpoints_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "directory_users": { + "name": "directory_users", + "columns": { + "id": { + "name": "id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "directoryId": { + "name": "directoryId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "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": { + "directory_users_organization_id_idx": { + "name": "directory_users_organization_id_idx", + "columns": ["organizationId"], + "isUnique": false + }, + "directory_users_user_org_idx": { + "name": "directory_users_user_org_idx", + "columns": ["userId", "organizationId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "directory_users_id": { + "name": "directory_users_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "email_change_requests": { + "name": "email_change_requests", + "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 + }, + "newEmail": { + "name": "newEmail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "codeHash": { + "name": "codeHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "attempts": { + "name": "attempts", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expiresAt": { + "name": "expiresAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "user_id_idx": { + "name": "user_id_idx", + "columns": ["userId"], + "isUnique": false + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "email_change_requests_id": { + "name": "email_change_requests_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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'" + }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false, + "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 + }, + "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 + }, + "public_parent_id_idx": { + "name": "public_parent_id_idx", + "columns": ["public", "parentId"], + "isUnique": false + }, + "public_space_parent_id_idx": { + "name": "public_space_parent_id_idx", + "columns": ["public", "spaceId", "parentId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "folders_id": { + "name": "folders_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "imported_videos": { + "name": "imported_videos", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "orgId": { + "name": "orgId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_id": { + "name": "source_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "id_idx": { + "name": "id_idx", + "columns": ["id"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "imported_videos_orgId_source_source_id_pk": { + "name": "imported_videos_orgId_source_source_id_pk", + "columns": ["orgId", "source", "source_id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "integration_installations": { + "name": "integration_installations", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "externalId": { + "name": "externalId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "installedByUserId": { + "name": "installedByUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encryptedCredentials": { + "name": "encryptedCredentials", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "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": { + "provider_external_id_idx": { + "name": "provider_external_id_idx", + "columns": ["provider", "externalId"], + "isUnique": true + }, + "organization_provider_display_name_idx": { + "name": "organization_provider_display_name_idx", + "columns": ["organizationId", "provider", "displayName"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "integration_installations_id": { + "name": "integration_installations_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "loom_migration_imports": { + "name": "loom_migration_imports", + "columns": { + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "requestId": { + "name": "requestId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "loom_migration_imports_request_idx": { + "name": "loom_migration_imports_request_idx", + "columns": ["requestId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "loom_migration_imports_videoId": { + "name": "loom_migration_imports_videoId", + "columns": ["videoId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "loom_migration_requests": { + "name": "loom_migration_requests", + "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 + }, + "activeOrganizationId": { + "name": "activeOrganizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "requestedByUserId": { + "name": "requestedByUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspaceName": { + "name": "workspaceName", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "customerNote": { + "name": "customerNote", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "customerReply": { + "name": "customerReply", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitedAt": { + "name": "invitedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "capMessage": { + "name": "capMessage", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expectedVideoCount": { + "name": "expectedVideoCount", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "importedVideoCount": { + "name": "importedVideoCount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "queuedVideoCount": { + "name": "queuedVideoCount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "activeImportCount": { + "name": "activeImportCount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "activeImportLeaseToken": { + "name": "activeImportLeaseToken", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "activeImportLeaseUntil": { + "name": "activeImportLeaseUntil", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastOperatorUserId": { + "name": "lastOperatorUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastOperatorAt": { + "name": "lastOperatorAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completedAt": { + "name": "completedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "loom_migration_active_org_idx": { + "name": "loom_migration_active_org_idx", + "columns": ["activeOrganizationId"], + "isUnique": true + }, + "loom_migration_org_created_idx": { + "name": "loom_migration_org_created_idx", + "columns": ["organizationId", "createdAt"], + "isUnique": false + }, + "loom_migration_status_created_idx": { + "name": "loom_migration_status_created_idx", + "columns": ["status", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "loom_migration_requests_id": { + "name": "loom_migration_requests_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "loops_sync_jobs": { + "name": "loops_sync_jobs", + "columns": { + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "nextAttemptAt": { + "name": "nextAttemptAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "leaseToken": { + "name": "leaseToken", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "leaseUntil": { + "name": "leaseUntil", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failures": { + "name": "failures", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "lastError": { + "name": "lastError", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "profileHash": { + "name": "profileHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "teammateJoinedAt": { + "name": "teammateJoinedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "syncedEmail": { + "name": "syncedEmail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastSyncedAt": { + "name": "lastSyncedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "loops_sync_due_idx": { + "name": "loops_sync_due_idx", + "columns": ["nextAttemptAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "loops_sync_jobs_userId": { + "name": "loops_sync_jobs_userId", + "columns": ["userId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mcp_oauth_clients": { + "name": "mcp_oauth_clients", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clientId": { + "name": "clientId", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clientName": { + "name": "clientName", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "redirectUris": { + "name": "redirectUris", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "activatedAt": { + "name": "activatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "client_id_idx": { + "name": "client_id_idx", + "columns": ["clientId"], + "isUnique": true + }, + "inactive_created_at_idx": { + "name": "inactive_created_at_idx", + "columns": ["activatedAt", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mcp_oauth_clients_id": { + "name": "mcp_oauth_clients_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mcp_oauth_codes": { + "name": "mcp_oauth_codes", + "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 + }, + "clientId": { + "name": "clientId", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "codeHash": { + "name": "codeHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "codeChallenge": { + "name": "codeChallenge", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "redirectUri": { + "name": "redirectUri", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resource": { + "name": "resource", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "consumedAt": { + "name": "consumedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "code_hash_idx": { + "name": "code_hash_idx", + "columns": ["codeHash"], + "isUnique": true + }, + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + }, + "user_consumed_idx": { + "name": "user_consumed_idx", + "columns": ["userId", "consumedAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mcp_oauth_codes_id": { + "name": "mcp_oauth_codes_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mcp_oauth_registration_quotas": { + "name": "mcp_oauth_registration_quotas", + "columns": { + "windowId": { + "name": "windowId", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registrations": { + "name": "registrations", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expiresAt": { + "name": "expiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "expires_at_idx": { + "name": "expires_at_idx", + "columns": ["expiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mcp_oauth_registration_quotas_windowId": { + "name": "mcp_oauth_registration_quotas_windowId", + "columns": ["windowId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mcp_oauth_tokens": { + "name": "mcp_oauth_tokens", + "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 + }, + "clientId": { + "name": "clientId", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "familyId": { + "name": "familyId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resource": { + "name": "resource", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessHash": { + "name": "accessHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refreshHash": { + "name": "refreshHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessExpiresAt": { + "name": "accessExpiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refreshExpiresAt": { + "name": "refreshExpiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revokedAt": { + "name": "revokedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "access_hash_idx": { + "name": "access_hash_idx", + "columns": ["accessHash"], + "isUnique": true + }, + "refresh_hash_idx": { + "name": "refresh_hash_idx", + "columns": ["refreshHash"], + "isUnique": true + }, + "family_id_idx": { + "name": "family_id_idx", + "columns": ["familyId"], + "isUnique": false + }, + "user_revoked_idx": { + "name": "user_revoked_idx", + "columns": ["userId", "revokedAt"], + "isUnique": false + }, + "client_active_idx": { + "name": "client_active_idx", + "columns": ["clientId", "revokedAt", "refreshExpiresAt"], + "isUnique": false + }, + "refresh_expires_at_idx": { + "name": "refresh_expires_at_idx", + "columns": ["refreshExpiresAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mcp_oauth_tokens_id": { + "name": "mcp_oauth_tokens_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "media_processing_budgets": { + "name": "media_processing_budgets", + "columns": { + "id": { + "name": "id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reserved_bytes": { + "name": "reserved_bytes", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "limit_bytes": { + "name": "limit_bytes", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "media_budget_expiry_idx": { + "name": "media_budget_expiry_idx", + "columns": ["expires_at"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "media_processing_budgets_id": { + "name": "media_processing_budgets_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "meeting_audio_usage": { + "name": "meeting_audio_usage", + "columns": { + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "day": { + "name": "day", + "type": "date", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "units": { + "name": "units", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "meeting_audio_usage_userId_day_pk": { + "name": "meeting_audio_usage_userId_day_pk", + "columns": ["userId", "day"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "meeting_notes_trial_uses": { + "name": "meeting_notes_trial_uses", + "columns": { + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "meetingId": { + "name": "meetingId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slot": { + "name": "slot", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notesRuns": { + "name": "notesRuns", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "askRuns": { + "name": "askRuns", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "startedAt": { + "name": "startedAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "completedAt": { + "name": "completedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_slot_idx": { + "name": "user_slot_idx", + "columns": ["userId", "slot"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "meeting_notes_trial_uses_userId_meetingId_pk": { + "name": "meeting_notes_trial_uses_userId_meetingId_pk", + "columns": ["userId", "meetingId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "messenger_conversations": { + "name": "messenger_conversations", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "agent": { + "name": "agent", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mode": { + "name": "mode", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'agent'" + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "anonymousId": { + "name": "anonymousId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "takeoverByUserId": { + "name": "takeoverByUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "takeoverAt": { + "name": "takeoverAt", + "type": "timestamp", + "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())" + }, + "lastMessageAt": { + "name": "lastMessageAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "user_last_message_idx": { + "name": "user_last_message_idx", + "columns": ["userId", "lastMessageAt"], + "isUnique": false + }, + "anonymous_last_message_idx": { + "name": "anonymous_last_message_idx", + "columns": ["anonymousId", "lastMessageAt"], + "isUnique": false + }, + "mode_last_message_idx": { + "name": "mode_last_message_idx", + "columns": ["mode", "lastMessageAt"], + "isUnique": false + }, + "updated_at_idx": { + "name": "updated_at_idx", + "columns": ["updatedAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "messenger_conversations_id": { + "name": "messenger_conversations_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "messenger_messages": { + "name": "messenger_messages", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "conversationId": { + "name": "conversationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "anonymousId": { + "name": "anonymousId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "conversation_created_at_idx": { + "name": "conversation_created_at_idx", + "columns": ["conversationId", "createdAt"], + "isUnique": false + }, + "role_created_at_idx": { + "name": "role_created_at_idx", + "columns": ["role", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": { + "messenger_messages_conversationId_messenger_conversations_id_fk": { + "name": "messenger_messages_conversationId_messenger_conversations_id_fk", + "tableFrom": "messenger_messages", + "tableTo": "messenger_conversations", + "columnsFrom": ["conversationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "messenger_messages_id": { + "name": "messenger_messages_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "messenger_support_emails": { + "name": "messenger_support_emails", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "conversationId": { + "name": "conversationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userEmail": { + "name": "userEmail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "subject": { + "name": "subject", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "support_email_user_created_at_idx": { + "name": "support_email_user_created_at_idx", + "columns": ["userId", "createdAt"], + "isUnique": false + }, + "support_email_conversation_created_at_idx": { + "name": "support_email_conversation_created_at_idx", + "columns": ["conversationId", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": { + "support_email_conversation_fk": { + "name": "support_email_conversation_fk", + "tableFrom": "messenger_support_emails", + "tableTo": "messenger_conversations", + "columnsFrom": ["conversationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "messenger_support_emails_id": { + "name": "messenger_support_emails_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mobile_push_claims": { + "name": "mobile_push_claims", + "columns": { + "id": { + "name": "id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "created_at_idx": { + "name": "created_at_idx", + "columns": ["createdAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mobile_push_claims_id": { + "name": "mobile_push_claims_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "mobile_push_tokens": { + "name": "mobile_push_tokens", + "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 + }, + "token": { + "name": "token", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sessionHash": { + "name": "sessionHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment": { + "name": "environment", + "type": "varchar(10)", + "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": { + "token_idx": { + "name": "token_idx", + "columns": ["token"], + "isUnique": true + }, + "user_id_idx": { + "name": "user_id_idx", + "columns": ["userId"], + "isUnique": false + }, + "session_hash_idx": { + "name": "session_hash_idx", + "columns": ["sessionHash"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "mobile_push_tokens_id": { + "name": "mobile_push_tokens_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "notifications": { + "name": "notifications", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "orgId": { + "name": "orgId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recipientId": { + "name": "recipientId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "videoId": { + "name": "videoId", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "dedupKey": { + "name": "dedupKey", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "readAt": { + "name": "readAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + } + }, + "indexes": { + "org_id_idx": { + "name": "org_id_idx", + "columns": ["orgId"], + "isUnique": false + }, + "type_idx": { + "name": "type_idx", + "columns": ["type"], + "isUnique": false + }, + "read_at_idx": { + "name": "read_at_idx", + "columns": ["readAt"], + "isUnique": false + }, + "created_at_idx": { + "name": "created_at_idx", + "columns": ["createdAt"], + "isUnique": false + }, + "recipient_read_idx": { + "name": "recipient_read_idx", + "columns": ["recipientId", "readAt"], + "isUnique": false + }, + "recipient_created_idx": { + "name": "recipient_created_idx", + "columns": ["recipientId", "createdAt"], + "isUnique": false + }, + "dedup_key_idx": { + "name": "dedup_key_idx", + "columns": ["dedupKey"], + "isUnique": true + }, + "type_recipient_created_idx": { + "name": "type_recipient_created_idx", + "columns": ["type", "recipientId", "createdAt"], + "isUnique": false + }, + "type_recipient_video_created_idx": { + "name": "type_recipient_video_created_idx", + "columns": ["type", "recipientId", "videoId", "createdAt"], + "isUnique": false + }, + "video_id_idx": { + "name": "video_id_idx", + "columns": ["videoId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "notifications_id": { + "name": "notifications_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "organization_directory_sync": { + "name": "organization_directory_sync", + "columns": { + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "requestedAt": { + "name": "requestedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "syncedAt": { + "name": "syncedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "leaseExpiresAt": { + "name": "leaseExpiresAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastError": { + "name": "lastError", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "heldRemovals": { + "name": "heldRemovals", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "removalsApprovedAt": { + "name": "removalsApprovedAt", + "type": "datetime", + "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": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "organization_directory_sync_organizationId": { + "name": "organization_directory_sync_organizationId", + "columns": ["organizationId"] + } + }, + "uniqueConstraints": {}, + "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": {}, + "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 + }, + "hasProSeat": { + "name": "hasProSeat", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 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 + }, + "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": {}, + "checkConstraint": {} + }, + "organization_sso": { + "name": "organization_sso", + "columns": { + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purchasedByUserId": { + "name": "purchasedByUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "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 + }, + "stripePriceId": { + "name": "stripePriceId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unpaid'" + }, + "paidThrough": { + "name": "paidThrough", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "currentPeriodEnd": { + "name": "currentPeriodEnd", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cancelAtPeriodEnd": { + "name": "cancelAtPeriodEnd", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "checkoutAttemptId": { + "name": "checkoutAttemptId", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checkoutCurrency": { + "name": "checkoutCurrency", + "type": "varchar(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checkoutPriceId": { + "name": "checkoutPriceId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checkoutSessionId": { + "name": "checkoutSessionId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checkoutStartedAt": { + "name": "checkoutStartedAt", + "type": "datetime", + "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": { + "sso_stripe_subscription_id_idx": { + "name": "sso_stripe_subscription_id_idx", + "columns": ["stripeSubscriptionId"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "organization_sso_organizationId": { + "name": "organization_sso_organizationId", + "columns": ["organizationId"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "tombstoneAt": { + "name": "tombstoneAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "allowedEmailDomain": { + "name": "allowedEmailDomain", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "defaultVideoVisibility": { + "name": "defaultVideoVisibility", + "type": "varchar(7)", + "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 + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "iconUrl": { + "name": "iconUrl", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "shareableLinkIconUrl": { + "name": "shareableLinkIconUrl", + "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_tombstone_idx": { + "name": "owner_id_tombstone_idx", + "columns": ["ownerId", "tombstoneAt"], + "isUnique": false + }, + "custom_domain_idx": { + "name": "custom_domain_idx", + "columns": ["customDomain"], + "isUnique": false + }, + "workos_organization_id_idx": { + "name": "workos_organization_id_idx", + "columns": ["workosOrganizationId"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "organizations_id": { + "name": "organizations_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "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')" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "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": { + "owner_organization_idx": { + "name": "owner_organization_idx", + "columns": ["ownerId", "organizationId"], + "isUnique": false + }, + "organization_id_idx": { + "name": "organization_id_idx", + "columns": ["organizationId"], + "isUnique": false + }, + "organization_active_idx": { + "name": "organization_active_idx", + "columns": ["organizationId", "active", "updatedAt"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "s3_buckets_id": { + "name": "s3_buckets_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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": {}, + "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 + }, + "folderId": { + "name": "folderId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "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": { + "folder_id_idx": { + "name": "folder_id_idx", + "columns": ["folderId"], + "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 + }, + "video_id_folder_id_idx": { + "name": "video_id_folder_id_idx", + "columns": ["videoId", "folderId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "shared_videos_id": { + "name": "shared_videos_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "signed_baas": { + "name": "signed_baas", + "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 + }, + "userId": { + "name": "userId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "stripeSubscriptionId": { + "name": "stripeSubscriptionId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entityName": { + "name": "entityName", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entityType": { + "name": "entityType", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entityAddress": { + "name": "entityAddress", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "signerName": { + "name": "signerName", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "signerTitle": { + "name": "signerTitle", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "noticesEmail": { + "name": "noticesEmail", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "signatureData": { + "name": "signatureData", + "type": "longtext", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "signedAt": { + "name": "signedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "emailSentAt": { + "name": "emailSentAt", + "type": "timestamp", + "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": { + "signed_baa_organization_id_idx": { + "name": "signed_baa_organization_id_idx", + "columns": ["organizationId"], + "isUnique": true + }, + "signed_baa_stripe_subscription_idx": { + "name": "signed_baa_stripe_subscription_idx", + "columns": ["stripeSubscriptionId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "signed_baas_id": { + "name": "signed_baas_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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": { + "user_id_idx": { + "name": "user_id_idx", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "space_members_id": { + "name": "space_members_id", + "columns": ["id"] + } + }, + "uniqueConstraints": { + "space_id_user_id_unique": { + "name": "space_id_user_id_unique", + "columns": ["spaceId", "userId"] + } + }, + "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())" + }, + "position": { + "name": "position", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "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 + }, + "space_id_folder_id_idx": { + "name": "space_id_folder_id_idx", + "columns": ["spaceId", "folderId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "space_videos_id": { + "name": "space_videos_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "password": { + "name": "password", + "type": "text", + "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'" + }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "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 + }, + "public_organization_id_idx": { + "name": "public_organization_id_idx", + "columns": ["public", "organizationId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "spaces_id": { + "name": "spaces_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "storage_integrations": { + "name": "storage_integrations", + "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 + }, + "organizationId": { + "name": "organizationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "displayName": { + "name": "displayName", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "encryptedConfig": { + "name": "encryptedConfig", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "googleDriveAccessToken": { + "name": "googleDriveAccessToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "googleDriveAccessTokenExpiresAt": { + "name": "googleDriveAccessTokenExpiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "googleDriveTokenRefreshLeaseId": { + "name": "googleDriveTokenRefreshLeaseId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "googleDriveTokenRefreshLeaseExpiresAt": { + "name": "googleDriveTokenRefreshLeaseExpiresAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "googleDriveStorageQuotaCache": { + "name": "googleDriveStorageQuotaCache", + "type": "json", + "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": { + "owner_provider_idx": { + "name": "owner_provider_idx", + "columns": ["ownerId", "provider"], + "isUnique": false + }, + "owner_active_idx": { + "name": "owner_active_idx", + "columns": ["ownerId", "active"], + "isUnique": false + }, + "organization_provider_idx": { + "name": "organization_provider_idx", + "columns": ["organizationId", "provider"], + "isUnique": false + }, + "organization_active_idx": { + "name": "organization_active_idx", + "columns": ["organizationId", "active", "status"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "storage_integrations_id": { + "name": "storage_integrations_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "storage_objects": { + "name": "storage_objects", + "columns": { + "id": { + "name": "id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "integrationId": { + "name": "integrationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ownerId": { + "name": "ownerId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "objectKey": { + "name": "objectKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "objectKeyHash": { + "name": "objectKeyHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "providerObjectId": { + "name": "providerObjectId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "uploadSessionUrl": { + "name": "uploadSessionUrl", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uploadStatus": { + "name": "uploadStatus", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "contentType": { + "name": "contentType", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "contentLength": { + "name": "contentLength", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "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": { + "integration_key_hash_idx": { + "name": "integration_key_hash_idx", + "columns": ["integrationId", "objectKeyHash"], + "isUnique": true + }, + "integration_status_idx": { + "name": "integration_status_idx", + "columns": ["integrationId", "uploadStatus"], + "isUnique": false + }, + "integration_object_key_prefix_idx": { + "name": "integration_object_key_prefix_idx", + "columns": ["integrationId", "`objectKey`(191)"], + "isUnique": false + }, + "video_id_idx": { + "name": "video_id_idx", + "columns": ["videoId"], + "isUnique": false + }, + "owner_id_idx": { + "name": "owner_id_idx", + "columns": ["ownerId"], + "isUnique": false + } + }, + "foreignKeys": { + "storage_objects_integrationId_storage_integrations_id_fk": { + "name": "storage_objects_integrationId_storage_integrations_id_fk", + "tableFrom": "storage_objects", + "tableTo": "storage_integrations", + "columnsFrom": ["integrationId"], + "columnsTo": ["id"], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "storage_objects_id": { + "name": "storage_objects_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "user_passkeys": { + "name": "user_passkeys", + "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 + }, + "credentialId": { + "name": "credentialId", + "type": "varchar(1400)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credentialIdHash": { + "name": "credentialIdHash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter": { + "name": "counter", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "transports": { + "name": "transports", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deviceType": { + "name": "deviceType", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "backedUp": { + "name": "backedUp", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "confirmsIdentity": { + "name": "confirmsIdentity", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "aaguid": { + "name": "aaguid", + "type": "varchar(36)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "lastUsedAt": { + "name": "lastUsedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "credential_id_hash_idx": { + "name": "credential_id_hash_idx", + "columns": ["credentialIdHash"], + "isUnique": true + }, + "user_id_idx": { + "name": "user_id_idx", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "user_passkeys_id": { + "name": "user_passkeys_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "preferences": { + "name": "preferences", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "('null')" + }, + "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())" + }, + "onboardingSteps": { + "name": "onboardingSteps", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "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 + }, + "defaultOrgId": { + "name": "defaultOrgId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "authSessionVersion": { + "name": "authSessionVersion", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "marketingOrigin": { + "name": "marketingOrigin", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + } + }, + "indexes": { + "email_idx": { + "name": "email_idx", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "users_id": { + "name": "users_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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": {} + }, + "video_edits": { + "name": "video_edits", + "columns": { + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sourceKey": { + "name": "sourceKey", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "editSpec": { + "name": "editSpec", + "type": "json", + "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": {}, + "foreignKeys": { + "video_edits_videoId_videos_id_fk": { + "name": "video_edits_videoId_videos_id_fk", + "tableFrom": "video_edits", + "tableTo": "videos", + "columnsFrom": ["videoId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "video_edits_videoId": { + "name": "video_edits_videoId", + "columns": ["videoId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_notes": { + "name": "video_notes", + "columns": { + "videoId": { + "name": "videoId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ownerId": { + "name": "ownerId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "documentId": { + "name": "documentId", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "excerpt": { + "name": "excerpt", + "type": "varchar(512)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "summaryMarkdown": { + "name": "summaryMarkdown", + "type": "mediumtext", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notesMarkdown": { + "name": "notesMarkdown", + "type": "mediumtext", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "transcript": { + "name": "transcript", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "participants": { + "name": "participants", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "meetingStartedAt": { + "name": "meetingStartedAt", + "type": "timestamp", + "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": { + "owner_document_idx": { + "name": "owner_document_idx", + "columns": ["ownerId", "documentId"], + "isUnique": true + } + }, + "foreignKeys": { + "video_notes_videoId_videos_id_fk": { + "name": "video_notes_videoId_videos_id_fk", + "tableFrom": "video_notes", + "tableTo": "videos", + "columnsFrom": ["videoId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "video_notes_videoId": { + "name": "video_notes_videoId", + "columns": ["videoId"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_processing_jobs": { + "name": "video_processing_jobs", + "columns": { + "video_id": { + "name": "video_id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "owner_id": { + "name": "owner_id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "generation": { + "name": "generation", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "manifest_sha256": { + "name": "manifest_sha256", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'committing'" + }, + "attempt_id": { + "name": "attempt_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attempt_count": { + "name": "attempt_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "lease_expires_at": { + "name": "lease_expires_at", + "type": "datetime(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "next_retry_at": { + "name": "next_retry_at", + "type": "datetime(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workflow_run_id": { + "name": "workflow_run_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "remote_job_id": { + "name": "remote_job_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verification": { + "name": "verification", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "output": { + "name": "output", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_code": { + "name": "error_code", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "datetime(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "processing_state_retry_video_idx": { + "name": "processing_state_retry_video_idx", + "columns": ["state", "next_retry_at", "video_id"], + "isUnique": false + }, + "processing_state_lease_video_idx": { + "name": "processing_state_lease_video_idx", + "columns": ["state", "lease_expires_at", "video_id"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "video_processing_jobs_video_id": { + "name": "video_processing_jobs_video_id", + "columns": ["video_id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_uploads": { + "name": "video_uploads", + "columns": { + "video_id": { + "name": "video_id", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "uploaded": { + "name": "uploaded", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "total": { + "name": "total", + "type": "bigint unsigned", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "mode": { + "name": "mode", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "phase": { + "name": "phase", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'uploading'" + }, + "processing_progress": { + "name": "processing_progress", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "processing_message": { + "name": "processing_message", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "processing_error": { + "name": "processing_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_file_key": { + "name": "raw_file_key", + "type": "varchar(512)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "phase_updated_at_video_id_idx": { + "name": "phase_updated_at_video_id_idx", + "columns": ["phase", "updated_at", "video_id"], + "isUnique": false + }, + "started_at_idx": { + "name": "started_at_idx", + "columns": ["started_at"], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "video_uploads_video_id": { + "name": "video_uploads_video_id", + "columns": ["video_id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_viewer_grants": { + "name": "video_viewer_grants", + "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 + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invitedByUserId": { + "name": "invitedByUserId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "revokedAt": { + "name": "revokedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "video_email_idx": { + "name": "video_email_idx", + "columns": ["videoId", "email"], + "isUnique": true + } + }, + "foreignKeys": { + "video_viewer_grants_videoId_videos_id_fk": { + "name": "video_viewer_grants_videoId_videos_id_fk", + "tableFrom": "video_viewer_grants", + "tableTo": "videos", + "columnsFrom": ["videoId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "video_viewer_grants_id": { + "name": "video_viewer_grants_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "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 + }, + "orgId": { + "name": "orgId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'My Video'" + }, + "bucket": { + "name": "bucket", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "storageIntegrationId": { + "name": "storageIntegrationId", + "type": "varchar(15)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "duration": { + "name": "duration", + "type": "float", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "width": { + "name": "width", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "height": { + "name": "height", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fps": { + "name": "fps", + "type": "int", + "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 + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "transcriptionStatus": { + "name": "transcriptionStatus", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "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 + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "effectiveCreatedAt": { + "name": "effectiveCreatedAt", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "generated": { + "as": "COALESCE(\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%s.%fZ'),\n STR_TO_DATE(JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.customCreatedAt')), '%Y-%m-%dT%H:%i:%sZ'),\n `createdAt`\n )", + "type": "stored" + } + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "onUpdate": true, + "default": "(now())" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "xStreamInfo": { + "name": "xStreamInfo", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "firstViewEmailSentAt": { + "name": "firstViewEmailSentAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "isScreenshot": { + "name": "isScreenshot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "isNote": { + "name": "isNote", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "archivedAt": { + "name": "archivedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "awsRegion": { + "name": "awsRegion", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "awsBucket": { + "name": "awsBucket", + "type": "varchar(255)", + "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 + }, + "jobId": { + "name": "jobId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "jobStatus": { + "name": "jobStatus", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "skipProcessing": { + "name": "skipProcessing", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "owner_id_idx": { + "name": "owner_id_idx", + "columns": ["ownerId"], + "isUnique": false + }, + "owner_updated_id_idx": { + "name": "owner_updated_id_idx", + "columns": ["ownerId", "updatedAt", "id"], + "isUnique": false + }, + "is_public_idx": { + "name": "is_public_idx", + "columns": ["public"], + "isUnique": false + }, + "folder_id_idx": { + "name": "folder_id_idx", + "columns": ["folderId"], + "isUnique": false + }, + "storage_integration_id_idx": { + "name": "storage_integration_id_idx", + "columns": ["storageIntegrationId"], + "isUnique": false + }, + "org_owner_folder_idx": { + "name": "org_owner_folder_idx", + "columns": ["orgId", "ownerId", "folderId"], + "isUnique": false + }, + "org_owner_folder_effective_idx": { + "name": "org_owner_folder_effective_idx", + "columns": ["orgId", "ownerId", "folderId", "effectiveCreatedAt"], + "isUnique": false + }, + "org_effective_created_idx": { + "name": "org_effective_created_idx", + "columns": ["orgId", "effectiveCreatedAt"], + "isUnique": false + }, + "org_owner_folder_archived_effective_idx": { + "name": "org_owner_folder_archived_effective_idx", + "columns": [ + "orgId", + "ownerId", + "folderId", + "archivedAt", + "effectiveCreatedAt" + ], + "isUnique": false + }, + "screenshot_transcription_created_idx": { + "name": "screenshot_transcription_created_idx", + "columns": ["isScreenshot", "transcriptionStatus", "createdAt"], + "isUnique": false + } + }, + "foreignKeys": { + "videos_storageIntegrationId_storage_integrations_id_fk": { + "name": "videos_storageIntegrationId_storage_integrations_id_fk", + "tableFrom": "videos", + "tableTo": "storage_integrations", + "columnsFrom": ["storageIntegrationId"], + "columnsTo": ["id"], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "videos_id": { + "name": "videos_id", + "columns": ["id"] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + } + }, + "views": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "tables": {}, + "indexes": { + "integration_object_key_prefix_idx": { + "columns": { + "`objectKey`(191)": { + "isExpression": true + } + } + } + } + } +} diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.json index c9a3913c58b..570d8267203 100644 --- a/packages/database/migrations/meta/_journal.json +++ b/packages/database/migrations/meta/_journal.json @@ -477,6 +477,13 @@ "when": 1795524690496, "tag": "0067_meeting_audio_usage", "breakpoints": true + }, + { + "idx": 68, + "version": "5", + "when": 1795792333290, + "tag": "0068_concerned_blue_marvel", + "breakpoints": true } ] } diff --git a/packages/database/schema.ts b/packages/database/schema.ts index 21bbb411e57..939cc3e794b 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -549,6 +549,7 @@ export const videos = mysqlTable( xStreamInfo: text("xStreamInfo"), firstViewEmailSentAt: timestamp("firstViewEmailSentAt"), isScreenshot: boolean("isScreenshot").notNull().default(false), + isNote: boolean("isNote").notNull().default(false), archivedAt: timestamp("archivedAt"), // DEPRECATED awsRegion: varchar("awsRegion", { length: 255 }), @@ -595,6 +596,36 @@ export const videos = mysqlTable( ], ); +export type VideoNoteTranscriptTurn = { + speaker: string; + startMs: number; + text: string; +}; + +export const videoNotes = mysqlTable( + "video_notes", + { + videoId: nanoId("videoId") + .notNull() + .primaryKey() + .$type() + .references(() => videos.id, { onDelete: "cascade" }), + ownerId: nanoId("ownerId").notNull().$type(), + documentId: varchar("documentId", { length: 64 }).notNull(), + excerpt: varchar("excerpt", { length: 512 }).notNull().default(""), + summaryMarkdown: mediumtext("summaryMarkdown"), + notesMarkdown: mediumtext("notesMarkdown"), + transcript: json("transcript").$type(), + participants: json("participants").$type(), + meetingStartedAt: timestamp("meetingStartedAt"), + createdAt: timestamp("createdAt").notNull().defaultNow(), + updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(), + }, + (table) => [ + uniqueIndex("owner_document_idx").on(table.ownerId, table.documentId), + ], +); + export const videoEdits = mysqlTable("video_edits", { videoId: nanoId("videoId") .notNull() From 7b6f115918cfe8f82247f50beae848fe11a4aa5e Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:37:00 +0000 Subject: [PATCH 02/27] feat(web): split My Caps into videos, images and notes --- apps/web/actions/caps/list-view-ids.ts | 11 + apps/web/app/(org)/dashboard/Contexts.tsx | 3 + .../app/(org)/dashboard/DashboardContext.ts | 2 + .../dashboard/_components/Navbar/Items.tsx | 129 ++++--- .../dashboard/_components/dashboard-titles.ts | 12 + .../dashboard/_components/library-doodles.tsx | 58 +++ apps/web/app/(org)/dashboard/caps/Caps.tsx | 342 +++++++++++++----- .../(org)/dashboard/caps/caps-page-data.tsx | 100 +++-- .../caps/components/CapCard/CapCard.tsx | 158 ++++---- .../components/CapCard/CapCardContent.tsx | 4 +- .../caps/components/CapCard/NoteThumbnail.tsx | 39 ++ .../dashboard/caps/components/CapGridItem.tsx | 4 +- .../caps/components/NotesEmptyState.tsx | 38 ++ .../caps/components/SettingsDialog.tsx | 24 +- .../caps/components/SharingDialog.tsx | 14 +- .../app/(org)/dashboard/caps/images/page.tsx | 16 + .../app/(org)/dashboard/caps/notes/page.tsx | 16 + .../app/(org)/dashboard/caps/videos/page.tsx | 16 + .../web/app/(org)/dashboard/dashboard-data.ts | 23 +- apps/web/app/(org)/dashboard/layout.tsx | 4 + apps/web/lib/cap-kind-query.ts | 8 + apps/web/lib/cap-kind.ts | 36 ++ apps/web/lib/select-all-view.ts | 4 +- 23 files changed, 827 insertions(+), 234 deletions(-) create mode 100644 apps/web/app/(org)/dashboard/caps/components/CapCard/NoteThumbnail.tsx create mode 100644 apps/web/app/(org)/dashboard/caps/components/NotesEmptyState.tsx create mode 100644 apps/web/app/(org)/dashboard/caps/images/page.tsx create mode 100644 apps/web/app/(org)/dashboard/caps/notes/page.tsx create mode 100644 apps/web/app/(org)/dashboard/caps/videos/page.tsx create mode 100644 apps/web/lib/cap-kind-query.ts create mode 100644 apps/web/lib/cap-kind.ts diff --git a/apps/web/actions/caps/list-view-ids.ts b/apps/web/actions/caps/list-view-ids.ts index c0e7611653b..11772992f7f 100644 --- a/apps/web/actions/caps/list-view-ids.ts +++ b/apps/web/actions/caps/list-view-ids.ts @@ -12,6 +12,8 @@ import type { Organisation, Space, Video } from "@cap/web-domain"; import { and, desc, eq, isNotNull, isNull } from "drizzle-orm"; import { getOrganizationAccess } from "@/actions/organization/authorization"; import { getSpaceAccess } from "@/actions/organization/space-authorization"; +import { CAP_KINDS } from "@/lib/cap-kind"; +import { capKindCondition } from "@/lib/cap-kind-query"; import { canManageOrganizationMembers } from "@/lib/permissions/roles"; import { MAX_SELECT_ALL_ITEMS, @@ -33,6 +35,12 @@ export async function listCapIdsInView( if (view.type === "personal" || view.type === "archived") { if (!user.activeOrganizationId) return { ids: [], truncated: false }; + if ( + view.type === "personal" && + view.kind !== undefined && + !CAP_KINDS.includes(view.kind) + ) + throw new Error("Invalid view"); const isArchivedView = view.type === "archived"; const rows = await db() .select({ id: videos.id }) @@ -46,6 +54,9 @@ export async function listCapIdsInView( isArchivedView ? isNotNull(videos.archivedAt) : and(isNull(videos.folderId), isNull(videos.archivedAt)), + view.type === "personal" && view.kind + ? capKindCondition(view.kind) + : undefined, ), ) .orderBy( diff --git a/apps/web/app/(org)/dashboard/Contexts.tsx b/apps/web/app/(org)/dashboard/Contexts.tsx index f8b6409980d..beed6725268 100644 --- a/apps/web/app/(org)/dashboard/Contexts.tsx +++ b/apps/web/app/(org)/dashboard/Contexts.tsx @@ -27,6 +27,7 @@ export function DashboardContexts({ activeOrganization, spacesData, userCapsCount, + userCapKindCounts = null, organizationSettings, userPreferences, anyNewNotifications, @@ -40,6 +41,7 @@ export function DashboardContexts({ activeOrganization: SharedContext["activeOrganization"]; spacesData: SharedContext["spacesData"]; userCapsCount: SharedContext["userCapsCount"]; + userCapKindCounts?: SharedContext["userCapKindCounts"]; organizationSettings: SharedContext["organizationSettings"]; userPreferences: SharedContext["userPreferences"]; anyNewNotifications: boolean; @@ -143,6 +145,7 @@ export function DashboardContexts({ activeOrganization, spacesData, userCapsCount, + userCapKindCounts, anyNewNotifications, userPreferences, organizationSettings, diff --git a/apps/web/app/(org)/dashboard/DashboardContext.ts b/apps/web/app/(org)/dashboard/DashboardContext.ts index 142d3d027dd..19adf0c5908 100644 --- a/apps/web/app/(org)/dashboard/DashboardContext.ts +++ b/apps/web/app/(org)/dashboard/DashboardContext.ts @@ -2,6 +2,7 @@ import { createContext, useContext } from "react"; import type { CurrentUser } from "@/app/Layout/AuthContext"; +import type { CapKindCounts } from "@/lib/cap-kind"; import type { Organization, OrganizationSettings, @@ -26,6 +27,7 @@ export type SharedContext = { activeSpace: Spaces | null; user: CurrentUser; userCapsCount: number | null; + userCapKindCounts: CapKindCounts | null; toggleSidebarCollapsed: () => void; anyNewNotifications: boolean; userPreferences: UserPreferences; diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx index 6b6ea844e82..cf119819864 100644 --- a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx +++ b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx @@ -29,6 +29,7 @@ import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { cloneElement, + Fragment, type RefObject, useCallback, useEffect, @@ -41,6 +42,7 @@ import { NewOrganization } from "@/components/forms/NewOrganization"; import { SignedImageUrl } from "@/components/SignedImageUrl"; import { Tooltip } from "@/components/Tooltip"; import { UsageButton } from "@/components/UsageButton"; +import { CAP_KIND_LABEL, CAP_KINDS, capKindHref } from "@/lib/cap-kind"; import { canUseInfra } from "@/lib/infra-access"; import { INFRA_BASE_PATH } from "@/lib/infra-routes"; import { @@ -73,7 +75,8 @@ interface Props { const AdminNavItems = ({ toggleMobileNav }: Props) => { const pathname = usePathname(); const [open, setOpen] = useState(false); - const { user, sidebarCollapsed, userCapsCount } = useDashboardContext(); + const { user, sidebarCollapsed, userCapsCount, userCapKindCounts } = + useDashboardContext(); const showDeveloperDashboard = buildEnv.NEXT_PUBLIC_IS_CAP === "true" && canUseInfra(user.email); @@ -81,33 +84,38 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => { buildEnv.NEXT_PUBLIC_IS_CAP && user.email.toLowerCase() === MESSENGER_ADMIN_EMAIL; + const noSubNav: { name: string; href: string; count?: number }[] = []; const manageNavigation = [ { name: "My Caps", href: `/dashboard/caps`, extraText: userCapsCount, icon: , - subNav: [], + subNav: CAP_KINDS.map((kind) => ({ + name: CAP_KIND_LABEL[kind], + href: capKindHref(kind), + count: userCapKindCounts?.[kind], + })), }, { name: "Analytics", href: `/dashboard/analytics`, matchChildren: true, icon: , - subNav: [], + subNav: noSubNav, }, { name: "Record a Cap", href: `/dashboard/caps/record`, icon: , - subNav: [], + subNav: noSubNav, }, { name: "Import Media", href: loomImportPageHref(loomImportDestinationFromPathname(pathname)), matchChildren: true, icon: , - subNav: [], + subNav: noSubNav, }, { name: "Organization Settings", @@ -115,7 +123,7 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => { adminOnly: true, matchChildren: true, icon: , - subNav: [], + subNav: noSubNav, }, ...(showDeveloperDashboard ? [ @@ -125,7 +133,7 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => { ownerOnly: true, matchChildren: true, icon: , - subNav: [] as { name: string; href: string }[], + subNav: noSubNav, }, ] : []), @@ -135,7 +143,7 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => { name: "Migration Queue", href: "/dashboard/admin/loom-migrations", icon: , - subNav: [], + subNav: noSubNav, }, ] : []), @@ -432,41 +440,78 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => { .filter((item) => !item.ownerOnly || isOwner) .filter((item) => !item.adminOnly || canViewSettings) .map((item) => ( -
- {isPathActive(item.href, item.matchChildren ?? false) && ( - - )} + +
+ {isPathActive(item.href, item.matchChildren ?? false) && ( + + )} - -
+ +
+ {!sidebarCollapsed && + item.subNav.map((subItem) => { + const active = isPathActive(subItem.href); + return ( +
+ {active && ( + + )} + toggleMobileNav?.()} + aria-current={active ? "page" : undefined} + className={clsx( + "flex relative items-center pr-3 w-full h-8 text-[13px] rounded-lg border border-transparent outline-none transition pl-[38px] z-3 focus-visible:ring-2 focus-visible:ring-gray-6", + active + ? "font-medium pointer-events-none text-gray-12" + : "text-gray-11 dashboard-nav-hover", + )} + > + {subItem.name} + {subItem.count ? ( + + {subItem.count} + + ) : null} + +
+ ); + })} + ))} toggleMobileNav?.()} /> diff --git a/apps/web/app/(org)/dashboard/_components/dashboard-titles.ts b/apps/web/app/(org)/dashboard/_components/dashboard-titles.ts index 77857a75ad0..b92ec9d17cd 100644 --- a/apps/web/app/(org)/dashboard/_components/dashboard-titles.ts +++ b/apps/web/app/(org)/dashboard/_components/dashboard-titles.ts @@ -6,6 +6,18 @@ const exact: Record = { { label: "My Caps", href: "/dashboard/caps" }, { label: "Archived" }, ], + "/dashboard/caps/videos": [ + { label: "My Caps", href: "/dashboard/caps" }, + { label: "Videos" }, + ], + "/dashboard/caps/images": [ + { label: "My Caps", href: "/dashboard/caps" }, + { label: "Images" }, + ], + "/dashboard/caps/notes": [ + { label: "My Caps", href: "/dashboard/caps" }, + { label: "Notes" }, + ], "/dashboard/caps/record": [{ label: "Record a Cap" }], "/dashboard/analytics": [{ label: "Analytics" }], "/dashboard/import": [{ label: "Import Media" }], diff --git a/apps/web/app/(org)/dashboard/_components/library-doodles.tsx b/apps/web/app/(org)/dashboard/_components/library-doodles.tsx index 76146cac4f1..795884d352e 100644 --- a/apps/web/app/(org)/dashboard/_components/library-doodles.tsx +++ b/apps/web/app/(org)/dashboard/_components/library-doodles.tsx @@ -387,3 +387,61 @@ export function ArchiveDoodle({ size = 88 }: { size?: number }) { ); } + +export function NotesDoodle({ size = 88 }: { size?: number }) { + return ( + + + + + + + + + + + + ); +} diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsx index a39199e93ce..038e5e26494 100644 --- a/apps/web/app/(org)/dashboard/caps/Caps.tsx +++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx @@ -5,6 +5,7 @@ import type { VideoMetadata } from "@cap/database/types"; import type { SpaceRuleSource, ViewerSettingKey } from "@cap/web-backend"; import type { ImageUpload, Video } from "@cap/web-domain"; import { faBoxArchive } from "@fortawesome/free-solid-svg-icons/faBoxArchive"; +import { faChevronRight } from "@fortawesome/free-solid-svg-icons/faChevronRight"; import clsx from "clsx"; import { Effect, Exit } from "effect"; import { AnimatePresence } from "framer-motion"; @@ -17,6 +18,14 @@ import { type SeededThumbnails, SeededThumbnailsProvider, } from "@/components/VideoThumbnail"; +import { + CAP_KIND_LABEL, + CAP_KINDS, + type CapKind, + type CapKindCounts, + capKindHref, + capKindOf, +} from "@/lib/cap-kind"; import { DEFAULT_DASHBOARD_PAGE_SIZE } from "@/lib/dashboard-page-size"; import { useEffectMutation, useRpcClient } from "@/lib/EffectRuntime"; import { parsePageParam } from "@/lib/page-param"; @@ -43,6 +52,7 @@ import { DragHint } from "./components/DragHint"; import { EmptyCapState } from "./components/EmptyCapState"; import type { FolderDataType } from "./components/Folder"; import { FoldersSection } from "./components/FoldersSection"; +import { NotesEmptyState } from "./components/NotesEmptyState"; import { QuickActions } from "./components/QuickActions"; import { useArchiveCaps, useLeavingCaps } from "./components/useArchiveCaps"; import { useCapSelection } from "./components/useCapSelection"; @@ -76,6 +86,8 @@ export type VideoData = { metadata?: VideoMetadata; source: typeof videosSchema.$inferSelect.source; isScreenshot: boolean; + isNote?: boolean; + noteExcerpt?: string | null; hasPassword: boolean; hasInheritedPassword?: boolean; inheritedPasswordSources?: SpaceRuleSource[]; @@ -85,9 +97,35 @@ export type VideoData = { archivedAt?: Date | null; }[]; +const GRID_CLASS = + "grid relative grid-cols-1 gap-x-5 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"; + +const OVERVIEW_ROWS: Record = { + videos: 2, + images: 1, + notes: 1, +}; + +const GRID_COLUMNS = [ + { columns: 2, show: "sm:block" }, + { columns: 3, show: "lg:block" }, + { columns: 4, show: "xl:block" }, + { columns: 5, show: "2xl:block" }, +]; + +function overviewItemClass(index: number, rows: number) { + if (index < Math.max(2, rows + 1)) return undefined; + const step = GRID_COLUMNS.find(({ columns }) => index < columns * rows); + return step ? `hidden ${step.show}` : "hidden"; +} + +const NO_COUNTS: CapKindCounts = { videos: 0, images: 0, notes: 0 }; + export const Caps = ({ data, count, + counts = NO_COUNTS, + kind, analyticsEnabled, folders, thumbnails, @@ -97,6 +135,8 @@ export const Caps = ({ }: { data: VideoData; count: number; + counts?: CapKindCounts; + kind?: CapKind; folders: FolderDataType[]; analyticsEnabled: boolean; thumbnails?: SeededThumbnails; @@ -109,6 +149,7 @@ export const Caps = ({ const page = parsePageParam(params.get("page")); const { user } = useDashboardContext(); const isArchivedView = view === "archived"; + const isOverview = !isArchivedView && kind === undefined; const [openNewFolderDialog, setOpenNewFolderDialog] = useState(false); const totalPages = Math.ceil(count / pageSize); const moveLocation = { type: "personal" } as const; @@ -131,13 +172,13 @@ export const Caps = ({ () => isArchivedView ? ({ type: "archived" } as const) - : ({ type: "personal" } as const), - [isArchivedView], + : ({ type: "personal", kind } as const), + [isArchivedView, kind], ); const selection = useCapSelection({ pageIds, - totalCount: count, - view: selectAllView, + totalCount: isOverview ? undefined : count, + view: isOverview ? undefined : selectAllView, }); const selectedCaps = selection.selected; const setSelectedCaps = selection.setSelected; @@ -153,6 +194,20 @@ export const Caps = ({ onReturn: leavingCaps.restore, }); const shownCount = count - leavingCaps.leavingCount; + const shownKindCounts = useMemo(() => { + const shown = { ...counts }; + for (const video of listedVideos) + if (leavingCaps.leaving.has(video.id)) shown[capKindOf(video)] -= 1; + return shown; + }, [counts, listedVideos, leavingCaps.leaving]); + const sections = useMemo( + () => + CAP_KINDS.map((sectionKind) => ({ + kind: sectionKind, + caps: visibleVideos.filter((video) => capKindOf(video) === sectionKind), + })), + [visibleVideos], + ); const shownArchivedCount = archivedCount + (isArchivedView ? 0 : leavingCaps.leavingCount); @@ -286,13 +341,11 @@ export const Caps = ({ }; }, [selectedCaps, deleteCaps, isDeletingCaps, pageIds]); - if ( + const libraryIsEmpty = !isArchivedView && shownCount === 0 && folders.length === 0 && - shownArchivedCount === 0 - ) - return ; + shownArchivedCount === 0; const archivedLink = !isArchivedView && shownArchivedCount > 0 ? ( @@ -308,6 +361,66 @@ export const Caps = ({ ) : null; + const renderCap = (video: VideoData[number], className?: string) => ( + + { + if (selectedCaps.length > 0) { + deleteCaps(selectedCaps); + } else { + deleteCap(video.id); + } + }} + userId={user?.id} + isLoadingAnalytics={isLoadingAnalytics} + isSelected={selectedCaps.includes(video.id)} + anyCapSelected={anyCapSelected} + onSelectToggle={(options) => selection.toggle(video.id, options)} + selectedIds={selectedCaps} + canMove={!isArchivedView} + moveLocation={moveLocation} + moveRootLabel="My Caps" + isArchived={isArchivedView} + onArchiveToggle={() => + void archiveCaps.mutate({ + ids: [video.id], + archived: !isArchivedView, + }) + } + /> + + ); + + const showUploadPlaceholder = + !isArchivedView && isUploading && (isOverview || kind === "videos"); + + const overviewSections = sections.filter( + (section) => + section.kind === "notes" || + section.caps.length > 0 || + (section.kind === "videos" && showUploadPlaceholder), + ); + + if (libraryIsEmpty && isOverview && !showUploadPlaceholder) + return ( +
+
+ +
+ + +
+ ); + return (
{isArchivedView ? ( @@ -323,7 +436,9 @@ export const Caps = ({ open={openNewFolderDialog} onOpenChange={setOpenNewFolderDialog} /> - setOpenNewFolderDialog(true)} /> + {isOverview && ( + setOpenNewFolderDialog(true)} /> + )}
)} - {visibleVideos.length === 0 && archivedLink && ( -
{archivedLink}
- )} - {visibleVideos.length > 0 && ( - <> - + {isOverview ? ( +
+ {overviewSections.map((section, sectionIndex) => { + const sectionCount = shownKindCounts[section.kind]; + const hasCaps = + section.caps.length > 0 || + (section.kind === "videos" && showUploadPlaceholder); + return ( +
+ 0 ? sectionCount : undefined} + actions={ + (sectionIndex === 0 && archivedLink) || hasCaps ? ( + <> + {sectionIndex === 0 && archivedLink} + {hasCaps && ( + + See all + + + )} + + ) : undefined + } + /> + {hasCaps ? ( +
+ {section.kind === "videos" && showUploadPlaceholder && ( + + )} + + {section.caps.map((video, index) => + renderCap( + video, + overviewItemClass( + index, + OVERVIEW_ROWS[section.kind], + ), + ), + )} + +
+ ) : ( + + )} +
+ ); + })} +
+ ) : ( + <> + {visibleVideos.length === 0 && archivedLink && ( +
{archivedLink}
+ )} + {(visibleVideos.length > 0 || showUploadPlaceholder) && ( <> - {archivedLink} - + + {archivedLink} + + + } + /> +
+ {showUploadPlaceholder && ( + + )} + + {visibleVideos.map((video) => renderCap(video))} + +
- } - /> - - -
- {!isArchivedView && isUploading && ( - + )} + {kind && + visibleVideos.length === 0 && + !showUploadPlaceholder && + page === 1 && ( + <> + + {kind === "notes" ? ( + + ) : ( +
+
+

+ {kind === "videos" + ? "No videos yet" + : "No images yet"} +

+

+ {kind === "videos" + ? "Record or upload a video and it shows up here." + : "Screenshots you take with Cap show up here."} +

+
+ + Back to My Caps + +
+ )} + )} - - {visibleVideos.map((video) => { - const videoAnalytics = analytics[video.id]; - return ( - - { - if (selectedCaps.length > 0) { - deleteCaps(selectedCaps); - } else { - deleteCap(video.id); - } - }} - userId={user?.id} - isLoadingAnalytics={isLoadingAnalytics} - isSelected={selectedCaps.includes(video.id)} - anyCapSelected={anyCapSelected} - onSelectToggle={(options) => - selection.toggle(video.id, options) - } - selectedIds={selectedCaps} - canMove={!isArchivedView} - moveLocation={moveLocation} - moveRootLabel="My Caps" - isArchived={isArchivedView} - onArchiveToggle={() => - void archiveCaps.mutate({ - ids: [video.id], - archived: !isArchivedView, - }) - } - /> - - ); - })} - -
-
- - )} - {(data.length >= pageSize || page !== 1) && ( + + )} + + {!isOverview && (data.length >= pageSize || page !== 1) && (
`/dashboard/caps/archived?page=${target}` - : undefined + hrefForPage={(target) => + `${isArchivedView ? "/dashboard/caps/archived" : kind ? capKindHref(kind) : "/dashboard/caps"}?page=${target}` } />
diff --git a/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx b/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx index 56d63a8439c..721dbcac67d 100644 --- a/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx +++ b/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx @@ -8,6 +8,7 @@ import { spaces, spaceVideos, users, + videoNotes, videos, videoUploads, } from "@cap/database/schema"; @@ -26,10 +27,14 @@ import { isNotNull, isNull, or, + type SQL, sql, } from "drizzle-orm"; +import { unionAll } from "drizzle-orm/mysql-core"; import { type Array, Effect } from "effect"; import { redirect } from "next/navigation"; +import { CAP_KINDS, type CapKind } from "@/lib/cap-kind"; +import { capKindCondition } from "@/lib/cap-kind-query"; import { resolveDashboardPageSize } from "@/lib/dashboard-page-size"; import { parsePageParam } from "@/lib/page-param"; import { seedThumbnailUrls } from "@/lib/seeded-thumbnails"; @@ -131,12 +136,20 @@ const getSharedSpacesForVideos = Effect.fn(function* ( return sharedSpacesMap; }); +const OVERVIEW_SECTION_SIZE: Record = { + videos: 10, + images: 5, + notes: 5, +}; + export async function CapsPageView({ searchParams, view, + kind, }: { searchParams: Record; view: "library" | "archived"; + kind?: CapKind; }) { const user = await getCurrentUser(); @@ -150,6 +163,7 @@ export async function CapsPageView({ preferences: user.preferences, }); const isArchivedView = view === "archived"; + const isOverview = !isArchivedView && kind === undefined; const userId = user.id; const offset = (page - 1) * limit; @@ -157,12 +171,15 @@ export async function CapsPageView({ // One pass gives both the library count and the archived count, so the // Archived entry costs no extra round trip. The OR keeps the library rows // (root, not archived) and every archived row, wherever it is filed. + const libraryKindCount = (kind: CapKind) => + sql`count(case when ${videos.archivedAt} is null and ${capKindCondition(kind) as SQL} then 1 end)`.mapWith( + Number, + ); const totalCountPromise = db() .select({ - count: - sql`count(case when ${videos.archivedAt} is null then 1 end)`.mapWith( - Number, - ), + videos: libraryKindCount("videos"), + images: libraryKindCount("images"), + notes: libraryKindCount("notes"), archivedCount: sql`count(case when ${videos.archivedAt} is not null then 1 end)`.mapWith( Number, @@ -180,28 +197,37 @@ export async function CapsPageView({ ), ); - const capsPage = db() - .select({ id: videos.id }) - .from(videos) - .leftJoin(organizations, eq(videos.orgId, organizations.id)) - .where( - and( - eq(videos.ownerId, userId), - eq(videos.orgId, user.activeOrganizationId), - isArchivedView - ? isNotNull(videos.archivedAt) - : and(isNull(videos.folderId), isNull(videos.archivedAt)), - isNull(organizations.tombstoneAt), - ), - ) - .orderBy( - ...(isArchivedView - ? [desc(videos.archivedAt), desc(videos.id)] - : [desc(videos.effectiveCreatedAt), desc(videos.id)]), - ) - .limit(limit) - .offset(offset) - .as("caps_page"); + const pageIds = (pageKind: CapKind | undefined, take: number, skip: number) => + db() + .select({ id: videos.id }) + .from(videos) + .leftJoin(organizations, eq(videos.orgId, organizations.id)) + .where( + and( + eq(videos.ownerId, userId), + eq(videos.orgId, user.activeOrganizationId), + isArchivedView + ? isNotNull(videos.archivedAt) + : and(isNull(videos.folderId), isNull(videos.archivedAt)), + pageKind ? capKindCondition(pageKind) : undefined, + isNull(organizations.tombstoneAt), + ), + ) + .orderBy( + ...(isArchivedView + ? [desc(videos.archivedAt), desc(videos.id)] + : [desc(videos.effectiveCreatedAt), desc(videos.id)]), + ) + .limit(take) + .offset(skip); + + const capsPage = isOverview + ? unionAll( + pageIds("videos", OVERVIEW_SECTION_SIZE.videos, 0), + pageIds("images", OVERVIEW_SECTION_SIZE.images, 0), + pageIds("notes", OVERVIEW_SECTION_SIZE.notes, 0), + ).as("caps_page") + : pageIds(kind, limit, offset).as("caps_page"); const videoDataPromise = db() .select({ @@ -243,6 +269,8 @@ export async function CapsPageView({ ), settings: videos.settings, archivedAt: videos.archivedAt, + isNote: videos.isNote, + noteExcerpt: videoNotes.excerpt, }) .from(videos) .innerJoin(capsPage, eq(videos.id, capsPage.id)) @@ -251,6 +279,7 @@ export async function CapsPageView({ .leftJoin(organizations, eq(sharedVideos.organizationId, organizations.id)) .leftJoin(users, eq(videos.ownerId, users.id)) .leftJoin(videoUploads, eq(videos.id, videoUploads.videoId)) + .leftJoin(videoNotes, eq(videos.id, videoNotes.videoId)) .groupBy( videos.id, videos.ownerId, @@ -259,6 +288,8 @@ export async function CapsPageView({ videos.metadata, videos.source, videos.isScreenshot, + videos.isNote, + videoNotes.excerpt, videos.duration, videos.public, videos.password, @@ -312,17 +343,24 @@ export async function CapsPageView({ foldersDataPromise, organizationSettingsPromise, ]); - const totalCount = isArchivedView - ? (totalCountResult[0]?.archivedCount ?? 0) - : (totalCountResult[0]?.count ?? 0); + const counts = { + videos: totalCountResult[0]?.videos ?? 0, + images: totalCountResult[0]?.images ?? 0, + notes: totalCountResult[0]?.notes ?? 0, + }; const archivedCount = totalCountResult[0]?.archivedCount ?? 0; + const totalCount = isArchivedView + ? archivedCount + : kind + ? counts[kind] + : CAP_KINDS.reduce((total, each) => total + counts[each], 0); const organizationSettings = organizationSettingsRow?.settings ?? null; const videoIds = videoData.map((video) => video.id); const thumbnails = seedThumbnailUrls( user, videoData - .filter((video) => !video.hasActiveUpload) + .filter((video) => !video.hasActiveUpload && !video.isNote) .map((video) => Video.VideoId.make(video.id)), ); const sharedSpacesMap = @@ -393,6 +431,8 @@ export async function CapsPageView({ data={processedVideoData} folders={foldersData} count={totalCount} + counts={counts} + kind={kind} thumbnails={thumbnails} pageSize={limit} archivedCount={archivedCount} diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx index 2cf2dd5a54a..1e0f0aa2a4c 100644 --- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx @@ -72,6 +72,7 @@ import { SharingDialog } from "../SharingDialog"; import { CapCardAnalytics, capAnalyticsHref } from "./CapCardAnalytics"; import { CapCardButton } from "./CapCardButton"; import { CapCardContent } from "./CapCardContent"; +import { NoteThumbnail } from "./NoteThumbnail"; const CustomThumbnailDialog = dynamic( () => import("@/components/custom-thumbnail/CustomThumbnailDialog"), @@ -125,6 +126,8 @@ export interface CapCardProps extends PropsWithChildren { metadata?: VideoMetadata; source?: typeof videosSchema.$inferSelect.source; isScreenshot?: boolean; + isNote?: boolean; + noteExcerpt?: string | null; hasPassword?: boolean; hasInheritedPassword?: boolean; inheritedPasswordSources?: SpaceRuleSource[]; @@ -265,6 +268,7 @@ export const CapCard = ({ }; const isOwner = userId === cap.ownerId; + const isNote = cap.isNote === true; const customThumbnail = getCustomThumbnailMetadata(cap.metadata); const moveEnabled = Boolean(canMove && moveLocation && moveRootLabel); // A drag carries at most MAX_MOVE_ITEMS ids; larger selections ("Select @@ -339,11 +343,13 @@ export const CapCard = ({ const handleCopy = async (text: string) => { try { - await copyRichVideoLink({ - url: text, - title: cap.name || "Cap Recording", - previewImageUrl: videoPreviewImageUrl(webUrl, cap.id), - }); + if (isNote) await navigator.clipboard.writeText(text); + else + await copyRichVideoLink({ + url: text, + title: cap.name || "Cap Recording", + previewImageUrl: videoPreviewImageUrl(webUrl, cap.id), + }); } catch (error) { console.error("Failed to copy link:", error); toast.error("Couldn't copy the link. Please try again."); @@ -388,6 +394,7 @@ export const CapCard = ({ isOwner && !sharedCapCard && cap.isScreenshot !== true && + !isNote && !cap.hasActiveUpload && (cap.source?.type === "desktopMP4" || cap.source?.type === "webMP4") && Boolean(cap.duration && cap.duration > 0); @@ -418,6 +425,7 @@ export const CapCard = ({ hasPassword={passwordProtected} inheritedPasswordSources={cap.inheritedPasswordSources} onPasswordUpdated={handlePasswordUpdated} + isNote={isNote} /> setIsSettingsDialogOpen(false)} onSaved={() => router.refresh()} + isNote={isNote} /> )} - { - e.stopPropagation(); - handleDownload(); - }} - className="flex gap-2 items-center rounded-lg" - > - -

Download

-
+ {!isNote && ( + { + e.stopPropagation(); + handleDownload(); + }} + className="flex gap-2 items-center rounded-lg" + > + +

Download

+
+ )} { e.stopPropagation(); @@ -643,25 +654,27 @@ export const CapCard = ({ )} {isOwner && ( <> - { - toast.promise( - duplicateMutation.mutateAsync().then(rejectOnFailure), - { - loading: "Duplicating cap...", - success: "Cap duplicated successfully", - error: "Failed to duplicate cap", - }, - ); - }} - disabled={ - duplicateMutation.isPending || cap.hasActiveUpload - } - className="flex gap-2 items-center rounded-lg" - > - -

Duplicate

-
+ {!isNote && ( + { + toast.promise( + duplicateMutation.mutateAsync().then(rejectOnFailure), + { + loading: "Duplicating cap...", + success: "Cap duplicated successfully", + error: "Failed to duplicate cap", + }, + ); + }} + disabled={ + duplicateMutation.isPending || cap.hasActiveUpload + } + className="flex gap-2 items-center rounded-lg" + > + +

Duplicate

+
+ )} {canEditVideo && ( { @@ -674,7 +687,7 @@ export const CapCard = ({

Edit video

)} - {cap.isScreenshot !== true && ( + {cap.isScreenshot !== true && !isNote && ( { e.stopPropagation(); @@ -905,37 +918,50 @@ export const CapCard = ({ )} - -
+ {isNote ? ( + + ) : ( + <> + +
+ + )} {cap.isScreenshot === true && !hasVisibleUploadProgress && ( = ({ try { await editTitle(cap.id, next); setSavedTitle(next); - toast.success("Video title updated"); + toast.success(cap.isNote ? "Title updated" : "Video title updated"); if (!editingRef.current || draftRef.current.trim() === next) { setDraft(next); setEditing(false); @@ -139,7 +139,7 @@ export const CapCardContent: React.FC = ({ try { await editDate(cap.id, selectedDate.toISOString()); - toast.success("Video date updated"); + toast.success(cap.isNote ? "Date updated" : "Video date updated"); setIsDateEditing(false); router.refresh(); } catch (error) { diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/NoteThumbnail.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/NoteThumbnail.tsx new file mode 100644 index 00000000000..dae4910782c --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/NoteThumbnail.tsx @@ -0,0 +1,39 @@ +import clsx from "clsx"; +import { formatDuration } from "@/components/VideoThumbnail"; + +export function NoteThumbnail({ + excerpt, + duration, + dimmed, + controlsShown, +}: { + excerpt?: string | null; + duration?: number | null; + dimmed?: boolean; + controlsShown?: boolean; +}) { + return ( +
+

+ {excerpt} +

+
+ {duration ? ( +

+ {formatDuration(duration)} +

+ ) : null} +
+ ); +} diff --git a/apps/web/app/(org)/dashboard/caps/components/CapGridItem.tsx b/apps/web/app/(org)/dashboard/caps/components/CapGridItem.tsx index 2fc2b2a299e..5075dba5451 100644 --- a/apps/web/app/(org)/dashboard/caps/components/CapGridItem.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/CapGridItem.tsx @@ -23,11 +23,13 @@ export function CapGridItem({ children, layoutDependency, returning, + className, }: { id: string; children: ReactNode; layoutDependency: unknown; returning: boolean; + className?: string; }) { const reduceMotion = useReducedMotion(); return ( @@ -50,7 +52,7 @@ export function CapGridItem({ opacity: { duration: 0.2, ease: "easeOut" }, scale: { duration: 0.2, ease: "easeOut" }, }} - className="min-w-0" + className={className ? `min-w-0 ${className}` : "min-w-0"} > {children} diff --git a/apps/web/app/(org)/dashboard/caps/components/NotesEmptyState.tsx b/apps/web/app/(org)/dashboard/caps/components/NotesEmptyState.tsx new file mode 100644 index 00000000000..b2cb22f8473 --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/components/NotesEmptyState.tsx @@ -0,0 +1,38 @@ +import { Button } from "@cap/ui"; +import { faDownload } from "@fortawesome/free-solid-svg-icons/faDownload"; +import clsx from "clsx"; +import { FontAwesomeIcon } from "@/components/FontAwesomeIcon"; +import { + libraryDoodleHost, + NotesDoodle, +} from "../../_components/library-doodles"; + +export function NotesEmptyState() { + return ( +
+ +
+

+ Record your meetings in the Cap desktop app +

+

+ Cap takes the notes. Share one and it shows up here. +

+
+ +
+ ); +} diff --git a/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx index 0a9ee107167..383a6ffe611 100644 --- a/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/SettingsDialog.tsx @@ -29,11 +29,12 @@ interface SettingsDialogProps { user?: CurrentUser | null; organizationSettings?: OrganizationSettings | null; onSaved?: () => void; + isNote?: boolean; } type SettingKey = ViewerSettingKey | "disableDownloads"; -const options: { +const allOptions: { label: string; value: SettingKey; description: string; @@ -79,6 +80,23 @@ const options: { }, ]; +const NOTE_SETTINGS: SettingKey[] = [ + "disableComments", + "disableReactions", + "disableTranscript", +]; + +const noteOptions = allOptions + .filter((option) => NOTE_SETTINGS.includes(option.value)) + .map((option) => + option.value === "disableTranscript" + ? { + ...option, + description: "Show the meeting transcript beside this note", + } + : option, + ); + export const SettingsDialog = ({ isOpen, onClose, @@ -88,7 +106,9 @@ export const SettingsDialog = ({ user: propUser, organizationSettings: propOrganizationSettings, onSaved, + isNote = false, }: SettingsDialogProps) => { + const options = isNote ? noteOptions : allOptions; const contextData = useDashboardContext(); const user = propUser ?? contextData.user; const organizationSettings = @@ -260,7 +280,7 @@ export const SettingsDialog = ({ ); })}
-
+
diff --git a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx index 8482342b843..6e208323bd5 100644 --- a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx @@ -72,6 +72,7 @@ interface SharingDialogProps { user?: CurrentUser | null; onUpgradeRequest?: (open: boolean) => void; shareUrl?: string; + isNote?: boolean; } export const SharingDialog: React.FC = ({ @@ -92,6 +93,7 @@ export const SharingDialog: React.FC = ({ user: propUser, onUpgradeRequest: propOnUpgradeRequest, shareUrl: propShareUrl, + isNote = false, }) => { const { spacesData: contextSpacesData, @@ -441,7 +443,12 @@ export const SharingDialog: React.FC = ({ -
+
{tabs.map((tab) => (
diff --git a/apps/web/app/(org)/dashboard/caps/images/page.tsx b/apps/web/app/(org)/dashboard/caps/images/page.tsx new file mode 100644 index 00000000000..d70741af26f --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/images/page.tsx @@ -0,0 +1,16 @@ +import type { Metadata } from "next"; +import { CapsPageView } from "../caps-page-data"; + +export const metadata: Metadata = { + title: "Images — Cap", +}; + +export default async function ImagesCapsPage( + props: PageProps<"/dashboard/caps/images">, +) { + return CapsPageView({ + searchParams: await props.searchParams, + view: "library", + kind: "images", + }); +} diff --git a/apps/web/app/(org)/dashboard/caps/notes/page.tsx b/apps/web/app/(org)/dashboard/caps/notes/page.tsx new file mode 100644 index 00000000000..ab9d33bd091 --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/notes/page.tsx @@ -0,0 +1,16 @@ +import type { Metadata } from "next"; +import { CapsPageView } from "../caps-page-data"; + +export const metadata: Metadata = { + title: "Notes — Cap", +}; + +export default async function NotesCapsPage( + props: PageProps<"/dashboard/caps/notes">, +) { + return CapsPageView({ + searchParams: await props.searchParams, + view: "library", + kind: "notes", + }); +} diff --git a/apps/web/app/(org)/dashboard/caps/videos/page.tsx b/apps/web/app/(org)/dashboard/caps/videos/page.tsx new file mode 100644 index 00000000000..bc3d6902934 --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/videos/page.tsx @@ -0,0 +1,16 @@ +import type { Metadata } from "next"; +import { CapsPageView } from "../caps-page-data"; + +export const metadata: Metadata = { + title: "Videos — Cap", +}; + +export default async function VideosCapsPage( + props: PageProps<"/dashboard/caps/videos">, +) { + return CapsPageView({ + searchParams: await props.searchParams, + view: "library", + kind: "videos", + }); +} diff --git a/apps/web/app/(org)/dashboard/dashboard-data.ts b/apps/web/app/(org)/dashboard/dashboard-data.ts index 24d63c43bea..02b1952f673 100644 --- a/apps/web/app/(org)/dashboard/dashboard-data.ts +++ b/apps/web/app/(org)/dashboard/dashboard-data.ts @@ -372,6 +372,14 @@ async function loadActiveOrganizationData( ? db() .select({ value: sql`COUNT(DISTINCT ${videos.id})`, + images: + sql`COUNT(CASE WHEN ${videos.isNote} = false AND ${videos.isScreenshot} = true THEN 1 END)`.mapWith( + Number, + ), + notes: + sql`COUNT(CASE WHEN ${videos.isNote} = true THEN 1 END)`.mapWith( + Number, + ), }) .from(videos) .where( @@ -380,7 +388,9 @@ async function loadActiveOrganizationData( eq(videos.ownerId, user.id), ), ) - : Promise.resolve<{ value: number }[]>([]), + : Promise.resolve<{ value: number; images: number; notes: number }[]>( + [], + ), currentOrganizationRole, ]); @@ -389,6 +399,14 @@ async function loadActiveOrganizationData( organizationSettings: activeOrgInfo?.settings || null, spacesData: allSpacesEntry ? [allSpacesEntry, ...spacesRows] : spacesRows, userCapsCount: userCapsCountResult[0]?.value || 0, + userCapKindCounts: { + videos: + (userCapsCountResult[0]?.value || 0) - + (userCapsCountResult[0]?.images || 0) - + (userCapsCountResult[0]?.notes || 0), + images: userCapsCountResult[0]?.images || 0, + notes: userCapsCountResult[0]?.notes || 0, + }, }; } @@ -627,6 +645,7 @@ export async function getDashboardData( activeData?.organizationSettings ?? null; const anyNewNotifications = activeData?.anyNewNotifications ?? false; const userCapsCount = activeData?.userCapsCount ?? 0; + const userCapKindCounts = activeData?.userCapKindCounts ?? null; const userPreferences = { preferences: user.preferences }; return { @@ -637,6 +656,7 @@ export async function getDashboardData( anyNewNotifications, userPreferences, userCapsCount, + userCapKindCounts, }; } catch (error) { console.error("Failed to fetch dashboard data", error); @@ -645,6 +665,7 @@ export async function getDashboardData( organizationSelect: [], spacesData: [], userCapsCount: null, + userCapKindCounts: null, anyNewNotifications: false, userPreferences: null, organizationSettings: null, diff --git a/apps/web/app/(org)/dashboard/layout.tsx b/apps/web/app/(org)/dashboard/layout.tsx index 7acb4478dce..565f882d307 100644 --- a/apps/web/app/(org)/dashboard/layout.tsx +++ b/apps/web/app/(org)/dashboard/layout.tsx @@ -9,6 +9,7 @@ import { cookies } from "next/headers"; import { redirect } from "next/navigation"; import { AuthContextProvider } from "@/app/Layout/AuthContext"; import { resolveCurrentUser } from "@/app/Layout/current-user"; +import type { CapKindCounts } from "@/lib/cap-kind"; import { shouldOfferPasskey } from "@/lib/passkey-prompt"; import { runPromise } from "@/lib/server"; import { getShareableLinkUsage } from "@/lib/shareable-link-quota"; @@ -69,6 +70,7 @@ export default async function DashboardLayout({ let organizationSelect: Organization[] = []; let activeOrganizationId: string | null = null; let userCapsCount: number | null = 0; + let userCapKindCounts: CapKindCounts | null = null; let organizationSettings: OrganizationSettings | null = null; let spacesData: Spaces[] = []; let anyNewNotifications = false; @@ -78,6 +80,7 @@ export default async function DashboardLayout({ organizationSelect = dashboardData.organizationSelect; activeOrganizationId = dashboardData.activeOrganizationId; userCapsCount = dashboardData.userCapsCount; + userCapKindCounts = dashboardData.userCapKindCounts; organizationSettings = dashboardData.organizationSettings; userPreferences = dashboardData.userPreferences?.preferences || null; spacesData = dashboardData.spacesData; @@ -126,6 +129,7 @@ export default async function DashboardLayout({ + kind === "notes" + ? eq(videos.isNote, true) + : and(eq(videos.isNote, false), eq(videos.isScreenshot, kind === "images")); diff --git a/apps/web/lib/cap-kind.ts b/apps/web/lib/cap-kind.ts new file mode 100644 index 00000000000..3df7ebb72ea --- /dev/null +++ b/apps/web/lib/cap-kind.ts @@ -0,0 +1,36 @@ +export const CAP_KINDS = ["videos", "images", "notes"] as const; + +export type CapKind = (typeof CAP_KINDS)[number]; + +export type CapKindCounts = Record; + +export const CAP_KIND_LABEL: Record = { + videos: "Videos", + images: "Images", + notes: "Notes", +}; + +export const capKindHref = (kind: CapKind) => `/dashboard/caps/${kind}`; + +type KindFlags = { isScreenshot?: boolean | null; isNote?: boolean | null }; + +export const capKindOf = (cap: KindFlags): CapKind => + cap.isNote ? "notes" : cap.isScreenshot ? "images" : "videos"; + +export function groupCapsByKind( + caps: readonly T[], +): { kind: CapKind; caps: T[] }[] { + const groups: Record = { videos: [], images: [], notes: [] }; + for (const cap of caps) groups[capKindOf(cap)].push(cap); + return CAP_KINDS.map((kind) => ({ kind, caps: groups[kind] })).filter( + (group) => group.caps.length > 0, + ); +} + +export const capKindCountsFromTotals = ( + totals: { count: number; images: number; notes: number } | undefined, +): CapKindCounts => ({ + videos: (totals?.count ?? 0) - (totals?.images ?? 0) - (totals?.notes ?? 0), + images: totals?.images ?? 0, + notes: totals?.notes ?? 0, +}); diff --git a/apps/web/lib/select-all-view.ts b/apps/web/lib/select-all-view.ts index 72866017bbe..3b6c01328f5 100644 --- a/apps/web/lib/select-all-view.ts +++ b/apps/web/lib/select-all-view.ts @@ -1,7 +1,9 @@ +import type { CapKind } from "./cap-kind"; + export const MAX_SELECT_ALL_ITEMS = 5000; export type SelectAllView = - | { type: "personal" } + | { type: "personal"; kind?: CapKind } | { type: "archived" } | { type: "space"; spaceId: string } | { type: "organization"; organizationId: string }; From 8ff106ee475679b4c2a5bf2259a20b3cccbcd381 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:37:00 +0000 Subject: [PATCH 03/27] feat(web): group folders, spaces and search by cap kind --- .../unit/dashboard-search-item-values.test.ts | 1 + apps/web/__tests__/unit/folder-videos.test.ts | 2 + .../_components/Navbar/DashboardSearch.tsx | 52 +++- .../dashboard/_components/Navbar/search.ts | 2 + .../[id]/components/FolderVideosSection.tsx | 189 +++++++------ .../dashboard/spaces/[spaceId]/SharedCaps.tsx | 249 ++++++++++-------- .../[spaceId]/components/SharedCapCard.tsx | 2 + .../(org)/dashboard/spaces/[spaceId]/page.tsx | 40 ++- apps/web/lib/folder.ts | 8 + 9 files changed, 333 insertions(+), 212 deletions(-) diff --git a/apps/web/__tests__/unit/dashboard-search-item-values.test.ts b/apps/web/__tests__/unit/dashboard-search-item-values.test.ts index cb0be0e4119..f0ca0c3aff8 100644 --- a/apps/web/__tests__/unit/dashboard-search-item-values.test.ts +++ b/apps/web/__tests__/unit/dashboard-search-item-values.test.ts @@ -53,6 +53,7 @@ const video = (id: string, name: string, ownerName = "Sam") => createdAt: "2026-01-01T00:00:00.000Z", duration: 65, isScreenshot: false, + isNote: false, }) as DashboardVideoSearchResult; const space = (id: string, name: string) => ({ diff --git a/apps/web/__tests__/unit/folder-videos.test.ts b/apps/web/__tests__/unit/folder-videos.test.ts index ed0647b86a9..53374b79e8a 100644 --- a/apps/web/__tests__/unit/folder-videos.test.ts +++ b/apps/web/__tests__/unit/folder-videos.test.ts @@ -65,6 +65,8 @@ describe.each([ "2026-10-23 12:00:00", false, false, + false, + null, ], ], }); diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/DashboardSearch.tsx b/apps/web/app/(org)/dashboard/_components/Navbar/DashboardSearch.tsx index 52717ffa7f9..5c6f05eb1af 100644 --- a/apps/web/app/(org)/dashboard/_components/Navbar/DashboardSearch.tsx +++ b/apps/web/app/(org)/dashboard/_components/Navbar/DashboardSearch.tsx @@ -16,6 +16,7 @@ import { Bell, Building2, CreditCard, + FileText, FileVideo, FolderSearch, Image, @@ -31,7 +32,15 @@ import { UsersRound, } from "lucide-react"; import { usePathname, useRouter } from "next/navigation"; -import { type ReactNode, useEffect, useMemo, useRef, useState } from "react"; +import { + Fragment, + type ReactNode, + useEffect, + useMemo, + useRef, + useState, +} from "react"; +import { CAP_KIND_LABEL, groupCapsByKind } from "@/lib/cap-kind"; import { loomImportDestinationFromPathname, loomImportPageHref, @@ -99,7 +108,7 @@ const formatDuration = (duration: number | null) => { const formatVideoSubtitle = (video: DashboardVideoSearchResult) => { const parts = [ - video.isScreenshot ? "Screenshot" : "Video", + video.isNote ? "Note" : video.isScreenshot ? "Screenshot" : "Video", video.ownerName ? `by ${video.ownerName}` : null, videoDateFormatter.format(new Date(video.createdAt)), formatDuration(video.duration), @@ -403,26 +412,41 @@ export function DashboardSearch({ {canSearchVideos && ( <> - Videos and screenshots + {!hasVideoResults || videoLoading ? ( + Videos, images and notes + ) : null} {videoLoading ? (
- Searching videos… + Searching your caps…
) : hasVideoResults ? ( - videoResults.map((video) => ( - navigateTo(`/s/${video.id}`)} - /> + groupCapsByKind(videoResults).map((group) => ( + + + {CAP_KIND_LABEL[group.kind]} + + {group.caps.map((video) => ( + navigateTo(`/s/${video.id}`)} + /> + ))} + )) ) : (

- No videos or screenshots match{" "} + No videos, images or notes match{" "} “{query.trim()}” diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/search.ts b/apps/web/app/(org)/dashboard/_components/Navbar/search.ts index 2b4479f135e..5aca3bc5bf8 100644 --- a/apps/web/app/(org)/dashboard/_components/Navbar/search.ts +++ b/apps/web/app/(org)/dashboard/_components/Navbar/search.ts @@ -27,6 +27,7 @@ export type DashboardVideoSearchResult = { createdAt: string; duration: number | null; isScreenshot: boolean; + isNote: boolean; }; const normalizeSearchQuery = (query: string) => @@ -90,6 +91,7 @@ export async function searchDashboardVideos( createdAt: videos.createdAt, duration: videos.duration, isScreenshot: videos.isScreenshot, + isNote: videos.isNote, }) .from(videos) .innerJoin(organizations, eq(videos.orgId, organizations.id)) diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx index b661e53fcff..436fc8f06a9 100644 --- a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx +++ b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx @@ -8,6 +8,7 @@ import { useRouter } from "next/navigation"; import { useMemo } from "react"; import { toast } from "sonner"; import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; +import { CAP_KIND_LABEL, groupCapsByKind } from "@/lib/cap-kind"; import { useEffectMutation, useRpcClient } from "@/lib/EffectRuntime"; import type { MoveLocation } from "@/lib/move-items"; import { useVideosAnalyticsQuery } from "@/lib/Queries/Analytics"; @@ -156,97 +157,111 @@ export default function FolderVideosSection({ const analytics = analyticsQuery.data || {}; + const kindGroups = groupCapsByKind(visibleVideos); + const sections = + kindGroups.length > 0 + ? kindGroups + : [{ kind: "videos" as const, caps: visibleVideos }]; + return ( <> - 0 ? visibleVideos.length : undefined} - selectionState={ - canSelect && visibleVideos.length > 0 - ? selection.pageState - : undefined - } - onToggleSelectAll={selection.togglePage} - /> -

- {visibleVideos.length === 0 && !isUploading ? ( -
( +
0 ? "mt-10" : undefined} + > + 0 ? section.caps.length : undefined} + selectionState={ + sectionIndex === 0 && canSelect && visibleVideos.length > 0 + ? selection.pageState + : undefined + } + onToggleSelectAll={selection.togglePage} + /> +
+ {visibleVideos.length === 0 && !isUploading ? ( +
+ +
+

+ This folder is empty +

+

+ {canMove + ? "Drag Caps onto this folder from My Caps, use Move on any Cap, or upload one here." + : "Caps added to this folder will show up here."} +

+
+
+ ) : ( + <> + {isUploading && sectionIndex === 0 && ( + + )} + + {section.caps.map((video) => ( + + 0} + isDeleting={isDeletingCaps || isDeletingCap} + onSelectToggle={ + canSelect + ? (options) => selection.toggle(video.id, options) + : undefined + } + onArchiveToggle={ + canArchive + ? () => + void archiveCaps.mutate({ + ids: [video.id], + archived: true, + }) + : undefined + } + selectedIds={selectedCaps} + canMove={canMove} + moveLocation={location} + moveRootLabel={rootLabel} + currentFolderId={currentFolderId} + onDelete={() => { + if (selectedCaps.length > 0) { + deleteCaps(selectedCaps); + } else { + deleteCap(video.id); + } + }} + /> + + ))} + + )} - > - -
-

- This folder is empty -

-

- {canMove - ? "Drag Caps onto this folder from My Caps, use Move on any Cap, or upload one here." - : "Caps added to this folder will show up here."} -

-
- ) : ( - <> - {isUploading && ( - - )} - - {visibleVideos.map((video) => ( - - 0} - isDeleting={isDeletingCaps || isDeletingCap} - onSelectToggle={ - canSelect - ? (options) => selection.toggle(video.id, options) - : undefined - } - onArchiveToggle={ - canArchive - ? () => - void archiveCaps.mutate({ - ids: [video.id], - archived: true, - }) - : undefined - } - selectedIds={selectedCaps} - canMove={canMove} - moveLocation={location} - moveRootLabel={rootLabel} - currentFolderId={currentFolderId} - onDelete={() => { - if (selectedCaps.length > 0) { - deleteCaps(selectedCaps); - } else { - deleteCap(video.id); - } - }} - /> - - ))} - - - )} -
+ + ))} {canMove && ( )} diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx index 0a4bb61d3c5..70e7c7ef7f1 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx @@ -30,6 +30,11 @@ import { type SeededThumbnails, SeededThumbnailsProvider, } from "@/components/VideoThumbnail"; +import { + CAP_KIND_LABEL, + type CapKindCounts, + groupCapsByKind, +} from "@/lib/cap-kind"; import { DEFAULT_DASHBOARD_PAGE_SIZE } from "@/lib/dashboard-page-size"; import { CAP_DRAG_TYPE, parseCapDrag } from "@/lib/move-items"; import { parsePageParam } from "@/lib/page-param"; @@ -85,6 +90,8 @@ type SharedVideoData = { ownerName: string | null; metadata?: VideoMetadata; isScreenshot: boolean; + isNote?: boolean; + noteExcerpt?: string | null; hasPassword?: boolean; hasInheritedPassword?: boolean; inheritedPasswordSources?: SpaceRuleSource[]; @@ -120,6 +127,7 @@ type SpaceData = { export const SharedCaps = ({ data, count, + kindCounts, spaceData, spaceId, spaceMembers, @@ -134,6 +142,7 @@ export const SharedCaps = ({ }: { data: SharedVideoData; count: number; + kindCounts?: CapKindCounts; analyticsEnabled: boolean; spaceData?: SpaceData; spaceId: Space.SpaceIdOrOrganisationId; @@ -599,114 +608,140 @@ export const SharedCaps = ({ {orderedData.length > 0 && ( <> - - {spaceData && canManageCurrentSpace && ( - - )} - - - } - /> -
- {orderedData.map((cap, index) => { - const card = ( - 0 - } - onSelectToggle={ - canManageCurrentSharedCollection - ? (options) => selection.toggle(cap.id, options) - : undefined - } - selectedIds={selectedCaps} - href={ - spaceData - ? `/s/${cap.id}?space=${encodeURIComponent(spaceId)}` - : undefined - } - reorder={ - canReorder - ? { - onMoveToStart: - page === 1 && index === 0 - ? undefined - : () => - void reorderTo([cap.id], { type: "start" }), - onMoveEarlier: - page === 1 && index === 0 - ? undefined - : () => - void reorderTo([cap.id], { - type: "earlier", - }), - onMoveLater: - page >= totalPages && - index === orderedData.length - 1 - ? undefined - : () => - void reorderTo([cap.id], { type: "later" }), - } - : undefined - } - /> - ); - if (!canReorder) return card; - const indicator = - dropTarget?.id === cap.id ? dropTarget.side : null; - return ( - handleReorderDragOver(event, cap.id)} - onDrop={(event) => handleReorderDrop(event, cap.id)} - onKeyDown={(event) => - handleReorderKeyDown(event, cap.id, index) - } - > - {card} - - - ); - })} -
+ {groupCapsByKind(orderedData).map((group, groupIndex) => ( +
0 ? "mt-10" : undefined} + > + + {spaceData && canManageCurrentSpace && ( + + )} + + + ) : undefined + } + /> +
+ {group.caps.map((cap) => { + const index = orderedData.indexOf(cap); + const card = ( + 0 + } + onSelectToggle={ + canManageCurrentSharedCollection + ? (options) => selection.toggle(cap.id, options) + : undefined + } + selectedIds={selectedCaps} + href={ + spaceData + ? `/s/${cap.id}?space=${encodeURIComponent(spaceId)}` + : undefined + } + reorder={ + canReorder + ? { + onMoveToStart: + page === 1 && index === 0 + ? undefined + : () => + void reorderTo([cap.id], { + type: "start", + }), + onMoveEarlier: + page === 1 && index === 0 + ? undefined + : () => + void reorderTo([cap.id], { + type: "earlier", + }), + onMoveLater: + page >= totalPages && + index === orderedData.length - 1 + ? undefined + : () => + void reorderTo([cap.id], { + type: "later", + }), + } + : undefined + } + /> + ); + if (!canReorder) return card; + const indicator = + dropTarget?.id === cap.id ? dropTarget.side : null; + return ( + + handleReorderDragOver(event, cap.id) + } + onDrop={(event) => handleReorderDrop(event, cap.id)} + onKeyDown={(event) => + handleReorderKeyDown(event, cap.id, index) + } + > + {card} + + + ); + })} +
+
+ ))}
{canReorder && (

diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx index 964c9c4e637..ef9c47ccc38 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx @@ -27,6 +27,8 @@ interface SharedCapCardProps { ownerName: string | null; metadata?: VideoMetadata; isScreenshot: boolean; + isNote?: boolean; + noteExcerpt?: string | null; hasPassword?: boolean; hasInheritedPassword?: boolean; inheritedPasswordSources?: SpaceRuleSource[]; diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx index e25d961e14c..81b77be3dc1 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx @@ -10,6 +10,7 @@ import { spaces, spaceVideos, users, + videoNotes, videos, videoUploads, } from "@cap/database/schema"; @@ -32,6 +33,7 @@ import { and, desc, eq, inArray, isNull, or, type SQL, sql } from "drizzle-orm"; import { Effect } from "effect"; import type { Metadata } from "next"; import { notFound } from "next/navigation"; +import { capKindCountsFromTotals } from "@/lib/cap-kind"; import { resolveDashboardPageSize } from "@/lib/dashboard-page-size"; import { parsePageParam } from "@/lib/page-param"; import { seedThumbnailUrls } from "@/lib/seeded-thumbnails"; @@ -405,13 +407,18 @@ export default async function SharedCapsPage(props: { sql`${videoUploads.videoId} IS NOT NULL AND ${videos.isScreenshot} = false`.mapWith( Boolean, ), + isNote: videos.isNote, + noteExcerpt: videoNotes.excerpt, }) .from(videos) .innerJoin(spaceVideosPage, eq(videos.id, spaceVideosPage.id)) .leftJoin(comments, eq(videos.id, comments.videoId)) .leftJoin(users, eq(videos.ownerId, users.id)) .leftJoin(videoUploads, eq(videos.id, videoUploads.videoId)) + .leftJoin(videoNotes, eq(videos.id, videoNotes.videoId)) .groupBy( + videos.isNote, + videoNotes.excerpt, videos.id, videos.ownerId, videos.name, @@ -429,6 +436,14 @@ export default async function SharedCapsPage(props: { db() .select({ count: sql`COUNT(DISTINCT ${videos.id})`.mapWith(Number), + images: + sql`COUNT(DISTINCT CASE WHEN ${videos.isNote} = false AND ${videos.isScreenshot} = true THEN ${videos.id} END)`.mapWith( + Number, + ), + notes: + sql`COUNT(DISTINCT CASE WHEN ${videos.isNote} = true THEN ${videos.id} END)`.mapWith( + Number, + ), }) .from(spaceVideos) .innerJoin(videos, eq(spaceVideos.videoId, videos.id)) @@ -444,6 +459,7 @@ export default async function SharedCapsPage(props: { return { videos: videoRows, totalCount: totalCountResult[0]?.count || 0, + kindCounts: capKindCountsFromTotals(totalCountResult[0]), }; } @@ -451,7 +467,7 @@ export default async function SharedCapsPage(props: { spaceMembersData, organizationMembersData, foldersData, - { videos: spaceVideoData, totalCount }, + { videos: spaceVideoData, totalCount, kindCounts }, organizationSettings, ] = await Promise.all([ fetchSpaceMembers(space.id).pipe(runPromise), @@ -463,7 +479,7 @@ export default async function SharedCapsPage(props: { const thumbnails = seedThumbnailUrls( user, spaceVideoData - .filter((video) => !video.hasActiveUpload) + .filter((video) => !video.hasActiveUpload && !video.isNote) .map((video) => Video.VideoId.make(video.id)), ); const resolvedSpace = await Effect.gen(function* () { @@ -508,6 +524,7 @@ export default async function SharedCapsPage(props: { `COUNT(DISTINCT ${videos.id})`.mapWith(Number), + images: + sql`COUNT(DISTINCT CASE WHEN ${videos.isNote} = false AND ${videos.isScreenshot} = true THEN ${videos.id} END)`.mapWith( + Number, + ), + notes: + sql`COUNT(DISTINCT CASE WHEN ${videos.isNote} = true THEN ${videos.id} END)`.mapWith( + Number, + ), }) .from(sharedVideos) .innerJoin(videos, eq(sharedVideos.videoId, videos.id)) @@ -608,11 +638,12 @@ export default async function SharedCapsPage(props: { return { videos: videoRows, totalCount: totalCountResult[0]?.count || 0, + kindCounts: capKindCountsFromTotals(totalCountResult[0]), }; } const [ - { videos: orgVideoData, totalCount }, + { videos: orgVideoData, totalCount, kindCounts }, organizationMembersData, foldersData, organizationSettings, @@ -625,7 +656,7 @@ export default async function SharedCapsPage(props: { const thumbnails = seedThumbnailUrls( user, orgVideoData - .filter((video) => !video.hasActiveUpload) + .filter((video) => !video.hasActiveUpload && !video.isNote) .map((video) => Video.VideoId.make(video.id)), ); const sharedSpacesMap = await fetchSharedSpacesForVideos( @@ -661,6 +692,7 @@ export default async function SharedCapsPage(props: { Date: Fri, 27 Nov 2026 15:37:00 +0000 Subject: [PATCH 04/27] feat(web): show shared notes on the share page --- .../unit/comment-composer-composition.test.ts | 1 + .../unit/embed-video-playback-chrome.test.ts | 1 + .../__tests__/unit/share-page-loading.test.ts | 1 + .../unit/share-page-round-trips.test.ts | 1 + .../unit/share-transcript-rendering.test.ts | 1 + apps/web/app/embed/[videoId]/page.tsx | 1 + apps/web/app/s/[videoId]/NoteShare.tsx | 210 +++++++++++++ apps/web/app/s/[videoId]/Share.tsx | 97 +----- .../s/[videoId]/_components/AccessStates.tsx | 37 ++- .../s/[videoId]/_components/PasswordGate.tsx | 22 +- .../s/[videoId]/_components/ShareHeader.tsx | 35 ++- .../[videoId]/_components/ShareLinkDialog.tsx | 15 +- .../app/s/[videoId]/_components/Sidebar.tsx | 66 ++-- .../_components/note/NoteDocument.tsx | 141 +++++++++ .../_components/note/NoteMeetingTime.tsx | 39 +++ .../_components/note/NoteTranscript.tsx | 43 +++ .../_components/tabs/Activity/Comment.tsx | 2 +- .../[videoId]/_components/track-video-view.ts | 95 ++++++ apps/web/app/s/[videoId]/page.tsx | 291 ++++++++++++------ 19 files changed, 852 insertions(+), 247 deletions(-) create mode 100644 apps/web/app/s/[videoId]/NoteShare.tsx create mode 100644 apps/web/app/s/[videoId]/_components/note/NoteDocument.tsx create mode 100644 apps/web/app/s/[videoId]/_components/note/NoteMeetingTime.tsx create mode 100644 apps/web/app/s/[videoId]/_components/note/NoteTranscript.tsx create mode 100644 apps/web/app/s/[videoId]/_components/track-video-view.ts diff --git a/apps/web/__tests__/unit/comment-composer-composition.test.ts b/apps/web/__tests__/unit/comment-composer-composition.test.ts index c90630fe24b..42c9e640b8c 100644 --- a/apps/web/__tests__/unit/comment-composer-composition.test.ts +++ b/apps/web/__tests__/unit/comment-composer-composition.test.ts @@ -63,6 +63,7 @@ const video = { xStreamInfo: null, firstViewEmailSentAt: null, isScreenshot: true, + isNote: false, awsRegion: null, awsBucket: null, videoStartTime: null, diff --git a/apps/web/__tests__/unit/embed-video-playback-chrome.test.ts b/apps/web/__tests__/unit/embed-video-playback-chrome.test.ts index 52020b5e13d..dee8d82f812 100644 --- a/apps/web/__tests__/unit/embed-video-playback-chrome.test.ts +++ b/apps/web/__tests__/unit/embed-video-playback-chrome.test.ts @@ -219,6 +219,7 @@ const createProps = ( xStreamInfo: null, firstViewEmailSentAt: null, isScreenshot: false, + isNote: false, awsRegion: null, awsBucket: null, videoStartTime: null, diff --git a/apps/web/__tests__/unit/share-page-loading.test.ts b/apps/web/__tests__/unit/share-page-loading.test.ts index f4305b19227..b3aa2c832b1 100644 --- a/apps/web/__tests__/unit/share-page-loading.test.ts +++ b/apps/web/__tests__/unit/share-page-loading.test.ts @@ -136,6 +136,7 @@ vi.mock("@/app/s/[videoId]/_components/ShareHeader", () => ({ ShareHeader: () => null, })); vi.mock("@/app/s/[videoId]/Share", () => ({ Share: () => null })); +vi.mock("@/app/s/[videoId]/NoteShare", () => ({ NoteShare: () => null })); import { PasswordGate } from "@/app/s/[videoId]/_components/PasswordGate"; import ShareVideoPage from "@/app/s/[videoId]/page"; diff --git a/apps/web/__tests__/unit/share-page-round-trips.test.ts b/apps/web/__tests__/unit/share-page-round-trips.test.ts index 5478ec9cd12..65980da60f5 100644 --- a/apps/web/__tests__/unit/share-page-round-trips.test.ts +++ b/apps/web/__tests__/unit/share-page-round-trips.test.ts @@ -97,6 +97,7 @@ vi.mock("@/app/s/[videoId]/_components/ShareHeader", () => ({ ShareHeader: () => null, })); vi.mock("@/app/s/[videoId]/Share", () => ({ Share: () => null })); +vi.mock("@/app/s/[videoId]/NoteShare", () => ({ NoteShare: () => null })); import type { ShareHeader } from "@/app/s/[videoId]/_components/ShareHeader"; import ShareVideoPage from "@/app/s/[videoId]/page"; diff --git a/apps/web/__tests__/unit/share-transcript-rendering.test.ts b/apps/web/__tests__/unit/share-transcript-rendering.test.ts index a53f19d8f62..df40226c96c 100644 --- a/apps/web/__tests__/unit/share-transcript-rendering.test.ts +++ b/apps/web/__tests__/unit/share-transcript-rendering.test.ts @@ -70,6 +70,7 @@ const video: VideoData = { fps: 30, public: true, isScreenshot: false, + isNote: false, skipProcessing: false, createdAt: new Date("2026-01-01"), updatedAt: new Date("2026-01-01"), diff --git a/apps/web/app/embed/[videoId]/page.tsx b/apps/web/app/embed/[videoId]/page.tsx index 594aa25186e..3d0aa2c87ae 100644 --- a/apps/web/app/embed/[videoId]/page.tsx +++ b/apps/web/app/embed/[videoId]/page.tsx @@ -148,6 +148,7 @@ export default async function EmbedVideoPage( jobId: videos.jobId, jobStatus: videos.jobStatus, isScreenshot: videos.isScreenshot, + isNote: videos.isNote, skipProcessing: videos.skipProcessing, transcriptionStatus: videos.transcriptionStatus, source: videos.source, diff --git a/apps/web/app/s/[videoId]/NoteShare.tsx b/apps/web/app/s/[videoId]/NoteShare.tsx new file mode 100644 index 00000000000..04d80c887db --- /dev/null +++ b/apps/web/app/s/[videoId]/NoteShare.tsx @@ -0,0 +1,210 @@ +"use client"; + +import type { comments as commentsSchema } from "@cap/database/schema"; +import type { ViewerSettingKey } from "@cap/web-backend"; +import type { ImageUpload } from "@cap/web-domain"; +import clsx from "clsx"; +import { useReducedMotion } from "motion/react"; +import { + type ReactNode, + startTransition, + use, + useCallback, + useEffect, + useId, + useMemo, + useOptimistic, + useRef, + useState, +} from "react"; +import type { OrganizationSettings } from "@/app/(org)/dashboard/dashboard-data"; +import { Sidebar } from "./_components/Sidebar"; +import { Toolbar } from "./_components/Toolbar"; +import { trackVideoView } from "./_components/track-video-view"; +import type { CommentType } from "./Share"; +import type { VideoData } from "./types"; + +type CommentWithAuthor = typeof commentsSchema.$inferSelect & { + authorName: string | null; + authorImage: ImageUpload.ImageUrl | null; +}; + +export function NoteShare({ + data, + header, + document: noteDocument, + transcript, + comments, + views, + videoSettings, + viewerId, +}: { + data: VideoData; + header: ReactNode; + document: ReactNode; + transcript: ReactNode | null; + comments: MaybePromise; + views: MaybePromise; + videoSettings?: OrganizationSettings | null; + viewerId?: string | null; +}) { + const customCreatedAt = data.metadata?.customCreatedAt; + const effectiveDate = useMemo( + () => (customCreatedAt ? new Date(customCreatedAt) : data.createdAt), + [customCreatedAt, data.createdAt], + ); + + const activityRef = useRef<{ scrollToBottom: () => void }>(null); + const initialComments: CommentType[] = + comments instanceof Promise ? use(comments) : comments; + const [commentsData, setCommentsData] = + useState(initialComments); + const [optimisticComments, setOptimisticComments] = useOptimistic( + commentsData, + (state, newComment: CommentType) => [...state, newComment], + ); + + useEffect(() => { + if (viewerId && viewerId === data.owner.id) return; + trackVideoView({ + videoId: data.id, + orgId: data.orgId, + ownerId: data.owner.id, + }); + }, [data.id, data.orgId, data.owner.id, viewerId]); + + const isDisabled = (setting: ViewerSettingKey) => + videoSettings?.[setting] ?? data.orgSettings?.[setting] ?? false; + const commentsDisabled = isDisabled("disableComments"); + const reactionsDisabled = isDisabled("disableReactions"); + const shownTranscript = isDisabled("disableTranscript") ? null : transcript; + const showRail = !commentsDisabled || shownTranscript !== null; + + const handleOptimisticComment = useCallback( + (comment: CommentType) => { + startTransition(() => { + setOptimisticComments(comment); + }); + setTimeout(() => activityRef.current?.scrollToBottom(), 100); + }, + [setOptimisticComments], + ); + + const handleCommentSuccess = useCallback((realComment: CommentType) => { + startTransition(() => { + setCommentsData((prev) => [...prev, realComment]); + }); + setTimeout(() => activityRef.current?.scrollToBottom(), 100); + }, []); + + const visibleComments = useMemo(() => { + const settledKeys = new Set(); + for (const comment of optimisticComments) + if (!comment.sending && comment.clientKey) + settledKeys.add(comment.clientKey); + if (settledKeys.size === 0) return optimisticComments; + return optimisticComments.filter( + (comment) => !(comment.sending && settledKeys.has(comment.id)), + ); + }, [optimisticComments]); + + const sidebarData = useMemo( + () => ({ ...data, createdAt: effectiveDate }), + [data, effectiveDate], + ); + + const reduceMotion = useReducedMotion() ?? false; + const sidebarId = useId(); + const [railCollapsed, setRailCollapsed] = useState(false); + const toggleRail = useCallback(() => { + setRailCollapsed((collapsed) => !collapsed); + }, []); + + return ( + <> +

+ {header} +
+
+
+
+
+ {noteDocument} + {(!commentsDisabled || !reactionsDisabled || showRail) && ( +
+ + {showRail && railCollapsed && ( + + )} +
+ )} +
+
+
+ {showRail && ( + + )} +
+ + ); +} diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsx index 3a4debd1fd9..e148c8d2f7d 100644 --- a/apps/web/app/s/[videoId]/Share.tsx +++ b/apps/web/app/s/[videoId]/Share.tsx @@ -41,6 +41,7 @@ import { Toolbar } from "./_components/Toolbar"; import { formatTimeAgo } from "./_components/tabs/Activity/utils"; import { TimelineSkeleton } from "./_components/timeline/TimelineSkeleton"; import type { FilmstripSource } from "./_components/timeline/useFilmstripFrames"; +import { trackVideoView } from "./_components/track-video-view"; import type { VideoData } from "./types"; const importTimelineView = () => import("./_components/timeline/TimelineView"); @@ -75,102 +76,6 @@ export type CommentType = typeof commentsSchema.$inferSelect & { clientKey?: string; }; -const SESSION_STORAGE_KEY = "cap_tb_session_id"; -const SESSION_TTL_MS = 30 * 60 * 1000; // 30 minutes - -const ensureAnalyticsSessionId = () => { - if (typeof window === "undefined") return "anonymous"; - try { - const raw = window.localStorage.getItem(SESSION_STORAGE_KEY); - const now = Date.now(); - if (raw) { - const parsed = JSON.parse(raw) as { value: string; expiry: number }; - if (parsed?.value && parsed.expiry > now) return parsed.value; - } - const newId = - typeof crypto !== "undefined" && "randomUUID" in crypto - ? crypto.randomUUID() - : Math.random().toString(36).slice(2); - window.localStorage.setItem( - SESSION_STORAGE_KEY, - JSON.stringify({ value: newId, expiry: now + SESSION_TTL_MS }), - ); - return newId; - } catch (error) { - console.warn("Failed to persist analytics session id", error); - return "anonymous"; - } -}; - -const trackVideoView = (payload: { - videoId: string; - orgId?: string | null; - ownerId?: string | null; -}) => { - if (typeof window === "undefined") return; - const sessionId = ensureAnalyticsSessionId(); - const screen = window.screen; - const body = { - videoId: payload.videoId, - orgId: payload.orgId, - ownerId: payload.ownerId, - sessionId, - pathname: window.location.pathname, - href: window.location.href, - referrer: document.referrer, - hostname: window.location.hostname, - timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, - language: typeof navigator !== "undefined" ? navigator.language : undefined, - locale: - typeof navigator !== "undefined" && navigator.languages?.length - ? navigator.languages[0] - : undefined, - screen: screen - ? { - width: screen.width, - height: screen.height, - colorDepth: screen.colorDepth, - } - : undefined, - userAgent: - typeof navigator !== "undefined" ? navigator.userAgent : undefined, - occurredAt: new Date().toISOString(), - }; - - const serializedBody = JSON.stringify(body); - - if ( - typeof navigator !== "undefined" && - typeof navigator.sendBeacon === "function" - ) { - try { - const beaconPayload = new Blob([serializedBody], { - type: "application/json", - }); - const queued = navigator.sendBeacon( - "/api/analytics/track", - beaconPayload, - ); - if (queued) { - return; - } - } catch (error) { - console.warn("Falling back to fetch for analytics tracking", error); - } - } - - void fetch("/api/analytics/track", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: serializedBody, - keepalive: true, - }).catch((error) => { - if (error?.name !== "AbortError") { - console.warn("Failed to track analytics event", error); - } - }); -}; - type AiGenerationStatus = | "QUEUED" | "PROCESSING" diff --git a/apps/web/app/s/[videoId]/_components/AccessStates.tsx b/apps/web/app/s/[videoId]/_components/AccessStates.tsx index 05eb9df3e20..3bd15e04e26 100644 --- a/apps/web/app/s/[videoId]/_components/AccessStates.tsx +++ b/apps/web/app/s/[videoId]/_components/AccessStates.tsx @@ -35,7 +35,12 @@ function SwitchAccountButton({ loginUrl }: { loginUrl: string }) { ); } -export function PrivateVideoState({ videoId }: { videoId: Video.VideoId }) { +type AccessStateProps = { videoId: Video.VideoId; isNote?: boolean }; + +export function PrivateVideoState({ + videoId, + isNote = false, +}: AccessStateProps) { const user = useCurrentUser(); const urls = accessUrls(videoId); @@ -44,7 +49,7 @@ export function PrivateVideoState({ videoId }: { videoId: Video.VideoId }) { } - title="This video is private" + title={isNote ? "This note is private" : "This video is private"} lede={ <> You're signed in as {user.email}, which doesn't @@ -70,8 +75,12 @@ export function PrivateVideoState({ videoId }: { videoId: Video.VideoId }) { } - title="This video is private" - lede="Only people the owner invited can watch it. If that's you, sign in with the email address that was invited." + title={isNote ? "This note is private" : "This video is private"} + lede={ + isNote + ? "Only people the owner invited can read it. If that's you, sign in with the email address that was invited." + : "Only people the owner invited can watch it. If that's you, sign in with the email address that was invited." + } > @@ -85,13 +94,20 @@ export function PrivateVideoState({ videoId }: { videoId: Video.VideoId }) { ); } -export function SignInRequiredState({ videoId }: { videoId: Video.VideoId }) { +export function SignInRequiredState({ + videoId, + isNote = false, +}: AccessStateProps) { return ( } - title="Sign in to watch" - lede="The owner only shares this video with approved email addresses. Sign in with yours to start watching." + title={isNote ? "Sign in to read" : "Sign in to watch"} + lede={ + isNote + ? "The owner only shares this note with approved email addresses. Sign in with yours to read it." + : "The owner only shares this video with approved email addresses. Sign in with yours to start watching." + } > @@ -102,14 +118,17 @@ export function SignInRequiredState({ videoId }: { videoId: Video.VideoId }) { ); } -export function AccessRestrictedState({ videoId }: { videoId: Video.VideoId }) { +export function AccessRestrictedState({ + videoId, + isNote = false, +}: AccessStateProps) { const user = useCurrentUser(); return ( } - title="This video is restricted" + title={isNote ? "This note is restricted" : "This video is restricted"} lede={ user ? ( <> diff --git a/apps/web/app/s/[videoId]/_components/PasswordGate.tsx b/apps/web/app/s/[videoId]/_components/PasswordGate.tsx index f1c2b413208..382525ef37a 100644 --- a/apps/web/app/s/[videoId]/_components/PasswordGate.tsx +++ b/apps/web/app/s/[videoId]/_components/PasswordGate.tsx @@ -13,7 +13,13 @@ import { } from "@/components/paper-state/PaperState"; import { TOO_MANY_PASSWORD_ATTEMPTS } from "@/lib/password-attempts"; -export function PasswordGate({ videoId }: { videoId: Video.VideoId }) { +export function PasswordGate({ + videoId, + isNote = false, +}: { + videoId: Video.VideoId; + isNote?: boolean; +}) { const [password, setPassword] = useState(""); const router = useRouter(); @@ -33,8 +39,16 @@ export function PasswordGate({ videoId }: { videoId: Video.VideoId }) { } - title="This video is password protected" - lede="Enter the password the owner gave you to start watching." + title={ + isNote + ? "This note is password protected" + : "This video is password protected" + } + lede={ + isNote + ? "Enter the password the owner gave you to read it." + : "Enter the password the owner gave you to start watching." + } >
- {busy ? "Checking…" : "Watch video"} + {busy ? "Checking…" : isNote ? "Open note" : "Watch video"} {failed && (

diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx index 2ee66dfb6d4..dc2e910198e 100644 --- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx +++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx @@ -489,11 +489,13 @@ export const ShareHeader = ({ }; const copyShareLink = (url: string) => - copyRichVideoLink({ - url, - title: displayTitle || "Cap Recording", - previewImageUrl: videoPreviewImageUrl(webUrl, data.id), - }); + data.isNote + ? navigator.clipboard.writeText(url) + : copyRichVideoLink({ + url, + title: displayTitle || "Cap Recording", + previewImageUrl: videoPreviewImageUrl(webUrl, data.id), + }); const handleCopyClick = () => { const video = document.querySelector("video"); @@ -684,6 +686,7 @@ export const ShareHeader = ({ const canEditVideo = isOwner && !data.isScreenshot && + !data.isNote && !data.hasActiveUpload && (data.source.type === "desktopMP4" || data.source.type === "webMP4"); const customThumbnail = getCustomThumbnailMetadata(data.metadata); @@ -885,6 +888,7 @@ export const ShareHeader = ({ user={user} onUpgradeRequest={setUpgradeModalOpen} shareUrl={getVideoLink()} + isNote={data.isNote} /> )} {shareLinkDialogMounted && ( @@ -901,6 +905,7 @@ export const ShareHeader = ({ setIsSharingDialogOpen(true); }} ownerIsPro={data.owner.isPro} + isNote={data.isNote} /> )} {isOwner && ( @@ -929,6 +934,7 @@ export const ShareHeader = ({ user={user} organizationSettings={data.orgSettings} onSaved={refresh} + isNote={data.isNote} /> )} {passwordDialogMounted && ( @@ -1296,7 +1302,7 @@ export const ShareHeader = ({ >

- Video settings + {data.isNote ? "Note settings" : "Video settings"}

@@ -1331,7 +1340,7 @@ export const ShareHeader = ({ ) : null} - {!data.isScreenshot && ( + {!data.isScreenshot && !data.isNote && ( setIsThumbnailDialogOpen(true)} className="flex items-center gap-2 rounded-lg" @@ -1364,10 +1373,12 @@ export const ShareHeader = ({ : "Add password"}

- + {!data.isNote && ( + + )} {/* Downloads used to live behind a second dots button next to the link. There is one "everything else about this Cap" menu, and this is it. */} diff --git a/apps/web/app/s/[videoId]/_components/ShareLinkDialog.tsx b/apps/web/app/s/[videoId]/_components/ShareLinkDialog.tsx index 3b074467d39..246294f059f 100644 --- a/apps/web/app/s/[videoId]/_components/ShareLinkDialog.tsx +++ b/apps/web/app/s/[videoId]/_components/ShareLinkDialog.tsx @@ -96,6 +96,7 @@ export const ShareLinkDialog = ({ canManageAccess = false, onManageAccess, ownerIsPro = false, + isNote = false, }: { open: boolean; onOpenChange: (open: boolean) => void; @@ -107,6 +108,7 @@ export const ShareLinkDialog = ({ canManageAccess?: boolean; onManageAccess?: () => void; ownerIsPro?: boolean; + isNote?: boolean; }) => { const { webUrl } = usePublicEnv(); const playback = useOptionalPlayback(); @@ -159,6 +161,8 @@ export const ShareLinkDialog = ({ try { if (tab === "embed") { await navigator.clipboard.writeText(embedCode); + } else if (isNote) { + await navigator.clipboard.writeText(targetUrl); } else { await copyRichVideoLink({ url: targetUrl, @@ -172,7 +176,7 @@ export const ShareLinkDialog = ({ tab === "embed" ? "Failed to copy embed code" : "Failed to copy link", ); } - }, [tab, embedCode, targetUrl, videoTitle, webUrl, videoId]); + }, [tab, embedCode, targetUrl, videoTitle, webUrl, videoId, isNote]); return ( @@ -185,7 +189,7 @@ export const ShareLinkDialog = ({ Share -
+
{TABS.map(({ id, label, Icon }) => { const active = tab === id; return ( @@ -303,7 +307,12 @@ export const ShareLinkDialog = ({ : "Copy link"} - + ), + input: ({ node: _node, ...props }) => + props.type === "checkbox" ? ( + + ) : null, +}; + +function NoteMarkdown({ children }: { children: string }) { + return ( +
+ + {children} + +
+ ); +} + +export function NoteDocument({ + summaryMarkdown, + notesMarkdown, + participants, + meetingStartedAt, + duration, + ownerName, +}: { + summaryMarkdown: string | null; + notesMarkdown: string | null; + participants: string[]; + meetingStartedAt: Date | null; + duration: number | null; + ownerName: string | null; +}) { + const summary = summaryMarkdown?.trim() ?? ""; + const ownNotes = notesMarkdown?.trim() ?? ""; + const shownParticipants = participants.slice(0, SHOWN_PARTICIPANTS); + const moreParticipants = participants.length - shownParticipants.length; + const people = + shownParticipants.length > 0 + ? `${shownParticipants.join(", ")}${moreParticipants > 0 ? ` +${moreParticipants}` : ""}` + : null; + const hasDetails = Boolean(meetingStartedAt || duration || people); + + return ( +
+
+ {hasDetails && ( +

+ {meetingStartedAt && ( + + )} + {meetingStartedAt && duration ? ( + + · + + ) : null} + {duration ? {formatMeetingLength(duration)} : null} + {people && (meetingStartedAt || duration) ? ( + + · + + ) : null} + {people && ( + + {people} + + )} +

+ )} + {summary && {summary}} + {ownNotes && ( +
+

+ {ownerName ? `Notes from ${ownerName}` : "Notes"} +

+ {ownNotes} +
+ )} + {!summary && !ownNotes && ( +

This note is empty.

+ )} +
+
+ ); +} diff --git a/apps/web/app/s/[videoId]/_components/note/NoteMeetingTime.tsx b/apps/web/app/s/[videoId]/_components/note/NoteMeetingTime.tsx new file mode 100644 index 00000000000..6833e37f270 --- /dev/null +++ b/apps/web/app/s/[videoId]/_components/note/NoteMeetingTime.tsx @@ -0,0 +1,39 @@ +"use client"; + +import { useSyncExternalStore } from "react"; + +const utcDay = new Intl.DateTimeFormat("en-US", { + weekday: "short", + month: "short", + day: "numeric", + timeZone: "UTC", +}); + +const localDay = new Intl.DateTimeFormat("en-US", { + weekday: "short", + month: "short", + day: "numeric", +}); + +const localTime = new Intl.DateTimeFormat("en-US", { + hour: "numeric", + minute: "2-digit", +}); + +const subscribeToNothing = () => () => {}; + +export function NoteMeetingTime({ iso }: { iso: string }) { + const hydrated = useSyncExternalStore( + subscribeToNothing, + () => true, + () => false, + ); + const date = new Date(iso); + return ( + + ); +} diff --git a/apps/web/app/s/[videoId]/_components/note/NoteTranscript.tsx b/apps/web/app/s/[videoId]/_components/note/NoteTranscript.tsx new file mode 100644 index 00000000000..10014b063e6 --- /dev/null +++ b/apps/web/app/s/[videoId]/_components/note/NoteTranscript.tsx @@ -0,0 +1,43 @@ +import type { VideoNoteTranscriptTurn } from "@cap/database/schema"; + +const formatTurnTime = (startMs: number) => { + const total = Math.max(0, Math.floor(startMs / 1000)); + const hours = Math.floor(total / 3600); + const minutes = Math.floor((total % 3600) / 60); + const seconds = total % 60; + const pad = (value: number) => String(value).padStart(2, "0"); + return hours > 0 + ? `${hours}:${pad(minutes)}:${pad(seconds)}` + : `${pad(minutes)}:${pad(seconds)}`; +}; + +export function NoteTranscript({ + turns, +}: { + turns: VideoNoteTranscriptTurn[]; +}) { + const rows = turns.map((turn, position) => ({ + ...turn, + id: `${turn.startMs}:${position}`, + })); + + return ( +
    + {rows.map((row) => ( +
  1. +

    + + {row.speaker} + + + {formatTurnTime(row.startMs)} + +

    +

    + {row.text} +

    +
  2. + ))} +
+ ); +} diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx index a98b4df6424..dbbe4c55235 100644 --- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx +++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx @@ -115,7 +115,7 @@ const CommentComponent: React.FC<{

- {comment.timestamp !== null && ( + {comment.timestamp !== null && onSeek && (
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx index 6184ecd55f7..5fe326ddeca 100644 --- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx +++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx @@ -38,6 +38,7 @@ export const Comments = Object.assign( setOptimisticComments: (newComment: CommentType) => void; handleCommentSuccess: (comment: CommentType) => void; onSeek?: (time: number) => void; + hideTimestamps?: boolean; setShowAuthOverlay: (v: boolean) => void; commentsDisabled: boolean; ownerName?: string | null; @@ -294,6 +295,7 @@ export const Comments = Object.assign( onCancelReply={handleCancelReply} onDelete={handleDeleteComment} onSeek={onSeek} + hideTimestamps={props.hideTimestamps} /> ); })} diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx index eeda00ea991..de7b5a3ad40 100644 --- a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx +++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx @@ -15,6 +15,7 @@ interface ActivityProps { comments: CommentType[]; setComments: React.Dispatch>; onSeek?: (time: number) => void; + hideTimestamps?: boolean; handleCommentSuccess: (comment: CommentType) => void; videoId: Video.VideoId; optimisticComments: CommentType[]; @@ -72,6 +73,7 @@ export const Activity = Object.assign( videoId={videoId} setShowAuthOverlay={setShowAuthOverlay} onSeek={props.onSeek} + hideTimestamps={props.hideTimestamps} commentsDisabled={commentsDisabled} ownerName={ownerName} canRecordMedia={canRecordMedia} From e612c26a1fc10f47ff51977196de892ba06d3900 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:39:12 +0000 Subject: [PATCH 12/27] test(web): cover who can read shared note content --- .../unit/note-content-readers.test.ts | 75 ++++++++++++++++ .../unit/note-document-markdown.test.ts | 64 ++++++++++++++ .../unit/share-page-round-trips.test.ts | 87 ++++++++++++++++++- 3 files changed, 222 insertions(+), 4 deletions(-) create mode 100644 apps/web/__tests__/unit/note-content-readers.test.ts create mode 100644 apps/web/__tests__/unit/note-document-markdown.test.ts diff --git a/apps/web/__tests__/unit/note-content-readers.test.ts b/apps/web/__tests__/unit/note-content-readers.test.ts new file mode 100644 index 00000000000..d07b742afe4 --- /dev/null +++ b/apps/web/__tests__/unit/note-content-readers.test.ts @@ -0,0 +1,75 @@ +import { readdirSync, readFileSync } from "node:fs"; +import { join, relative } from "node:path"; +import { describe, expect, it } from "vitest"; + +const repo = join(__dirname, "../../../.."); +const roots = ["apps/web", "packages"]; +const skipped = new Set([ + "node_modules", + ".next", + ".turbo", + "dist", + "__tests__", + "migrations", +]); + +const sources = (directory: string): string[] => + readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { + if (skipped.has(entry.name)) return []; + const path = join(directory, entry.name); + if (entry.isDirectory()) return sources(path); + return /\.tsx?$/.test(entry.name) && !/\.test\.tsx?$/.test(entry.name) + ? [path] + : []; + }); + +const readers = roots + .flatMap((root) => sources(join(repo, root))) + .filter((path) => + /\bvideoNotes\b|\bvideo_notes\b/.test(readFileSync(path, "utf8")), + ) + .map((path) => relative(repo, path)) + .sort(); + +const readsText = (path: string) => + /videoNotes\.(summaryMarkdown|notesMarkdown|transcript|participants|excerpt)\b/.test( + readFileSync(join(repo, path), "utf8"), + ); + +describe("who reads shared note content", () => { + it("is only the share page, signed-in library lists and the note's own lifecycle", () => { + expect(readers).toEqual([ + "apps/web/actions/spaces/get-user-videos.ts", + "apps/web/app/(org)/dashboard/caps/caps-page-data.tsx", + "apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx", + "apps/web/app/s/[videoId]/page.tsx", + "apps/web/lib/folder.ts", + "apps/web/lib/meetings/share.ts", + "apps/web/workflows/agent-cap-operation.ts", + "apps/web/workflows/transfer-organization-content.ts", + "packages/database/schema.ts", + "packages/web-backend/src/Organisations/index.ts", + "packages/web-backend/src/Videos/VideosRepo.ts", + ]); + }); + + it("returns the full note from the share page alone", () => { + expect( + readers.filter((path) => + /videoNotes\.(summaryMarkdown|notesMarkdown|transcript|participants)\b/.test( + readFileSync(join(repo, path), "utf8"), + ), + ), + ).toEqual(["apps/web/app/s/[videoId]/page.tsx"]); + }); + + it("lists an excerpt only on signed-in library pages", () => { + expect(readers.filter(readsText)).toEqual([ + "apps/web/actions/spaces/get-user-videos.ts", + "apps/web/app/(org)/dashboard/caps/caps-page-data.tsx", + "apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx", + "apps/web/app/s/[videoId]/page.tsx", + "apps/web/lib/folder.ts", + ]); + }); +}); diff --git a/apps/web/__tests__/unit/note-document-markdown.test.ts b/apps/web/__tests__/unit/note-document-markdown.test.ts new file mode 100644 index 00000000000..3e626e1713d --- /dev/null +++ b/apps/web/__tests__/unit/note-document-markdown.test.ts @@ -0,0 +1,64 @@ +import { createElement } from "react"; +import { renderToStaticMarkup } from "react-dom/server"; +import { describe, expect, it } from "vitest"; +import { NoteDocument } from "@/app/s/[videoId]/_components/note/NoteDocument"; + +const render = (summaryMarkdown: string, notesMarkdown: string | null = null) => + renderToStaticMarkup( + createElement(NoteDocument, { + summaryMarkdown, + notesMarkdown, + participants: [""], + meetingStartedAt: null, + duration: 120, + ownerName: "", + }), + ); + +describe("shared note markdown", () => { + it("shows markup in a note as text, never as elements", () => { + const html = render( + [ + "", + '', + '', + 'raw', + "", + ].join("\n\n"), + "", + ); + + expect(html).not.toMatch(/<(script|img|iframe|style|svg)\b/i); + expect(html.replace(/"[^"]*"/g, '""')).not.toMatch( + /<[a-z][^>]*\son[a-z]+=/i, + ); + expect(html).not.toMatch(/ { + const html = render( + [ + "![pixel](https://example.com/track.png)", + "[run](javascript:alert(1))", + "[data](data:text/html;base64,PHNjcmlwdD4=)", + "[vb](vbscript:msgbox(1))", + "[site](https://example.com/page)", + ].join("\n\n"), + ); + + expect(html).not.toMatch(/ { + const html = render("- [x] Done\n- [ ] Next"); + + expect(html).not.toMatch(/ ({ query: vi.fn() })); +const mocks = vi.hoisted(() => ({ + query: vi.fn(), + note: false, + access: "allowed" as "allowed" | "private" | "password", +})); vi.mock("server-only", () => ({})); vi.mock("@cap/database", async () => { @@ -45,7 +49,15 @@ vi.mock("@/lib/server", async () => { runPromise: (effect: Effect.Effect) => effect.pipe( Effect.provideService(Context.GenericTag("SharePerfPolicy"), { - canViewLoaded: () => Effect.void, + canViewLoaded: () => + mocks.access === "allowed" + ? Effect.void + : Effect.fail({ + _tag: + mocks.access === "private" + ? "PolicyDenied" + : "VerifyVideoPasswordError", + }), }), Effect.provideService(Context.GenericTag("SharePerfDatabase"), { use: (callback: (client: ReturnType) => Promise) => @@ -84,6 +96,7 @@ vi.mock("@/lib/share-playback", () => ({ vi.mock("@/lib/share-web-url", () => ({ resolveShareWebUrl: vi.fn(), resolveForeignShareRedirect: async () => null, + resolveRestrictedShareRedirect: async () => null, })); vi.mock("@/lib/transcribe", () => ({ transcribeVideo: vi.fn() })); vi.mock("@/utils/flags", () => ({ isAiGenerationEnabled: async () => true })); @@ -126,6 +139,22 @@ const recording = { transcriptionStatus: "COMPLETE", }; +const NOTE_TEXT = "NOTE-TEXT-acquisition-of-initech"; +const sharedNote = { + ...recording, + isNote: 1, + source: { type: "local" }, + metadata: null, + transcriptionStatus: "SKIPPED", +}; +const noteContent = { + summaryMarkdown: `## Summary\n\n${NOTE_TEXT}`, + notesMarkdown: NOTE_TEXT, + transcript: [{ speaker: "Sam", startMs: 0, text: NOTE_TEXT }], + participants: ["Sam"], + meetingStartedAt: createdAt, +}; + function project( query: string, tables: Record>, @@ -148,7 +177,7 @@ function rowsFor(query: string) { ) { return [ project(query, { - videos: recording, + videos: mocks.note ? sharedNote : recording, users: { id: "owner", name: "Owner", email: "owner@example.com" }, organizations: organization, shared_videos: { organizationId: "shared-org" }, @@ -228,6 +257,8 @@ function rowsFor(query: string) { } if (query.includes("from `space_members`")) return [["space-member"]]; if (query.includes("from `video_edits`")) return []; + if (query.includes("from `video_notes`")) + return [project(query, { video_notes: noteContent })]; throw new Error(`Unexpected query: ${query}`); } @@ -261,7 +292,11 @@ async function loadPage() { }; } -beforeEach(() => mocks.query.mockReset()); +beforeEach(() => { + mocks.query.mockReset(); + mocks.note = false; + mocks.access = "allowed"; +}); describe("share page database round trips", () => { it("keeps download permission and edit checks within the existing page load", async () => { @@ -330,3 +365,47 @@ describe("share page database round trips", () => { }, ); }); + +describe("share page note content", () => { + const noteQueries = () => + mocks.query.mock.calls + .map(([query]) => String(query)) + .filter((query) => query.includes("`video_notes`")); + + const openNote = (access: typeof mocks.access) => { + mocks.note = true; + mocks.access = access; + mocks.query.mockImplementation(async (query: string) => { + try { + return { rows: rowsFor(query) }; + } catch { + return { rows: [] }; + } + }); + return ShareVideoPage({ + params: Promise.resolve({ videoId: recording.id }), + searchParams: Promise.resolve({}), + }) as Promise>>; + }; + + it.each(["private", "password"] as const)( + "never reads the text of a %s note the viewer cannot open", + async (access) => { + const page = await openNote(access); + + expect(noteQueries()).toEqual([]); + expect(JSON.stringify(page)).not.toContain(NOTE_TEXT); + expect(page.props).toMatchObject({ isNote: true }); + }, + ); + + it("reads the note only for a viewer the policy lets in", async () => { + const page = await openNote("allowed"); + const authorized = page.props.children as ReactElement; + await (authorized.type as (props: unknown) => Promise)( + authorized.props, + ); + + expect(noteQueries()).toHaveLength(1); + }); +}); From d342cdffc18e62c77181258caf59871c45500987 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:29:41 +0000 Subject: [PATCH 13/27] fix(web): tighten note excerpt cleanup and session id fallback --- .../app/s/[videoId]/_components/track-video-view.ts | 6 ++++-- apps/web/lib/meetings/share-content.ts | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/web/app/s/[videoId]/_components/track-video-view.ts b/apps/web/app/s/[videoId]/_components/track-video-view.ts index 8c81137c104..f9d27808583 100644 --- a/apps/web/app/s/[videoId]/_components/track-video-view.ts +++ b/apps/web/app/s/[videoId]/_components/track-video-view.ts @@ -11,9 +11,11 @@ const ensureAnalyticsSessionId = () => { if (parsed?.value && parsed.expiry > now) return parsed.value; } const newId = - typeof crypto !== "undefined" && "randomUUID" in crypto + typeof crypto.randomUUID === "function" ? crypto.randomUUID() - : Math.random().toString(36).slice(2); + : Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => + byte.toString(16).padStart(2, "0"), + ).join(""); window.localStorage.setItem( SESSION_STORAGE_KEY, JSON.stringify({ value: newId, expiry: now + SESSION_TTL_MS }), diff --git a/apps/web/lib/meetings/share-content.ts b/apps/web/lib/meetings/share-content.ts index 013bdec9eef..9a959a07c83 100644 --- a/apps/web/lib/meetings/share-content.ts +++ b/apps/web/lib/meetings/share-content.ts @@ -10,6 +10,15 @@ export function noteTitle(title: string): string { return firstCharacters(trimmed || UNTITLED_NOTE, NOTE_TITLE_COLUMN_CHARS); } +function withoutTags(value: string): string { + let current = value; + for (;;) { + const next = current.replace(/<[^>]*>/g, ""); + if (next === current) return next.replace(/[<>]/g, ""); + current = next; + } +} + export function noteExcerpt(markdown: string): string { const text = markdown .replace(/```[\s\S]*?```/g, " ") @@ -23,9 +32,9 @@ export function noteExcerpt(markdown: string): string { .replace(/^>+\s*/, "") .replace(/^([-*+]|\d+[.)])\s+(\[[ xX]\]\s+)?/, "") .replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1") - .replace(/<[^>]*>/g, "") .replace(/[*_~`]+/g, ""), ) + .map(withoutTags) .join(" ") .replace(/\s+/g, " ") .trim(); From bba3f31ffb9fba0dc80295bb7a44e86329f83c80 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:29:41 +0000 Subject: [PATCH 14/27] improve(web): load the share page shells on demand --- apps/web/app/s/[videoId]/ShareLoader.tsx | 11 +++++++++++ apps/web/app/s/[videoId]/page.tsx | 7 +++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 apps/web/app/s/[videoId]/ShareLoader.tsx diff --git a/apps/web/app/s/[videoId]/ShareLoader.tsx b/apps/web/app/s/[videoId]/ShareLoader.tsx new file mode 100644 index 00000000000..b649801d02b --- /dev/null +++ b/apps/web/app/s/[videoId]/ShareLoader.tsx @@ -0,0 +1,11 @@ +"use client"; + +import dynamic from "next/dynamic"; + +export const ShareLoader = dynamic(() => + import("./Share").then((module) => module.Share), +); + +export const NoteShareLoader = dynamic(() => + import("./NoteShare").then((module) => module.NoteShare), +); diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsx index c90323066e0..42c387f86fd 100644 --- a/apps/web/app/s/[videoId]/page.tsx +++ b/apps/web/app/s/[videoId]/page.tsx @@ -123,8 +123,7 @@ import { NoteTranscript } from "./_components/note/NoteTranscript"; import { PasswordGate } from "./_components/PasswordGate"; import { PendingRecordingShare } from "./_components/PendingRecordingShare"; import { ShareHeader } from "./_components/ShareHeader"; -import { NoteShare } from "./NoteShare"; -import { Share } from "./Share"; +import { NoteShareLoader, ShareLoader } from "./ShareLoader"; const VIEW_NOTIFICATION_DELAY_MS = 2 * 60 * 1000; const VIDEO_ID_PATTERN = /^[0-9abcdefghjkmnpqrstvwxyz]+$/; @@ -1310,7 +1309,7 @@ async function AuthorizedContent({ : []; return (
- - Date: Fri, 27 Nov 2026 17:46:48 +0000 Subject: [PATCH 15/27] fix(web): select only the cards shown on the My Caps overview --- apps/web/__tests__/unit/caps-keyboard.test.ts | 1 + .../__tests__/unit/caps-overview-grid.test.ts | 55 +++++++++++++++ apps/web/app/(org)/dashboard/caps/Caps.tsx | 67 +++++++++++-------- .../app/(org)/dashboard/caps/overview-grid.ts | 31 +++++++++ 4 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 apps/web/__tests__/unit/caps-overview-grid.test.ts create mode 100644 apps/web/app/(org)/dashboard/caps/overview-grid.ts diff --git a/apps/web/__tests__/unit/caps-keyboard.test.ts b/apps/web/__tests__/unit/caps-keyboard.test.ts index 83f5bbec193..ec283d05250 100644 --- a/apps/web/__tests__/unit/caps-keyboard.test.ts +++ b/apps/web/__tests__/unit/caps-keyboard.test.ts @@ -123,6 +123,7 @@ let selection: HTMLButtonElement; beforeEach(async () => { vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true); + vi.stubGlobal("matchMedia", (media: string) => ({ media, matches: true })); mocks.mutate.mockClear(); mocks.mutations.length = 0; mocks.pending = false; diff --git a/apps/web/__tests__/unit/caps-overview-grid.test.ts b/apps/web/__tests__/unit/caps-overview-grid.test.ts new file mode 100644 index 00000000000..9e57041efba --- /dev/null +++ b/apps/web/__tests__/unit/caps-overview-grid.test.ts @@ -0,0 +1,55 @@ +import { describe, expect, it } from "vitest"; +import { + gridColumns, + overviewItemClass, + overviewShows, +} from "@/app/(org)/dashboard/caps/overview-grid"; + +const SHOWN_FROM: Record = { + "sm:block": 2, + "lg:block": 3, + "xl:block": 4, + "2xl:block": 5, +}; + +const shownByClass = (index: number, rows: number, columns: number) => { + const className = overviewItemClass(index, rows); + if (className === undefined) return true; + const show = className.replace("hidden", "").trim(); + return show !== "" && columns >= (SHOWN_FROM[show] ?? Infinity); +}; + +describe("My Caps overview grid", () => { + it("counts a card as shown exactly when its classes show it", () => { + for (const rows of [1, 2]) + for (let columns = 1; columns <= 5; columns++) + for (let index = 0; index < 12; index++) + expect([rows, columns, index, overviewShows(index, rows, columns)]).toEqual([ + rows, + columns, + index, + shownByClass(index, rows, columns), + ]); + }); + + it("shows whole rows on wide screens and a short stack on a phone", () => { + const shown = (rows: number, columns: number) => + Array.from({ length: 10 }, (_, index) => index).filter((index) => + overviewShows(index, rows, columns), + ).length; + + expect([shown(2, 5), shown(2, 4), shown(2, 3), shown(2, 2), shown(2, 1)]).toEqual( + [10, 8, 6, 4, 3], + ); + expect([shown(1, 5), shown(1, 3), shown(1, 1)]).toEqual([5, 3, 2]); + }); + + it("reads the column count from the widest matching breakpoint", () => { + const at = (width: number) => + gridColumns((query) => width >= Number(/\d+/.exec(query)?.[0])); + + expect([at(390), at(640), at(1023), at(1024), at(1280), at(1536)]).toEqual([ + 1, 2, 2, 3, 4, 5, + ]); + }); +}); diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsx index 509cf0e67c1..33f8bc9d9f1 100644 --- a/apps/web/app/(org)/dashboard/caps/Caps.tsx +++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx @@ -11,7 +11,7 @@ import { Effect, Exit } from "effect"; import { AnimatePresence } from "framer-motion"; import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useMemo, useState, useSyncExternalStore } from "react"; import { toast } from "sonner"; import { FontAwesomeIcon } from "@/components/FontAwesomeIcon"; import { @@ -53,6 +53,12 @@ import { EmptyCapState } from "./components/EmptyCapState"; import type { FolderDataType } from "./components/Folder"; import { FoldersSection } from "./components/FoldersSection"; import { NotesEmptyState } from "./components/NotesEmptyState"; +import { + gridColumns, + OVERVIEW_ROWS, + overviewItemClass, + overviewShows, +} from "./overview-grid"; import { QuickActions } from "./components/QuickActions"; import { useArchiveCaps, useLeavingCaps } from "./components/useArchiveCaps"; import { useCapSelection } from "./components/useCapSelection"; @@ -100,24 +106,17 @@ export type VideoData = { const GRID_CLASS = "grid relative grid-cols-1 gap-x-5 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"; -const OVERVIEW_ROWS: Record = { - videos: 2, - images: 1, - notes: 1, +const subscribeToResize = (notify: () => void) => { + window.addEventListener("resize", notify); + return () => window.removeEventListener("resize", notify); }; -const GRID_COLUMNS = [ - { columns: 2, show: "sm:block" }, - { columns: 3, show: "lg:block" }, - { columns: 4, show: "xl:block" }, - { columns: 5, show: "2xl:block" }, -]; - -function overviewItemClass(index: number, rows: number) { - if (index < Math.max(2, rows + 1)) return undefined; - const step = GRID_COLUMNS.find(({ columns }) => index < columns * rows); - return step ? `hidden ${step.show}` : "hidden"; -} +const useGridColumns = () => + useSyncExternalStore( + subscribeToResize, + () => gridColumns((query) => window.matchMedia(query).matches), + () => 1, + ); const NO_COUNTS: CapKindCounts = { videos: 0, images: 0, notes: 0 }; @@ -164,10 +163,32 @@ export const Caps = ({ ); const leavingCaps = useLeavingCaps(listedVideos); const visibleVideos = leavingCaps.present; - const pageIds = useMemo( - () => visibleVideos.map((video) => video.id), + const sections = useMemo( + () => + CAP_KINDS.map((sectionKind) => ({ + kind: sectionKind, + caps: visibleVideos.filter((video) => capKindOf(video) === sectionKind), + })), [visibleVideos], ); + const gridColumnCount = useGridColumns(); + const pageIds = useMemo( + () => + isOverview + ? sections.flatMap((section) => + section.caps + .filter((_, index) => + overviewShows( + index, + OVERVIEW_ROWS[section.kind], + gridColumnCount, + ), + ) + .map((video) => video.id), + ) + : visibleVideos.map((video) => video.id), + [isOverview, sections, gridColumnCount, visibleVideos], + ); const selectAllView = useMemo( () => isArchivedView @@ -200,14 +221,6 @@ export const Caps = ({ if (leavingCaps.leaving.has(video.id)) shown[capKindOf(video)] -= 1; return shown; }, [counts, listedVideos, leavingCaps.leaving]); - const sections = useMemo( - () => - CAP_KINDS.map((sectionKind) => ({ - kind: sectionKind, - caps: visibleVideos.filter((video) => capKindOf(video) === sectionKind), - })), - [visibleVideos], - ); const shownArchivedCount = archivedCount + (isArchivedView ? 0 : leavingCaps.leavingCount); diff --git a/apps/web/app/(org)/dashboard/caps/overview-grid.ts b/apps/web/app/(org)/dashboard/caps/overview-grid.ts new file mode 100644 index 00000000000..33e4cf643a0 --- /dev/null +++ b/apps/web/app/(org)/dashboard/caps/overview-grid.ts @@ -0,0 +1,31 @@ +import type { CapKind } from "@/lib/cap-kind"; + +export const OVERVIEW_ROWS: Record = { + videos: 2, + images: 1, + notes: 1, +}; + +const GRID_STEPS = [ + { columns: 2, show: "sm:block", query: "(min-width: 640px)" }, + { columns: 3, show: "lg:block", query: "(min-width: 1024px)" }, + { columns: 4, show: "xl:block", query: "(min-width: 1280px)" }, + { columns: 5, show: "2xl:block", query: "(min-width: 1536px)" }, +]; + +const alwaysShown = (rows: number) => Math.max(2, rows + 1); + +export function overviewItemClass(index: number, rows: number) { + if (index < alwaysShown(rows)) return undefined; + const step = GRID_STEPS.find(({ columns }) => index < columns * rows); + return step ? `hidden ${step.show}` : "hidden"; +} + +export const overviewShows = (index: number, rows: number, columns: number) => + index < alwaysShown(rows) || index < columns * rows; + +export function gridColumns(matches: (query: string) => boolean) { + let columns = 1; + for (const step of GRID_STEPS) if (matches(step.query)) columns = step.columns; + return columns; +} From 87959850510ca520c82549aa86ba7bf9ecc69f7a Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:46:48 +0000 Subject: [PATCH 16/27] fix(web): give a transferred note its own document id --- .../__tests__/unit/meetings-share-content.test.ts | 12 ++++++++++++ apps/web/lib/meetings/share-content.ts | 3 +++ apps/web/workflows/transfer-organization-content.ts | 6 +++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/apps/web/__tests__/unit/meetings-share-content.test.ts b/apps/web/__tests__/unit/meetings-share-content.test.ts index 710ae9c3e3b..b6506713046 100644 --- a/apps/web/__tests__/unit/meetings-share-content.test.ts +++ b/apps/web/__tests__/unit/meetings-share-content.test.ts @@ -4,7 +4,9 @@ import { NOTE_TITLE_COLUMN_CHARS, noteExcerpt, noteTitle, + transferredNoteDocumentId, } from "@/lib/meetings/share-content"; +import { meetingShareDocumentIdSchema } from "@/lib/meetings/schemas"; describe("note title", () => { it("keeps a title as written, on one line", () => { @@ -61,3 +63,13 @@ describe("note excerpt", () => { expect(Array.from(excerpt)).toHaveLength(NOTE_EXCERPT_CHARS); }); }); + +describe("note document id after a transfer", () => { + it("is a valid document id that belongs to that cap alone", () => { + const id = transferredNoteDocumentId("0123456789abcde"); + + expect(id).toBe("transferred-0123456789abcde"); + expect(meetingShareDocumentIdSchema.safeParse(id).success).toBe(true); + expect(transferredNoteDocumentId("edcba9876543210")).not.toBe(id); + }); +}); diff --git a/apps/web/lib/meetings/share-content.ts b/apps/web/lib/meetings/share-content.ts index 9a959a07c83..c6670c7b11f 100644 --- a/apps/web/lib/meetings/share-content.ts +++ b/apps/web/lib/meetings/share-content.ts @@ -2,6 +2,9 @@ export const NOTE_TITLE_COLUMN_CHARS = 255; export const NOTE_EXCERPT_CHARS = 360; const UNTITLED_NOTE = "Untitled note"; +export const transferredNoteDocumentId = (videoId: string) => + `transferred-${videoId}`; + const firstCharacters = (value: string, max: number) => Array.from(value).slice(0, max).join(""); diff --git a/apps/web/workflows/transfer-organization-content.ts b/apps/web/workflows/transfer-organization-content.ts index 5154d7a4aee..14f5018c3c9 100644 --- a/apps/web/workflows/transfer-organization-content.ts +++ b/apps/web/workflows/transfer-organization-content.ts @@ -25,6 +25,7 @@ import { MAX_CONTENT_TRANSFER_VIDEOS, moveContentTransferSourceKeys, } from "@/lib/content-transfer"; +import { transferredNoteDocumentId } from "@/lib/meetings/share-content"; import { enqueueVideoStorageNameSync } from "@/lib/sync-video-storage-names"; import { runWorkflowPromise } from "@/lib/workflow-runtime"; @@ -808,7 +809,10 @@ export async function transferOneVideo( if (item.sourceOwnerId !== payload.targetUserId) { await tx .update(Db.videoNotes) - .set({ ownerId: targetUserId }) + .set({ + ownerId: targetUserId, + documentId: transferredNoteDocumentId(videoId), + }) .where(eq(Db.videoNotes.videoId, videoId)); await tx .update(Db.videoUploads) From 0458f73d3b7d30f81b263efbcf03d22948b869ca Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:46:48 +0000 Subject: [PATCH 17/27] feat(web): apply the shareable link limit to notes --- .../unit/share-page-round-trips.test.ts | 47 ++++++++++++++++--- .../_components/ShareableLinkLimitOverlay.tsx | 17 +++++-- .../_components/note/NoteLinkLimit.tsx | 34 ++++++++++++++ apps/web/app/s/[videoId]/page.tsx | 34 ++++++++------ 4 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 apps/web/app/s/[videoId]/_components/note/NoteLinkLimit.tsx diff --git a/apps/web/__tests__/unit/share-page-round-trips.test.ts b/apps/web/__tests__/unit/share-page-round-trips.test.ts index 789c8c4b204..7fc672ca3e4 100644 --- a/apps/web/__tests__/unit/share-page-round-trips.test.ts +++ b/apps/web/__tests__/unit/share-page-round-trips.test.ts @@ -9,6 +9,8 @@ const mocks = vi.hoisted(() => ({ query: vi.fn(), note: false, access: "allowed" as "allowed" | "private" | "password", + ownerIsPro: true, + overLinkLimit: false, })); vi.mock("server-only", () => ({})); @@ -25,7 +27,10 @@ vi.mock("@cap/env", () => ({ serverEnv: () => ({}), })); vi.mock("@cap/ui", () => ({ Logo: () => null })); -vi.mock("@cap/utils", () => ({ userIsPro: () => true })); +vi.mock("@cap/utils", () => ({ userIsPro: () => mocks.ownerIsPro })); +vi.mock("@/lib/shareable-link-quota", () => ({ + isVideoOverShareableLinkLimit: async () => mocks.overLinkLimit, +})); vi.mock("@cap/web-backend", async () => { const { Context, Effect } = await import("effect"); const { resolveEffectiveVideoRules } = await import( @@ -258,7 +263,15 @@ function rowsFor(query: string) { if (query.includes("from `space_members`")) return [["space-member"]]; if (query.includes("from `video_edits`")) return []; if (query.includes("from `video_notes`")) - return [project(query, { video_notes: noteContent })]; + return [ + [ + noteContent.summaryMarkdown, + noteContent.notesMarkdown, + noteContent.transcript, + noteContent.participants, + noteContent.meetingStartedAt, + ], + ]; throw new Error(`Unexpected query: ${query}`); } @@ -296,6 +309,8 @@ beforeEach(() => { mocks.query.mockReset(); mocks.note = false; mocks.access = "allowed"; + mocks.ownerIsPro = true; + mocks.overLinkLimit = false; }); describe("share page database round trips", () => { @@ -399,13 +414,33 @@ describe("share page note content", () => { }, ); - it("reads the note only for a viewer the policy lets in", async () => { + const renderNote = async () => { const page = await openNote("allowed"); const authorized = page.props.children as ReactElement; - await (authorized.type as (props: unknown) => Promise)( - authorized.props, - ); + const content = (await ( + authorized.type as (props: unknown) => Promise + )(authorized.props)) as ReactElement<{ + children: ReactElement<{ document: ReactElement; transcript: unknown }>; + }>; + return content.props.children.props; + }; + + it("reads the note only for a viewer the policy lets in", async () => { + const shell = await renderNote(); expect(noteQueries()).toHaveLength(1); + expect(JSON.stringify(shell.document.props)).toContain(NOTE_TEXT); + expect(shell.transcript).not.toBeNull(); + }); + + it("holds back a note that is over the owner's free link allowance", async () => { + mocks.ownerIsPro = false; + mocks.overLinkLimit = true; + + const shell = await renderNote(); + + expect(shell.document.props).toEqual({ isOwner: false }); + expect(shell.transcript).toBeNull(); + expect(JSON.stringify(shell)).not.toContain(NOTE_TEXT); }); }); diff --git a/apps/web/app/s/[videoId]/_components/ShareableLinkLimitOverlay.tsx b/apps/web/app/s/[videoId]/_components/ShareableLinkLimitOverlay.tsx index ec8ade7ed7f..2bbec4ea913 100644 --- a/apps/web/app/s/[videoId]/_components/ShareableLinkLimitOverlay.tsx +++ b/apps/web/app/s/[videoId]/_components/ShareableLinkLimitOverlay.tsx @@ -9,6 +9,9 @@ import { BarChart3, Infinity as InfinityIcon, Share2 } from "lucide-react"; const LIMIT = Video.FREE_PLAN_SHAREABLE_LINKS_PER_MONTH; const MAX_MINUTES = Video.FREE_PLAN_MAX_RECORDING_SECONDS / 60; +const STUDIO_NOTE = + "Videos recorded in Studio mode are saved to your device, free and unlimited."; + const COPY = { links: { ownerTitle: "You've run out of shareable links", @@ -16,6 +19,15 @@ const COPY = { ownerBody: `You've used all ${LIMIT} shareable links included with Cap's free plan this month. Upgrade to Cap Pro and this video becomes instantly viewable, along with everything else you record.`, viewerBody: `The owner of this video has used all ${LIMIT} shareable links included with Cap's free plan this month. As soon as they upgrade to Cap Pro, this video will be instantly viewable.`, viewerNote: `Cap's free plan includes ${LIMIT} shareable links per month.`, + ownerNote: STUDIO_NOTE, + }, + noteLinks: { + ownerTitle: "You've run out of shareable links", + viewerTitle: "This note is over its free limit", + ownerBody: `You've used all ${LIMIT} shareable links included with Cap's free plan this month. Upgrade to Cap Pro and this note becomes instantly readable, along with everything else you share.`, + viewerBody: `The owner of this note has used all ${LIMIT} shareable links included with Cap's free plan this month. As soon as they upgrade to Cap Pro, this note will be instantly readable.`, + viewerNote: `Cap's free plan includes ${LIMIT} shareable links per month.`, + ownerNote: "This note is still saved in the Cap desktop app.", }, duration: { ownerTitle: `This video is longer than ${MAX_MINUTES} minutes`, @@ -23,6 +35,7 @@ const COPY = { ownerBody: `Cap's free plan shares videos up to ${MAX_MINUTES} minutes long. Upgrade to Cap Pro and this video becomes instantly viewable, along with everything else you record.`, viewerBody: `This video is longer than the ${MAX_MINUTES} minutes Cap's free plan shares. As soon as the owner upgrades to Cap Pro, it will be instantly viewable.`, viewerNote: `Cap's free plan shares videos up to ${MAX_MINUTES} minutes long.`, + ownerNote: STUDIO_NOTE, }, }; @@ -91,9 +104,7 @@ export function ShareableLinkLimitOverlay({ )}

- {isOwner - ? "Videos recorded in Studio mode are saved to your device, free and unlimited." - : copy.viewerNote} + {isOwner ? copy.ownerNote : copy.viewerNote}

diff --git a/apps/web/app/s/[videoId]/_components/note/NoteLinkLimit.tsx b/apps/web/app/s/[videoId]/_components/note/NoteLinkLimit.tsx new file mode 100644 index 00000000000..74c939ebbf6 --- /dev/null +++ b/apps/web/app/s/[videoId]/_components/note/NoteLinkLimit.tsx @@ -0,0 +1,34 @@ +"use client"; + +import dynamic from "next/dynamic"; +import { useState } from "react"; +import { ShareableLinkLimitOverlay } from "../ShareableLinkLimitOverlay"; + +const importUpgradeModal = () => + import("@/components/UpgradeModal").then((module) => module.UpgradeModal); +const UpgradeModal = dynamic(importUpgradeModal, { ssr: false }); + +export function NoteLinkLimit({ isOwner }: { isOwner: boolean }) { + const [upgradeOpen, setUpgradeOpen] = useState(false); + const [upgradeMounted, setUpgradeMounted] = useState(false); + + return ( + <> + { + setUpgradeMounted(true); + setUpgradeOpen(true); + }} + onUpgradeHover={() => { + void importUpgradeModal(); + }} + className="min-h-[28rem]" + /> + {upgradeMounted && ( + + )} + + ); +} diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsx index 42c387f86fd..a03bde90afc 100644 --- a/apps/web/app/s/[videoId]/page.tsx +++ b/apps/web/app/s/[videoId]/page.tsx @@ -119,6 +119,7 @@ import { SignInRequiredState, } from "./_components/AccessStates"; import { NoteDocument } from "./_components/note/NoteDocument"; +import { NoteLinkLimit } from "./_components/note/NoteLinkLimit"; import { NoteTranscript } from "./_components/note/NoteTranscript"; import { PasswordGate } from "./_components/PasswordGate"; import { PendingRecordingShare } from "./_components/PendingRecordingShare"; @@ -672,9 +673,8 @@ async function AuthorizedContent({ const ownerIsPro = userIsPro(video.owner); // Fail-open: a broken count must never take the share page down. - const overShareLimitPromise = - ownerIsPro || video.isNote - ? Promise.resolve(false) + const overShareLimitPromise = ownerIsPro + ? Promise.resolve(false) : isVideoOverShareableLinkLimit({ id: videoId, ownerId: video.owner.id, @@ -1304,7 +1304,9 @@ async function AuthorizedContent({ if (video.isNote) { const noteTurns = - !rules.settings.disableTranscript && Array.isArray(note?.transcript) + !ownerIsOverShareLimit && + !rules.settings.disableTranscript && + Array.isArray(note?.transcript) ? note.transcript : []; return ( @@ -1313,16 +1315,20 @@ async function AuthorizedContent({ header={header} data={videoWithOrganizationInfo} document={ - + ownerIsOverShareLimit ? ( + + ) : ( + + ) } transcript={ noteTurns.length > 0 ? : null From 08bda5de067fb26b1f560cef944c0389d8dd10bf Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 00:19:14 +0000 Subject: [PATCH 18/27] improve(web): load the note link limit notice on demand --- apps/web/app/s/[videoId]/ShareLoader.tsx | 6 +++++ apps/web/app/s/[videoId]/page.tsx | 33 +++++++++++++----------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/web/app/s/[videoId]/ShareLoader.tsx b/apps/web/app/s/[videoId]/ShareLoader.tsx index b649801d02b..afedab00d13 100644 --- a/apps/web/app/s/[videoId]/ShareLoader.tsx +++ b/apps/web/app/s/[videoId]/ShareLoader.tsx @@ -9,3 +9,9 @@ export const ShareLoader = dynamic(() => export const NoteShareLoader = dynamic(() => import("./NoteShare").then((module) => module.NoteShare), ); + +export const NoteLinkLimitLoader = dynamic(() => + import("./_components/note/NoteLinkLimit").then( + (module) => module.NoteLinkLimit, + ), +); diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsx index a03bde90afc..3cc9184ea94 100644 --- a/apps/web/app/s/[videoId]/page.tsx +++ b/apps/web/app/s/[videoId]/page.tsx @@ -119,12 +119,15 @@ import { SignInRequiredState, } from "./_components/AccessStates"; import { NoteDocument } from "./_components/note/NoteDocument"; -import { NoteLinkLimit } from "./_components/note/NoteLinkLimit"; import { NoteTranscript } from "./_components/note/NoteTranscript"; import { PasswordGate } from "./_components/PasswordGate"; import { PendingRecordingShare } from "./_components/PendingRecordingShare"; import { ShareHeader } from "./_components/ShareHeader"; -import { NoteShareLoader, ShareLoader } from "./ShareLoader"; +import { + NoteLinkLimitLoader, + NoteShareLoader, + ShareLoader, +} from "./ShareLoader"; const VIEW_NOTIFICATION_DELAY_MS = 2 * 60 * 1000; const VIDEO_ID_PATTERN = /^[0-9abcdefghjkmnpqrstvwxyz]+$/; @@ -675,18 +678,18 @@ async function AuthorizedContent({ // Fail-open: a broken count must never take the share page down. const overShareLimitPromise = ownerIsPro ? Promise.resolve(false) - : isVideoOverShareableLinkLimit({ - id: videoId, - ownerId: video.owner.id, - createdAt: video.createdAt, - isScreenshot: video.isScreenshot, - }).catch((error) => { - console.error( - `[ShareVideoPage] Shareable link quota check failed for ${videoId}:`, - error, - ); - return false; - }); + : isVideoOverShareableLinkLimit({ + id: videoId, + ownerId: video.owner.id, + createdAt: video.createdAt, + isScreenshot: video.isScreenshot, + }).catch((error) => { + console.error( + `[ShareVideoPage] Shareable link quota check failed for ${videoId}:`, + error, + ); + return false; + }); const firstViewKey = user?.id !== video.owner.id && !video.isScreenshot && @@ -1316,7 +1319,7 @@ async function AuthorizedContent({ data={videoWithOrganizationInfo} document={ ownerIsOverShareLimit ? ( - + ) : ( Date: Sun, 29 Nov 2026 00:19:14 +0000 Subject: [PATCH 19/27] test(web): give the caps keyboard media query stub its listeners --- apps/web/__tests__/unit/caps-keyboard.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/__tests__/unit/caps-keyboard.test.ts b/apps/web/__tests__/unit/caps-keyboard.test.ts index ec283d05250..6bb4c27044d 100644 --- a/apps/web/__tests__/unit/caps-keyboard.test.ts +++ b/apps/web/__tests__/unit/caps-keyboard.test.ts @@ -123,7 +123,12 @@ let selection: HTMLButtonElement; beforeEach(async () => { vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true); - vi.stubGlobal("matchMedia", (media: string) => ({ media, matches: true })); + vi.stubGlobal("matchMedia", (media: string) => ({ + media, + matches: true, + addEventListener: () => {}, + removeEventListener: () => {}, + })); mocks.mutate.mockClear(); mocks.mutations.length = 0; mocks.pending = false; From 5b220e0916d2de8f6feac9c5d8b138ef25f6b5a2 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 00:19:14 +0000 Subject: [PATCH 20/27] chore(web): apply formatting to the My Caps overview files --- .../__tests__/unit/caps-overview-grid.test.ts | 17 +++++++++++++---- .../unit/meetings-share-content.test.ts | 2 +- apps/web/app/(org)/dashboard/caps/Caps.tsx | 8 ++++---- .../app/(org)/dashboard/caps/overview-grid.ts | 3 ++- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/web/__tests__/unit/caps-overview-grid.test.ts b/apps/web/__tests__/unit/caps-overview-grid.test.ts index 9e57041efba..5eedd51f36d 100644 --- a/apps/web/__tests__/unit/caps-overview-grid.test.ts +++ b/apps/web/__tests__/unit/caps-overview-grid.test.ts @@ -24,7 +24,12 @@ describe("My Caps overview grid", () => { for (const rows of [1, 2]) for (let columns = 1; columns <= 5; columns++) for (let index = 0; index < 12; index++) - expect([rows, columns, index, overviewShows(index, rows, columns)]).toEqual([ + expect([ + rows, + columns, + index, + overviewShows(index, rows, columns), + ]).toEqual([ rows, columns, index, @@ -38,9 +43,13 @@ describe("My Caps overview grid", () => { overviewShows(index, rows, columns), ).length; - expect([shown(2, 5), shown(2, 4), shown(2, 3), shown(2, 2), shown(2, 1)]).toEqual( - [10, 8, 6, 4, 3], - ); + expect([ + shown(2, 5), + shown(2, 4), + shown(2, 3), + shown(2, 2), + shown(2, 1), + ]).toEqual([10, 8, 6, 4, 3]); expect([shown(1, 5), shown(1, 3), shown(1, 1)]).toEqual([5, 3, 2]); }); diff --git a/apps/web/__tests__/unit/meetings-share-content.test.ts b/apps/web/__tests__/unit/meetings-share-content.test.ts index b6506713046..944e31ce57c 100644 --- a/apps/web/__tests__/unit/meetings-share-content.test.ts +++ b/apps/web/__tests__/unit/meetings-share-content.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from "vitest"; +import { meetingShareDocumentIdSchema } from "@/lib/meetings/schemas"; import { NOTE_EXCERPT_CHARS, NOTE_TITLE_COLUMN_CHARS, @@ -6,7 +7,6 @@ import { noteTitle, transferredNoteDocumentId, } from "@/lib/meetings/share-content"; -import { meetingShareDocumentIdSchema } from "@/lib/meetings/schemas"; describe("note title", () => { it("keeps a title as written, on one line", () => { diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsx index 33f8bc9d9f1..1e31ab47814 100644 --- a/apps/web/app/(org)/dashboard/caps/Caps.tsx +++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx @@ -53,16 +53,16 @@ import { EmptyCapState } from "./components/EmptyCapState"; import type { FolderDataType } from "./components/Folder"; import { FoldersSection } from "./components/FoldersSection"; import { NotesEmptyState } from "./components/NotesEmptyState"; +import { QuickActions } from "./components/QuickActions"; +import { useArchiveCaps, useLeavingCaps } from "./components/useArchiveCaps"; +import { useCapSelection } from "./components/useCapSelection"; +import { useCapsMoved } from "./components/useCapsMoved"; import { gridColumns, OVERVIEW_ROWS, overviewItemClass, overviewShows, } from "./overview-grid"; -import { QuickActions } from "./components/QuickActions"; -import { useArchiveCaps, useLeavingCaps } from "./components/useArchiveCaps"; -import { useCapSelection } from "./components/useCapSelection"; -import { useCapsMoved } from "./components/useCapsMoved"; import { useUploadingStatus } from "./UploadingContext"; export type VideoData = { diff --git a/apps/web/app/(org)/dashboard/caps/overview-grid.ts b/apps/web/app/(org)/dashboard/caps/overview-grid.ts index 33e4cf643a0..f7d97effb09 100644 --- a/apps/web/app/(org)/dashboard/caps/overview-grid.ts +++ b/apps/web/app/(org)/dashboard/caps/overview-grid.ts @@ -26,6 +26,7 @@ export const overviewShows = (index: number, rows: number, columns: number) => export function gridColumns(matches: (query: string) => boolean) { let columns = 1; - for (const step of GRID_STEPS) if (matches(step.query)) columns = step.columns; + for (const step of GRID_STEPS) + if (matches(step.query)) columns = step.columns; return columns; } From 1b12fe6e6c63c2d11df2adad9637ac5c12faab1f Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:53:30 +0000 Subject: [PATCH 21/27] fix(web): use the shown order for range selection in folders and spaces --- apps/web/__tests__/unit/cap-kind.test.ts | 23 +++++++++++++++++++ .../[id]/components/FolderVideosSection.tsx | 8 +++++-- .../dashboard/spaces/[spaceId]/SharedCaps.tsx | 6 ++--- apps/web/lib/cap-kind.ts | 5 ++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/apps/web/__tests__/unit/cap-kind.test.ts b/apps/web/__tests__/unit/cap-kind.test.ts index 1db6f1f5d0c..85206185b0f 100644 --- a/apps/web/__tests__/unit/cap-kind.test.ts +++ b/apps/web/__tests__/unit/cap-kind.test.ts @@ -1,10 +1,12 @@ import { describe, expect, it } from "vitest"; import { + capIdsInKindOrder, capKindCountsFromTotals, capKindOf, groupCapsByKind, visibleNoteExcerpt, } from "@/lib/cap-kind"; +import { toggleSelection } from "@/lib/cap-selection"; describe("cap kinds", () => { it("reads a note before a screenshot, and a video otherwise", () => { @@ -26,6 +28,27 @@ describe("cap kinds", () => { ]); }); + it("lists ids in the order the kind sections show them", () => { + const caps = [ + { id: "video-1" }, + { id: "note-1", isNote: true }, + { id: "video-2" }, + { id: "image-1", isScreenshot: true }, + ]; + const orderedIds = capIdsInKindOrder(caps); + + expect(orderedIds).toEqual(["video-1", "video-2", "image-1", "note-1"]); + expect( + toggleSelection({ + orderedIds, + selected: ["video-1"], + anchorId: "video-1", + targetId: "video-2", + shiftKey: true, + }).selected, + ).toEqual(["video-1", "video-2"]); + }); + it("derives video counts from the totals", () => { expect(capKindCountsFromTotals({ count: 10, images: 3, notes: 2 })).toEqual( { videos: 5, images: 3, notes: 2 }, diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx index 436fc8f06a9..07b25866438 100644 --- a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx +++ b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx @@ -8,7 +8,11 @@ import { useRouter } from "next/navigation"; import { useMemo } from "react"; import { toast } from "sonner"; import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; -import { CAP_KIND_LABEL, groupCapsByKind } from "@/lib/cap-kind"; +import { + CAP_KIND_LABEL, + capIdsInKindOrder, + groupCapsByKind, +} from "@/lib/cap-kind"; import { useEffectMutation, useRpcClient } from "@/lib/EffectRuntime"; import type { MoveLocation } from "@/lib/move-items"; import { useVideosAnalyticsQuery } from "@/lib/Queries/Analytics"; @@ -64,7 +68,7 @@ export default function FolderVideosSection({ const leavingCaps = useLeavingCaps(listedVideos); const visibleVideos = leavingCaps.present; const pageIds = useMemo( - () => visibleVideos.map((video) => video.id), + () => capIdsInKindOrder(visibleVideos), [visibleVideos], ); const canSelect = canMove || allowBulkDelete; diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx index 298e509ce35..997d3b5b590 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx @@ -35,6 +35,7 @@ import { CAP_KIND_LABEL, type CapKind, type CapKindCounts, + capIdsInKindOrder, capKindOf, groupCapsByKind, } from "@/lib/cap-kind"; @@ -214,10 +215,7 @@ export const SharedCaps = ({ "All organization"; const [orderedData, setOrderedData] = useState(data); useEffect(() => setOrderedData(data), [data]); - const pageIds = useMemo( - () => orderedData.map((video) => video.id), - [orderedData], - ); + const pageIds = useMemo(() => capIdsInKindOrder(orderedData), [orderedData]); const selectAllView = useMemo( () => spaceData diff --git a/apps/web/lib/cap-kind.ts b/apps/web/lib/cap-kind.ts index 8b0ad580cd9..fa7b804bb62 100644 --- a/apps/web/lib/cap-kind.ts +++ b/apps/web/lib/cap-kind.ts @@ -27,6 +27,11 @@ export function groupCapsByKind( ); } +export const capIdsInKindOrder = ( + caps: readonly T[], +): T["id"][] => + groupCapsByKind(caps).flatMap((group) => group.caps.map((cap) => cap.id)); + export const capKindCountsFromTotals = ( totals: { count: number; images: number; notes: number } | undefined, ): CapKindCounts => ({ From 9b325011945fd3d8b454a579decd90dd90f85016 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:50:27 +0000 Subject: [PATCH 22/27] feat(database): index caps by kind for the library lists --- .../migrations/0068_concerned_blue_marvel.sql | 3 ++- .../database/migrations/meta/0068_snapshot.json | 15 ++++++++++++++- packages/database/migrations/meta/_journal.json | 2 +- packages/database/schema.ts | 15 ++++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/database/migrations/0068_concerned_blue_marvel.sql b/packages/database/migrations/0068_concerned_blue_marvel.sql index 8ebb75458fe..657458ef760 100644 --- a/packages/database/migrations/0068_concerned_blue_marvel.sql +++ b/packages/database/migrations/0068_concerned_blue_marvel.sql @@ -15,4 +15,5 @@ CREATE TABLE `video_notes` ( ); --> statement-breakpoint ALTER TABLE `videos` ADD `isNote` boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE `video_notes` ADD CONSTRAINT `video_notes_videoId_videos_id_fk` FOREIGN KEY (`videoId`) REFERENCES `videos`(`id`) ON DELETE cascade ON UPDATE no action; \ No newline at end of file +ALTER TABLE `video_notes` ADD CONSTRAINT `video_notes_videoId_videos_id_fk` FOREIGN KEY (`videoId`) REFERENCES `videos`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX `org_owner_folder_archived_kind_effective_idx` ON `videos` (`orgId`,`ownerId`,`folderId`,`archivedAt`,`isNote`,`isScreenshot`,`effectiveCreatedAt`); \ No newline at end of file diff --git a/packages/database/migrations/meta/0068_snapshot.json b/packages/database/migrations/meta/0068_snapshot.json index 21580c2d841..4501dd676e3 100644 --- a/packages/database/migrations/meta/0068_snapshot.json +++ b/packages/database/migrations/meta/0068_snapshot.json @@ -1,7 +1,7 @@ { "version": "5", "dialect": "mysql", - "id": "82df3051-e0f5-46f3-8f0d-debf387ba52d", + "id": "6cdb1751-a6e6-47b8-89d8-f8a9628a174c", "prevId": "6b499e71-fe96-4123-8a0a-6efafb6c93ac", "tables": { "accounts": { @@ -6852,6 +6852,19 @@ "name": "screenshot_transcription_created_idx", "columns": ["isScreenshot", "transcriptionStatus", "createdAt"], "isUnique": false + }, + "org_owner_folder_archived_kind_effective_idx": { + "name": "org_owner_folder_archived_kind_effective_idx", + "columns": [ + "orgId", + "ownerId", + "folderId", + "archivedAt", + "isNote", + "isScreenshot", + "effectiveCreatedAt" + ], + "isUnique": false } }, "foreignKeys": { diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.json index 570d8267203..1081a384254 100644 --- a/packages/database/migrations/meta/_journal.json +++ b/packages/database/migrations/meta/_journal.json @@ -481,7 +481,7 @@ { "idx": 68, "version": "5", - "when": 1795792333290, + "when": 1795918968701, "tag": "0068_concerned_blue_marvel", "breakpoints": true } diff --git a/packages/database/schema.ts b/packages/database/schema.ts index 939cc3e794b..3e5631c7f69 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -477,6 +477,10 @@ export const folders = mysqlTable( }), ); +export const VIDEOS_FOLDER_LIST_INDEX = "org_owner_folder_effective_idx"; +export const VIDEOS_KIND_LIST_INDEX = + "org_owner_folder_archived_kind_effective_idx"; + export const videos = mysqlTable( "videos", { @@ -571,7 +575,7 @@ export const videos = mysqlTable( table.ownerId, table.folderId, ), - index("org_owner_folder_effective_idx").on( + index(VIDEOS_FOLDER_LIST_INDEX).on( table.orgId, table.ownerId, table.folderId, @@ -593,6 +597,15 @@ export const videos = mysqlTable( table.transcriptionStatus, table.createdAt, ), + index(VIDEOS_KIND_LIST_INDEX).on( + table.orgId, + table.ownerId, + table.folderId, + table.archivedAt, + table.isNote, + table.isScreenshot, + table.effectiveCreatedAt, + ), ], ); From 1102d1f496d7a76739c114c195898907939725ce Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:50:27 +0000 Subject: [PATCH 23/27] improve(web): read each kind of cap from its own index --- .../dashboard-library-database.test.ts | 65 +++++++++++++++++++ .../web/__tests__/unit/cap-kind-query.test.ts | 52 +++++++++++++++ apps/web/actions/caps/list-view-ids.ts | 9 ++- .../(org)/dashboard/caps/caps-page-data.tsx | 6 +- .../web/app/(org)/dashboard/dashboard-data.ts | 6 +- apps/web/app/api/mobile/[...route]/route.ts | 2 +- apps/web/lib/cap-kind-query.ts | 13 ++-- 7 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 apps/web/__tests__/unit/cap-kind-query.test.ts diff --git a/apps/web/__tests__/integration/dashboard-library-database.test.ts b/apps/web/__tests__/integration/dashboard-library-database.test.ts index 4e44d876961..c3b96ea9a6a 100644 --- a/apps/web/__tests__/integration/dashboard-library-database.test.ts +++ b/apps/web/__tests__/integration/dashboard-library-database.test.ts @@ -233,6 +233,71 @@ describe.runIf(Boolean(databaseUrl))( ).toEqual({ [unshared]: [], [shared]: [orgId] }); }); + it("lists and counts each kind of Cap on its own, newest first", async () => { + const { CapsPageView } = await import( + "@/app/(org)/dashboard/caps/caps-page-data" + ); + const { listCapIdsInView } = await import("@/actions/caps/list-view-ids"); + const { orgId, ownerId } = await createOrg(); + const otherId = await addMember(orgId); + const at = (minute: number) => ({ + createdAt: new Date(Date.UTC(2026, 0, 1, 0, minute)), + }); + const videoIds = [ + await createVideo(ownerId, orgId, at(1)), + await createVideo(ownerId, orgId, at(4)), + ]; + const imageIds = [ + await createVideo(ownerId, orgId, { ...at(2), isScreenshot: true }), + ]; + const noteIds = [ + await createVideo(ownerId, orgId, { ...at(3), isNote: true }), + await createVideo(ownerId, orgId, { ...at(5), isNote: true }), + ]; + await createVideo(ownerId, orgId, { + ...at(6), + archivedAt: new Date(), + }); + await createVideo(ownerId, orgId, { + ...at(7), + isNote: true, + folderId: id() as never, + }); + await createVideo(otherId, orgId, { ...at(8), isNote: true }); + fixture.sessionUserId = ownerId; + const expected = { + videos: videoIds.toReversed(), + images: imageIds, + notes: noteIds.toReversed(), + }; + + for (const kind of ["videos", "images", "notes"] as const) { + const page = await CapsPageView({ + searchParams: {}, + view: "library", + kind, + }); + expect( + page.props.data.map((cap: { id: string }) => cap.id), + kind, + ).toEqual(expected[kind]); + expect(page.props.count, kind).toBe(expected[kind].length); + expect( + (await listCapIdsInView({ type: "personal", kind })).ids, + ).toEqual(expected[kind]); + } + + const overview = await CapsPageView({ + searchParams: {}, + view: "library", + }); + expect( + overview.props.data.map((cap: { id: string }) => cap.id).sort(), + ).toEqual([...videoIds, ...imageIds, ...noteIds].sort()); + expect(overview.props.counts).toEqual({ videos: 2, images: 1, notes: 2 }); + expect(overview.props.archivedCount).toBe(1); + }); + it("counts comments and lists each shared organization once on My Caps", async () => { const { CapsPageView } = await import( "@/app/(org)/dashboard/caps/caps-page-data" diff --git a/apps/web/__tests__/unit/cap-kind-query.test.ts b/apps/web/__tests__/unit/cap-kind-query.test.ts new file mode 100644 index 00000000000..b7686b495bc --- /dev/null +++ b/apps/web/__tests__/unit/cap-kind-query.test.ts @@ -0,0 +1,52 @@ +import { VIDEOS_KIND_LIST_INDEX, videos } from "@cap/database/schema"; +import { and, eq } from "drizzle-orm"; +import { getTableConfig, QueryBuilder } from "drizzle-orm/mysql-core"; +import { describe, expect, it } from "vitest"; +import { CAP_KINDS } from "@/lib/cap-kind"; +import { capKindCondition, capKindIndexHint } from "@/lib/cap-kind-query"; + +const listQuery = (kind: (typeof CAP_KINDS)[number]) => + new QueryBuilder() + .select({ id: videos.id }) + .from(videos, capKindIndexHint) + .where(and(eq(videos.ownerId, "user-1" as never), capKindCondition(kind))) + .toSQL(); + +describe("cap kind queries", () => { + it("pins a kind list to an index the videos table defines", () => { + const index = getTableConfig(videos).indexes.find( + (each) => each.config.name === VIDEOS_KIND_LIST_INDEX, + ); + + expect( + index?.config.columns.map((column) => "name" in column && column.name), + ).toEqual([ + "orgId", + "ownerId", + "folderId", + "archivedAt", + "isNote", + "isScreenshot", + "effectiveCreatedAt", + ]); + expect(listQuery("videos").sql).toContain( + `from \`videos\` FORCE INDEX (${VIDEOS_KIND_LIST_INDEX})`, + ); + }); + + it("filters every kind on both flags so each kind is one index range", () => { + expect( + Object.fromEntries( + CAP_KINDS.map((kind) => [kind, listQuery(kind).params.slice(1)]), + ), + ).toEqual({ + videos: [false, false], + images: [false, true], + notes: [true, false], + }); + for (const kind of CAP_KINDS) + expect(listQuery(kind).sql).toContain( + "`videos`.`isNote` = ? and `videos`.`isScreenshot` = ?", + ); + }); +}); diff --git a/apps/web/actions/caps/list-view-ids.ts b/apps/web/actions/caps/list-view-ids.ts index 11772992f7f..b7a02da1f85 100644 --- a/apps/web/actions/caps/list-view-ids.ts +++ b/apps/web/actions/caps/list-view-ids.ts @@ -13,7 +13,7 @@ import { and, desc, eq, isNotNull, isNull } from "drizzle-orm"; import { getOrganizationAccess } from "@/actions/organization/authorization"; import { getSpaceAccess } from "@/actions/organization/space-authorization"; import { CAP_KINDS } from "@/lib/cap-kind"; -import { capKindCondition } from "@/lib/cap-kind-query"; +import { capKindCondition, capKindIndexHint } from "@/lib/cap-kind-query"; import { canManageOrganizationMembers } from "@/lib/permissions/roles"; import { MAX_SELECT_ALL_ITEMS, @@ -42,9 +42,10 @@ export async function listCapIdsInView( ) throw new Error("Invalid view"); const isArchivedView = view.type === "archived"; + const kind = view.type === "personal" ? view.kind : undefined; const rows = await db() .select({ id: videos.id }) - .from(videos) + .from(videos, kind ? capKindIndexHint : undefined) .innerJoin(organizations, eq(videos.orgId, organizations.id)) .where( and( @@ -54,9 +55,7 @@ export async function listCapIdsInView( isArchivedView ? isNotNull(videos.archivedAt) : and(isNull(videos.folderId), isNull(videos.archivedAt)), - view.type === "personal" && view.kind - ? capKindCondition(view.kind) - : undefined, + kind ? capKindCondition(kind) : undefined, ), ) .orderBy( diff --git a/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx b/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx index 63a033dd667..9377e6b39f3 100644 --- a/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx +++ b/apps/web/app/(org)/dashboard/caps/caps-page-data.tsx @@ -34,7 +34,7 @@ import { unionAll } from "drizzle-orm/mysql-core"; import { type Array, Effect } from "effect"; import { redirect } from "next/navigation"; import { CAP_KINDS, type CapKind } from "@/lib/cap-kind"; -import { capKindCondition } from "@/lib/cap-kind-query"; +import { capKindCondition, capKindIndexHint } from "@/lib/cap-kind-query"; import { resolveDashboardPageSize } from "@/lib/dashboard-page-size"; import { parsePageParam } from "@/lib/page-param"; import { seedThumbnailUrls } from "@/lib/seeded-thumbnails"; @@ -185,7 +185,7 @@ export async function CapsPageView({ Number, ), }) - .from(videos) + .from(videos, capKindIndexHint) .leftJoin(organizations, eq(videos.orgId, organizations.id)) .where( and( @@ -200,7 +200,7 @@ export async function CapsPageView({ const pageIds = (pageKind: CapKind | undefined, take: number, skip: number) => db() .select({ id: videos.id }) - .from(videos) + .from(videos, pageKind && !isArchivedView ? capKindIndexHint : undefined) .leftJoin(organizations, eq(videos.orgId, organizations.id)) .where( and( diff --git a/apps/web/app/(org)/dashboard/dashboard-data.ts b/apps/web/app/(org)/dashboard/dashboard-data.ts index 047fce7360b..07715b69f38 100644 --- a/apps/web/app/(org)/dashboard/dashboard-data.ts +++ b/apps/web/app/(org)/dashboard/dashboard-data.ts @@ -30,7 +30,7 @@ import { import { Effect } from "effect"; import { cache } from "react"; import type { CapKind } from "@/lib/cap-kind"; -import { capKindCondition } from "@/lib/cap-kind-query"; +import { capKindCondition, capKindIndexHint } from "@/lib/cap-kind-query"; import { canManageOrganizationMembers, canManageOrganizationProSeats, @@ -387,12 +387,12 @@ async function loadActiveOrganizationData( activeOrgInfo ? db() .select({ - value: sql`COUNT(DISTINCT ${videos.id})`, + value: sql`COUNT(*)`, videos: listedKindCount("videos"), images: listedKindCount("images"), notes: listedKindCount("notes"), }) - .from(videos) + .from(videos, capKindIndexHint) .where( and( eq(videos.orgId, activeOrgInfo.id), diff --git a/apps/web/app/api/mobile/[...route]/route.ts b/apps/web/app/api/mobile/[...route]/route.ts index 283be51c863..080cd4667f0 100644 --- a/apps/web/app/api/mobile/[...route]/route.ts +++ b/apps/web/app/api/mobile/[...route]/route.ts @@ -1668,7 +1668,7 @@ const getCapLocations = Effect.fn("Mobile.getCapLocations")(function* ({ database.use((db) => db .select({ id: Db.videos.id, folderId: Db.videos.folderId }) - .from(Db.videos) + .from(Db.videos, { forceIndex: Db.VIDEOS_FOLDER_LIST_INDEX }) .leftJoin( Db.organizations, eq(Db.videos.orgId, Db.organizations.id), diff --git a/apps/web/lib/cap-kind-query.ts b/apps/web/lib/cap-kind-query.ts index 1bb8ca103a3..ef81cf54906 100644 --- a/apps/web/lib/cap-kind-query.ts +++ b/apps/web/lib/cap-kind-query.ts @@ -1,8 +1,13 @@ -import { videos } from "@cap/database/schema"; +import { VIDEOS_KIND_LIST_INDEX, videos } from "@cap/database/schema"; import { and, eq } from "drizzle-orm"; import type { CapKind } from "./cap-kind"; export const capKindCondition = (kind: CapKind) => - kind === "notes" - ? eq(videos.isNote, true) - : and(eq(videos.isNote, false), eq(videos.isScreenshot, kind === "images")); + and( + eq(videos.isNote, kind === "notes"), + eq(videos.isScreenshot, kind === "images"), + ); + +// Left to the optimizer, a kind list can be served from an index that is not +// in date order for that kind, which sorts or walks far more rows than a page. +export const capKindIndexHint = { forceIndex: VIDEOS_KIND_LIST_INDEX }; From 078c9384385bf8f96c33c8e057e6fd463494c418 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:50:27 +0000 Subject: [PATCH 24/27] fix(web): keep the comment stats inside their row on share pages --- apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx index de7b5a3ad40..7e7e4959ce4 100644 --- a/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx +++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/index.tsx @@ -98,7 +98,7 @@ export const Activity = Object.assign(
{user && props.isOwnerOrMember && (
- {props.analytics} +
{props.analytics}
)} From 7286ac7f322170ac1357ecd2d39524357743bb3c Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:50:27 +0000 Subject: [PATCH 25/27] fix(web): keep the Sharing dialog actions in view on small screens --- .../(org)/dashboard/caps/components/SharingDialog.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx index 6e208323bd5..0c0f8300899 100644 --- a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx @@ -429,8 +429,9 @@ export const SharingDialog: React.FC = ({ return ( - + } description={ activeTab === "Share" @@ -445,7 +446,7 @@ export const SharingDialog: React.FC = ({
@@ -475,7 +476,7 @@ export const SharingDialog: React.FC = ({ ))}
-
+
{activeTab === "Share" ? ( <> {/* Public sharing toggle */} @@ -758,7 +759,7 @@ export const SharingDialog: React.FC = ({ )}
- + {activeTab === "Share" ? ( <> )}

From b6e6c7a70c10a13f75b572ecb7cb4292706cf53d Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:50:27 +0000 Subject: [PATCH 27/27] improve(web): count Caps on folder cards --- apps/web/__tests__/unit/cap-kind.test.ts | 5 +++++ apps/web/app/(org)/dashboard/caps/components/Folder.tsx | 5 ++++- apps/web/lib/cap-kind.ts | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/web/__tests__/unit/cap-kind.test.ts b/apps/web/__tests__/unit/cap-kind.test.ts index 85206185b0f..f32752be759 100644 --- a/apps/web/__tests__/unit/cap-kind.test.ts +++ b/apps/web/__tests__/unit/cap-kind.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "vitest"; import { + capCountLabel, capIdsInKindOrder, capKindCountsFromTotals, capKindOf, @@ -49,6 +50,10 @@ describe("cap kinds", () => { ).toEqual(["video-1", "video-2"]); }); + it("counts a folder's contents as Caps", () => { + expect([0, 1, 5].map(capCountLabel)).toEqual(["0 Caps", "1 Cap", "5 Caps"]); + }); + it("derives video counts from the totals", () => { expect(capKindCountsFromTotals({ count: 10, images: 3, notes: 2 })).toEqual( { videos: 5, images: 3, notes: 2 }, diff --git a/apps/web/app/(org)/dashboard/caps/components/Folder.tsx b/apps/web/app/(org)/dashboard/caps/components/Folder.tsx index 48cad77e480..c3506e5452d 100644 --- a/apps/web/app/(org)/dashboard/caps/components/Folder.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/Folder.tsx @@ -13,6 +13,7 @@ import { moveVideoToFolder, } from "@/actions/folders/moveVideoToFolder"; import { FontAwesomeIcon } from "@/components/FontAwesomeIcon"; +import { capCountLabel } from "@/lib/cap-kind"; import { useEffectMutation, useRpcClient } from "@/lib/EffectRuntime"; import { CAP_DRAG_TYPE, @@ -555,7 +556,9 @@ const FolderCard = ({ "text-sm truncate text-gray-10 w-fit", isList && "tabular-nums", )} - >{`${videoCount} ${videoCount === 1 ? "video" : "videos"}`}

+ > + {capCountLabel(videoCount)} +

{publicEnabled && !isList && ( diff --git a/apps/web/lib/cap-kind.ts b/apps/web/lib/cap-kind.ts index fa7b804bb62..dd32461c82a 100644 --- a/apps/web/lib/cap-kind.ts +++ b/apps/web/lib/cap-kind.ts @@ -10,6 +10,9 @@ export const CAP_KIND_LABEL: Record = { notes: "Notes", }; +export const capCountLabel = (count: number) => + `${count} ${count === 1 ? "Cap" : "Caps"}`; + export const capKindHref = (kind: CapKind) => `/dashboard/caps/${kind}`; type KindFlags = { isScreenshot?: boolean | null; isNote?: boolean | null };