From ab08e4eedb419201c45fea687de2a77afe18b9c1 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 25 Dec 2024 14:27:12 +0530 Subject: [PATCH 1/3] fix(plugin-videos): video upload and manage videos plugin --- .deploy/api/Dockerfile | 6 ++-- apps/api/package.json | 2 +- apps/api/src/plugins.ts | 6 ++-- apps/server-api/src/package.json | 2 +- apps/server/src/package.json | 2 +- package.json | 12 ++++---- packages/plugins/video-capture/CHANGELOG.md | 3 -- packages/plugins/video-capture/README.md | 29 ------------------- packages/plugins/video-capture/src/index.ts | 5 ---- .../{video-capture => videos}/.dockerignore | 0 .../{video-capture => videos}/.gitignore | 0 .../{video-capture => videos}/.npmignore | 0 packages/plugins/videos/CHANGELOG.md | 3 ++ packages/plugins/videos/README.md | 29 +++++++++++++++++++ .../eslint.config.js | 0 .../{video-capture => videos}/jest.config.ts | 4 +-- .../{video-capture => videos}/package.json | 28 +++++++++--------- .../{video-capture => videos}/project.json | 16 +++++----- packages/plugins/videos/src/index.ts | 4 +++ .../src/lib/commands/create-video.command.ts | 0 .../src/lib/commands/delete-video.command.ts | 0 .../commands/handlers/create-video.handler.ts | 0 .../commands/handlers/delete-video.handler.ts | 0 .../src/lib/commands/handlers/index.ts | 0 .../commands/handlers/update-video.handler.ts | 0 .../src/lib/commands/update-video.command.ts | 0 .../src/lib/dto/base-video.dto.ts | 0 .../src/lib/dto/create-video.dto.ts | 0 .../src/lib/dto/delete-video.dto.ts | 0 .../src/lib/dto/file.dto.ts | 0 .../src/lib/dto/index.ts | 0 .../src/lib/dto/update-video.dto.ts | 0 .../src/lib/entities/video.entity.ts | 0 .../src/lib/queries/get-video.query.ts | 0 .../src/lib/queries/get-videos.query.ts | 0 .../lib/queries/handlers/get-video.handler.ts | 0 .../queries/handlers/get-videos.handler.ts | 0 .../src/lib/queries/handlers/index.ts | 0 .../src/lib/queries/index.ts | 0 .../mikro-orm-video.repository.ts | 0 .../repositories/type-orm-video.repository.ts | 0 .../src/lib/services/videos.service.ts | 0 .../src/lib/subscribers/video.subscriber.ts | 0 .../src/lib/video.model.ts | 0 .../src/lib/videos.controller.spec.ts | 0 .../src/lib/videos.controller.ts | 0 .../src/lib/videos.module.ts | 0 .../src/lib/videos.plugin.ts} | 6 ++-- .../src/lib/videos.service.spec.ts | 0 .../{video-capture => videos}/tsconfig.json | 0 .../tsconfig.lib.json | 0 .../tsconfig.spec.json | 0 tsconfig.json | 2 +- 53 files changed, 78 insertions(+), 81 deletions(-) delete mode 100644 packages/plugins/video-capture/CHANGELOG.md delete mode 100644 packages/plugins/video-capture/README.md delete mode 100644 packages/plugins/video-capture/src/index.ts rename packages/plugins/{video-capture => videos}/.dockerignore (100%) rename packages/plugins/{video-capture => videos}/.gitignore (100%) rename packages/plugins/{video-capture => videos}/.npmignore (100%) create mode 100644 packages/plugins/videos/CHANGELOG.md create mode 100644 packages/plugins/videos/README.md rename packages/plugins/{video-capture => videos}/eslint.config.js (100%) rename packages/plugins/{video-capture => videos}/jest.config.ts (66%) rename packages/plugins/{video-capture => videos}/package.json (66%) rename packages/plugins/{video-capture => videos}/project.json (59%) create mode 100644 packages/plugins/videos/src/index.ts rename packages/plugins/{video-capture => videos}/src/lib/commands/create-video.command.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/delete-video.command.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/handlers/create-video.handler.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/handlers/delete-video.handler.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/handlers/index.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/handlers/update-video.handler.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/commands/update-video.command.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/base-video.dto.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/create-video.dto.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/delete-video.dto.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/file.dto.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/index.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/dto/update-video.dto.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/entities/video.entity.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/get-video.query.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/get-videos.query.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/handlers/get-video.handler.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/handlers/get-videos.handler.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/handlers/index.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/queries/index.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/repositories/mikro-orm-video.repository.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/repositories/type-orm-video.repository.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/services/videos.service.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/subscribers/video.subscriber.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/video.model.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/videos.controller.spec.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/videos.controller.ts (100%) rename packages/plugins/{video-capture => videos}/src/lib/videos.module.ts (100%) rename packages/plugins/{video-capture/src/lib/video-capture.plugin.ts => videos/src/lib/videos.plugin.ts} (74%) rename packages/plugins/{video-capture => videos}/src/lib/videos.service.spec.ts (100%) rename packages/plugins/{video-capture => videos}/tsconfig.json (100%) rename packages/plugins/{video-capture => videos}/tsconfig.lib.json (100%) rename packages/plugins/{video-capture => videos}/tsconfig.spec.json (100%) diff --git a/.deploy/api/Dockerfile b/.deploy/api/Dockerfile index ed72e51bb74..96b8137e3f7 100644 --- a/.deploy/api/Dockerfile +++ b/.deploy/api/Dockerfile @@ -160,7 +160,7 @@ COPY --chown=node:node packages/plugins/integration-jira/package.json ./packages COPY --chown=node:node packages/plugins/jitsu-analytics/package.json ./packages/plugins/jitsu-analytics/ COPY --chown=node:node packages/plugins/sentry-tracing/package.json ./packages/plugins/sentry-tracing/ COPY --chown=node:node packages/plugins/product-reviews/package.json ./packages/plugins/product-reviews/ -COPY --chown=node:node packages/plugins/video-capture/package.json ./packages/plugins/video-capture/ +COPY --chown=node:node packages/plugins/videos/package.json ./packages/plugins/videos/ COPY --chown=node:node packages/plugins/knowledge-base/package.json ./packages/plugins/knowledge-base/ COPY --chown=node:node packages/plugins/changelog/package.json ./packages/plugins/changelog/ COPY --chown=node:node packages/plugins/job-search/package.json ./packages/plugins/job-search/ @@ -233,7 +233,7 @@ COPY --chown=node:node packages/plugins/integration-jira/package.json ./packages COPY --chown=node:node packages/plugins/jitsu-analytics/package.json ./packages/plugins/jitsu-analytics/ COPY --chown=node:node packages/plugins/sentry-tracing/package.json ./packages/plugins/sentry-tracing/ COPY --chown=node:node packages/plugins/product-reviews/package.json ./packages/plugins/product-reviews/ -COPY --chown=node:node packages/plugins/video-capture/package.json ./packages/plugins/video-capture/ +COPY --chown=node:node packages/plugins/videos/package.json ./packages/plugins/videos/ COPY --chown=node:node packages/plugins/knowledge-base/package.json ./packages/plugins/knowledge-base/ COPY --chown=node:node packages/plugins/changelog/package.json ./packages/plugins/changelog/ COPY --chown=node:node packages/plugins/job-search/package.json ./packages/plugins/job-search/ @@ -367,7 +367,7 @@ RUN cp -r ./packages/plugins/job-search/node_modules ./node_modules/@gauzy/plugi RUN cp -r ./packages/plugins/knowledge-base/node_modules ./node_modules/@gauzy/plugin-knowledge-base/ RUN cp -r ./packages/plugins/product-reviews/node_modules ./node_modules/@gauzy/plugin-product-reviews/ RUN cp -r ./packages/plugins/sentry/node_modules ./node_modules/@gauzy/plugin-sentry/ -RUN cp -r ./packages/plugins/video-capture/node_modules ./node_modules/@gauzy/plugin-video-capture/ +RUN cp -r ./packages/plugins/videos/node_modules ./node_modules/@gauzy/plugin-videos/ # we don't need packages folder anymore RUN rm -rf ./packages diff --git a/apps/api/package.json b/apps/api/package.json index b5722287f21..3472aff157b 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -53,7 +53,7 @@ "@gauzy/plugin-knowledge-base": "^0.1.0", "@gauzy/plugin-product-reviews": "^0.1.0", "@gauzy/plugin-sentry": "^0.1.0", - "@gauzy/plugin-video-capture": "^0.1.0", + "@gauzy/plugin-videos": "^0.1.0", "dotenv": "^16.0.3", "yargs": "^17.5.0" }, diff --git a/apps/api/src/plugins.ts b/apps/api/src/plugins.ts index eb2a67df6ad..8e97223c26c 100644 --- a/apps/api/src/plugins.ts +++ b/apps/api/src/plugins.ts @@ -11,7 +11,7 @@ import { JobProposalPlugin } from '@gauzy/plugin-job-proposal'; import { JobSearchPlugin } from '@gauzy/plugin-job-search'; import { KnowledgeBasePlugin } from '@gauzy/plugin-knowledge-base'; import { ProductReviewsPlugin } from '@gauzy/plugin-product-reviews'; -import { VideoCapturePlugin } from '@gauzy/plugin-video-capture'; +import { VideosPlugin } from '@gauzy/plugin-videos'; import { SentryTracing as SentryPlugin } from './sentry'; @@ -52,6 +52,6 @@ export const plugins = [ KnowledgeBasePlugin, // Indicates the inclusion or intention to use the ProductReviewsPlugin in the codebase. ProductReviewsPlugin, - // Indicates the inclusion or intention to use the VideoCapturePlugin in the codebase. - VideoCapturePlugin + // Indicates the inclusion or intention to use the VideosPlugin in the codebase. + VideosPlugin ]; diff --git a/apps/server-api/src/package.json b/apps/server-api/src/package.json index bbf1a581b27..eb57bb21aa1 100755 --- a/apps/server-api/src/package.json +++ b/apps/server-api/src/package.json @@ -147,7 +147,7 @@ "@gauzy/plugin-knowledge-base": "file:../../../dist/packages/plugins/knowledge-base", "@gauzy/plugin-product-reviews": "file:../../../dist/packages/plugins/product-reviews", "@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing", - "@gauzy/plugin-video-capture": "file:../../../dist/packages/plugins/video-capture", + "@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos", "@gauzy/contracts": "^0.1.0", "@gauzy/desktop-lib": "^0.1.0", "@gauzy/desktop-window": "^0.1.0", diff --git a/apps/server/src/package.json b/apps/server/src/package.json index d74f4b825f1..e3ea6fa7b8e 100755 --- a/apps/server/src/package.json +++ b/apps/server/src/package.json @@ -147,7 +147,7 @@ "@gauzy/plugin-knowledge-base": "file:../../../dist/packages/plugins/knowledge-base", "@gauzy/plugin-product-reviews": "file:../../../dist/packages/plugins/product-reviews", "@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing", - "@gauzy/plugin-video-capture": "file:../../../dist/packages/plugins/video-capture", + "@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos", "@gauzy/contracts": "^0.1.0", "@gauzy/desktop-lib": "^0.1.0", "@gauzy/desktop-window": "^0.1.0", diff --git a/package.json b/package.json index e4b7bec5959..c4778574248 100644 --- a/package.json +++ b/package.json @@ -156,9 +156,9 @@ "build:package:plugins:pre": "yarn run build:package:ui-core && yarn run build:package:ui-auth && yarn run build:package:plugin:onboarding-ui && yarn run build:package:plugin:legal-ui && yarn run build:package:plugin:job-search-ui && yarn run build:package:plugin:job-matching-ui && yarn run build:package:plugin:job-employee-ui && yarn run build:package:plugin:job-proposal-ui && yarn run build:package:plugin:public-layout-ui && yarn run build:package:plugin:maintenance-ui && yarn run build:integration-ui-plugins", "build:package:plugins:pre:prod": "yarn run build:package:ui-core:prod && yarn run build:package:ui-auth:prod && yarn run build:package:plugin:onboarding-ui:prod && yarn run build:package:plugin:legal-ui:prod && yarn run build:package:plugin:job-search-ui:prod && yarn run build:package:plugin:job-matching-ui:prod && yarn run build:package:plugin:job-employee-ui:prod && yarn run build:package:plugin:job-proposal-ui:prod && yarn run build:package:plugin:public-layout-ui:prod && yarn run build:package:plugin:maintenance-ui:prod && yarn run build:integration-ui-plugins:prod", "build:package:plugins:pre:docker": "yarn run build:package:ui-core:docker && yarn run build:package:ui-auth:docker && yarn run build:package:plugin:onboarding-ui:docker && yarn run build:package:plugin:legal-ui:docker && yarn run build:package:plugin:job-search-ui:docker && yarn run build:package:plugin:job-matching-ui:docker && yarn run build:package:plugin:job-employee-ui:docker && yarn run build:package:plugin:job-proposal-ui:docker && yarn run build:package:plugin:public-layout-ui:docker && yarn run build:package:plugin:maintenance-ui:docker && yarn run build:integration-ui-plugins:docker", - "build:package:plugins:post": "yarn run build:package:plugin:integration-jira && yarn run build:package:plugin:integration-ai && yarn run build:package:plugin:sentry && yarn run build:package:plugin:jitsu-analytic && yarn run build:package:plugin:product-reviews && yarn run build:package:plugin:job-search && yarn run build:package:plugin:job-proposal && yarn run build:package:plugin:integration-github && yarn run build:package:plugin:knowledge-base && yarn run build:package:plugin:changelog && yarn run build:package:plugin:integration-hubstaff && yarn run build:package:plugin:integration-upwork && yarn run build:package:plugin:video-capture", - "build:package:plugins:post:prod": "yarn run build:package:plugin:integration-jira:prod && yarn run build:package:plugin:integration-ai:prod && yarn run build:package:plugin:sentry:prod && yarn run build:package:plugin:jitsu-analytic:prod && yarn run build:package:plugin:product-reviews:prod && yarn run build:package:plugin:job-search:prod && yarn run build:package:plugin:job-proposal:prod && yarn run build:package:plugin:integration-github:prod && yarn run build:package:plugin:knowledge-base:prod && yarn run build:package:plugin:changelog:prod && yarn run build:package:plugin:integration-hubstaff:prod && yarn run build:package:plugin:integration-upwork:prod && yarn run build:package:plugin:video-capture:prod", - "build:package:plugins:post:docker": "yarn run build:package:plugin:integration-jira:docker && yarn run build:package:plugin:integration-ai:docker && yarn run build:package:plugin:sentry:docker && yarn run build:package:plugin:jitsu-analytic:docker && yarn run build:package:plugin:product-reviews:docker && yarn run build:package:plugin:job-search:docker && yarn run build:package:plugin:job-proposal:docker && yarn run build:package:plugin:integration-github:docker && yarn run build:package:plugin:knowledge-base:docker && yarn run build:package:plugin:changelog:docker && yarn run build:package:plugin:integration-hubstaff:docker && yarn run build:package:plugin:integration-upwork:docker && yarn run build:package:plugin:video-capture:docker", + "build:package:plugins:post": "yarn run build:package:plugin:integration-jira && yarn run build:package:plugin:integration-ai && yarn run build:package:plugin:sentry && yarn run build:package:plugin:jitsu-analytic && yarn run build:package:plugin:product-reviews && yarn run build:package:plugin:job-search && yarn run build:package:plugin:job-proposal && yarn run build:package:plugin:integration-github && yarn run build:package:plugin:knowledge-base && yarn run build:package:plugin:changelog && yarn run build:package:plugin:integration-hubstaff && yarn run build:package:plugin:integration-upwork && yarn run build:package:plugin:videos", + "build:package:plugins:post:prod": "yarn run build:package:plugin:integration-jira:prod && yarn run build:package:plugin:integration-ai:prod && yarn run build:package:plugin:sentry:prod && yarn run build:package:plugin:jitsu-analytic:prod && yarn run build:package:plugin:product-reviews:prod && yarn run build:package:plugin:job-search:prod && yarn run build:package:plugin:job-proposal:prod && yarn run build:package:plugin:integration-github:prod && yarn run build:package:plugin:knowledge-base:prod && yarn run build:package:plugin:changelog:prod && yarn run build:package:plugin:integration-hubstaff:prod && yarn run build:package:plugin:integration-upwork:prod && yarn run build:package:plugin:videos:prod", + "build:package:plugins:post:docker": "yarn run build:package:plugin:integration-jira:docker && yarn run build:package:plugin:integration-ai:docker && yarn run build:package:plugin:sentry:docker && yarn run build:package:plugin:jitsu-analytic:docker && yarn run build:package:plugin:product-reviews:docker && yarn run build:package:plugin:job-search:docker && yarn run build:package:plugin:job-proposal:docker && yarn run build:package:plugin:integration-github:docker && yarn run build:package:plugin:knowledge-base:docker && yarn run build:package:plugin:changelog:docker && yarn run build:package:plugin:integration-hubstaff:docker && yarn run build:package:plugin:integration-upwork:docker && yarn run build:package:plugin:videos:docker", "build:package:plugin:integration-ai": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-integration-ai", "build:package:plugin:integration-ai:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-integration-ai", "build:package:plugin:integration-ai:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-integration-ai", @@ -231,9 +231,9 @@ "build:package:plugin:knowledge-base": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-knowledge-base", "build:package:plugin:knowledge-base:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-knowledge-base", "build:package:plugin:knowledge-base:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-knowledge-base", - "build:package:plugin:video-capture": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-video-capture", - "build:package:plugin:video-capture:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-video-capture", - "build:package:plugin:video-capture:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-video-capture", + "build:package:plugin:videos": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos", + "build:package:plugin:videos:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos", + "build:package:plugin:videos:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-videos", "build:package:plugin:changelog": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-changelog", "build:package:plugin:changelog:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-changelog", "build:package:plugin:changelog:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-changelog", diff --git a/packages/plugins/video-capture/CHANGELOG.md b/packages/plugins/video-capture/CHANGELOG.md deleted file mode 100644 index 364dc5114a3..00000000000 --- a/packages/plugins/video-capture/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -# Changelog for @gauzy/plugin-video-capture - -## [Unreleased] diff --git a/packages/plugins/video-capture/README.md b/packages/plugins/video-capture/README.md deleted file mode 100644 index 7bda8daa79d..00000000000 --- a/packages/plugins/video-capture/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# @gauzy/plugin-video-capture - -This library was generated with [Nx](https://nx.dev). It contains the Video Capture plugin for the Gauzy platform. - -## Overview - -This plugin provides continuous video recording capabilities for your projects. - -## Building - -Run `yarn nx build plugin-video-capture` to build the library. - -## Running unit tests - -Run `yarn nx test plugin-video-capture` to execute the unit tests via [Jest](https://jestjs.io). - -## Publishing - -After building your library with `yarn nx build plugin-video-capture`, go to the dist folder `dist/packages/plugins/video-capture` and run `npm publish`. - -## Installation - -Install the Video Capture plugin using your preferred package manager: - -```bash -npm install @gauzy/plugin-video-capture -# or -yarn add @gauzy/plugin-video-capture -``` diff --git a/packages/plugins/video-capture/src/index.ts b/packages/plugins/video-capture/src/index.ts deleted file mode 100644 index ddd735c627c..00000000000 --- a/packages/plugins/video-capture/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Public API Surface of @gauzy/plugin-video-capture - */ -export * from './lib/video-capture.plugin'; -export * from './lib/video.model'; diff --git a/packages/plugins/video-capture/.dockerignore b/packages/plugins/videos/.dockerignore similarity index 100% rename from packages/plugins/video-capture/.dockerignore rename to packages/plugins/videos/.dockerignore diff --git a/packages/plugins/video-capture/.gitignore b/packages/plugins/videos/.gitignore similarity index 100% rename from packages/plugins/video-capture/.gitignore rename to packages/plugins/videos/.gitignore diff --git a/packages/plugins/video-capture/.npmignore b/packages/plugins/videos/.npmignore similarity index 100% rename from packages/plugins/video-capture/.npmignore rename to packages/plugins/videos/.npmignore diff --git a/packages/plugins/videos/CHANGELOG.md b/packages/plugins/videos/CHANGELOG.md new file mode 100644 index 00000000000..9f70087760d --- /dev/null +++ b/packages/plugins/videos/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog for @gauzy/plugin-videos + +## [Unreleased] diff --git a/packages/plugins/videos/README.md b/packages/plugins/videos/README.md new file mode 100644 index 00000000000..42cb52dd5ac --- /dev/null +++ b/packages/plugins/videos/README.md @@ -0,0 +1,29 @@ +# @gauzy/plugin-videos + +This library was generated with [Nx](https://nx.dev). This plugins provides functionality to upload and manage videos + +## Overview + +This plugins provides functionality to upload and manage videos + +## Building + +Run `yarn nx build plugin-videos` to build the library. + +## Running unit tests + +Run `yarn nx test plugin-videos` to execute the unit tests via [Jest](https://jestjs.io). + +## Publishing + +After building your library with `yarn nx build plugin-videos`, go to the dist folder `dist/packages/plugins/videos` and run `npm publish`. + +## Installation + +Install the Videos plugin using your preferred package manager: + +```bash +npm install @gauzy/plugin-videos +# or +yarn add @gauzy/plugin-videos +``` diff --git a/packages/plugins/video-capture/eslint.config.js b/packages/plugins/videos/eslint.config.js similarity index 100% rename from packages/plugins/video-capture/eslint.config.js rename to packages/plugins/videos/eslint.config.js diff --git a/packages/plugins/video-capture/jest.config.ts b/packages/plugins/videos/jest.config.ts similarity index 66% rename from packages/plugins/video-capture/jest.config.ts rename to packages/plugins/videos/jest.config.ts index 3911db51777..29bf8e9f9da 100644 --- a/packages/plugins/video-capture/jest.config.ts +++ b/packages/plugins/videos/jest.config.ts @@ -1,10 +1,10 @@ export default { - displayName: 'plugin-video-capture', + displayName: 'plugin-videos', preset: '../../../jest.preset.js', testEnvironment: 'node', transform: { '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }] }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../../coverage/packages/plugins/video-capture' + coverageDirectory: '../../../coverage/packages/plugins/videos' }; diff --git a/packages/plugins/video-capture/package.json b/packages/plugins/videos/package.json similarity index 66% rename from packages/plugins/video-capture/package.json rename to packages/plugins/videos/package.json index 134549a1b8d..3cd931bc6b2 100644 --- a/packages/plugins/video-capture/package.json +++ b/packages/plugins/videos/package.json @@ -1,7 +1,7 @@ { - "name": "@gauzy/plugin-video-capture", + "name": "@gauzy/plugin-videos", "version": "0.1.0", - "description": "Ever Gauzy Platform plugin for continuous video recording", + "description": "This plugins provides functionality to upload and manage videos", "author": { "name": "Ever Co. LTD", "email": "ever@ever.co", @@ -21,9 +21,9 @@ "main": "./src/index.js", "typings": "./src/index.d.ts", "scripts": { - "lib:build": "yarn nx build plugin-video-capture", - "lib:build:prod": "yarn nx build plugin-video-capture", - "lib:watch": "yarn nx build plugin-video-capture --watch" + "lib:build": "yarn nx build plugin-videos", + "lib:build:prod": "yarn nx build plugin-videos", + "lib:watch": "yarn nx build plugin-videos --watch" }, "dependencies": { "@gauzy/contracts": "^0.1.0", @@ -39,17 +39,15 @@ }, "keywords": [ "video", - "capture", + "video-upload", + "video-management", + "media", + "media-upload", + "video-library", "plugin", - "NestJS", - "Gauzy", - "Ever Gauzy", - "platform", - "management", - "tool", - "software", - "development", - "typescript" + "gauzy", + "videos-plugin", + "video-plugins" ], "engines": { "node": ">=20.11.1", diff --git a/packages/plugins/video-capture/project.json b/packages/plugins/videos/project.json similarity index 59% rename from packages/plugins/video-capture/project.json rename to packages/plugins/videos/project.json index 284de0f241b..e3fa3971035 100644 --- a/packages/plugins/video-capture/project.json +++ b/packages/plugins/videos/project.json @@ -1,7 +1,7 @@ { - "name": "plugin-video-capture", + "name": "plugin-videos", "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/plugins/video-capture/src", + "sourceRoot": "packages/plugins/videos/src", "projectType": "library", "release": { "version": { @@ -18,11 +18,11 @@ "executor": "@nx/js:tsc", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/packages/plugins/video-capture", - "tsConfig": "packages/plugins/video-capture/tsconfig.lib.json", - "packageJson": "packages/plugins/video-capture/package.json", - "main": "packages/plugins/video-capture/src/index.ts", - "assets": ["packages/plugins/video-capture/*.md"] + "outputPath": "dist/packages/plugins/videos", + "tsConfig": "packages/plugins/videos/tsconfig.lib.json", + "packageJson": "packages/plugins/videos/package.json", + "main": "packages/plugins/videos/src/index.ts", + "assets": ["packages/plugins/videos/*.md"] } }, "nx-release-publish": { @@ -37,7 +37,7 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "packages/plugins/video-capture/jest.config.ts" + "jestConfig": "packages/plugins/videos/jest.config.ts" } } } diff --git a/packages/plugins/videos/src/index.ts b/packages/plugins/videos/src/index.ts new file mode 100644 index 00000000000..e0ea6ea0d01 --- /dev/null +++ b/packages/plugins/videos/src/index.ts @@ -0,0 +1,4 @@ +/** + * Public API Surface of @gauzy/plugin-videos + */ +export * from './lib/videos.plugin'; diff --git a/packages/plugins/video-capture/src/lib/commands/create-video.command.ts b/packages/plugins/videos/src/lib/commands/create-video.command.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/create-video.command.ts rename to packages/plugins/videos/src/lib/commands/create-video.command.ts diff --git a/packages/plugins/video-capture/src/lib/commands/delete-video.command.ts b/packages/plugins/videos/src/lib/commands/delete-video.command.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/delete-video.command.ts rename to packages/plugins/videos/src/lib/commands/delete-video.command.ts diff --git a/packages/plugins/video-capture/src/lib/commands/handlers/create-video.handler.ts b/packages/plugins/videos/src/lib/commands/handlers/create-video.handler.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/handlers/create-video.handler.ts rename to packages/plugins/videos/src/lib/commands/handlers/create-video.handler.ts diff --git a/packages/plugins/video-capture/src/lib/commands/handlers/delete-video.handler.ts b/packages/plugins/videos/src/lib/commands/handlers/delete-video.handler.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/handlers/delete-video.handler.ts rename to packages/plugins/videos/src/lib/commands/handlers/delete-video.handler.ts diff --git a/packages/plugins/video-capture/src/lib/commands/handlers/index.ts b/packages/plugins/videos/src/lib/commands/handlers/index.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/handlers/index.ts rename to packages/plugins/videos/src/lib/commands/handlers/index.ts diff --git a/packages/plugins/video-capture/src/lib/commands/handlers/update-video.handler.ts b/packages/plugins/videos/src/lib/commands/handlers/update-video.handler.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/handlers/update-video.handler.ts rename to packages/plugins/videos/src/lib/commands/handlers/update-video.handler.ts diff --git a/packages/plugins/video-capture/src/lib/commands/update-video.command.ts b/packages/plugins/videos/src/lib/commands/update-video.command.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/commands/update-video.command.ts rename to packages/plugins/videos/src/lib/commands/update-video.command.ts diff --git a/packages/plugins/video-capture/src/lib/dto/base-video.dto.ts b/packages/plugins/videos/src/lib/dto/base-video.dto.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/base-video.dto.ts rename to packages/plugins/videos/src/lib/dto/base-video.dto.ts diff --git a/packages/plugins/video-capture/src/lib/dto/create-video.dto.ts b/packages/plugins/videos/src/lib/dto/create-video.dto.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/create-video.dto.ts rename to packages/plugins/videos/src/lib/dto/create-video.dto.ts diff --git a/packages/plugins/video-capture/src/lib/dto/delete-video.dto.ts b/packages/plugins/videos/src/lib/dto/delete-video.dto.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/delete-video.dto.ts rename to packages/plugins/videos/src/lib/dto/delete-video.dto.ts diff --git a/packages/plugins/video-capture/src/lib/dto/file.dto.ts b/packages/plugins/videos/src/lib/dto/file.dto.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/file.dto.ts rename to packages/plugins/videos/src/lib/dto/file.dto.ts diff --git a/packages/plugins/video-capture/src/lib/dto/index.ts b/packages/plugins/videos/src/lib/dto/index.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/index.ts rename to packages/plugins/videos/src/lib/dto/index.ts diff --git a/packages/plugins/video-capture/src/lib/dto/update-video.dto.ts b/packages/plugins/videos/src/lib/dto/update-video.dto.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/dto/update-video.dto.ts rename to packages/plugins/videos/src/lib/dto/update-video.dto.ts diff --git a/packages/plugins/video-capture/src/lib/entities/video.entity.ts b/packages/plugins/videos/src/lib/entities/video.entity.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/entities/video.entity.ts rename to packages/plugins/videos/src/lib/entities/video.entity.ts diff --git a/packages/plugins/video-capture/src/lib/queries/get-video.query.ts b/packages/plugins/videos/src/lib/queries/get-video.query.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/get-video.query.ts rename to packages/plugins/videos/src/lib/queries/get-video.query.ts diff --git a/packages/plugins/video-capture/src/lib/queries/get-videos.query.ts b/packages/plugins/videos/src/lib/queries/get-videos.query.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/get-videos.query.ts rename to packages/plugins/videos/src/lib/queries/get-videos.query.ts diff --git a/packages/plugins/video-capture/src/lib/queries/handlers/get-video.handler.ts b/packages/plugins/videos/src/lib/queries/handlers/get-video.handler.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/handlers/get-video.handler.ts rename to packages/plugins/videos/src/lib/queries/handlers/get-video.handler.ts diff --git a/packages/plugins/video-capture/src/lib/queries/handlers/get-videos.handler.ts b/packages/plugins/videos/src/lib/queries/handlers/get-videos.handler.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/handlers/get-videos.handler.ts rename to packages/plugins/videos/src/lib/queries/handlers/get-videos.handler.ts diff --git a/packages/plugins/video-capture/src/lib/queries/handlers/index.ts b/packages/plugins/videos/src/lib/queries/handlers/index.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/handlers/index.ts rename to packages/plugins/videos/src/lib/queries/handlers/index.ts diff --git a/packages/plugins/video-capture/src/lib/queries/index.ts b/packages/plugins/videos/src/lib/queries/index.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/queries/index.ts rename to packages/plugins/videos/src/lib/queries/index.ts diff --git a/packages/plugins/video-capture/src/lib/repositories/mikro-orm-video.repository.ts b/packages/plugins/videos/src/lib/repositories/mikro-orm-video.repository.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/repositories/mikro-orm-video.repository.ts rename to packages/plugins/videos/src/lib/repositories/mikro-orm-video.repository.ts diff --git a/packages/plugins/video-capture/src/lib/repositories/type-orm-video.repository.ts b/packages/plugins/videos/src/lib/repositories/type-orm-video.repository.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/repositories/type-orm-video.repository.ts rename to packages/plugins/videos/src/lib/repositories/type-orm-video.repository.ts diff --git a/packages/plugins/video-capture/src/lib/services/videos.service.ts b/packages/plugins/videos/src/lib/services/videos.service.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/services/videos.service.ts rename to packages/plugins/videos/src/lib/services/videos.service.ts diff --git a/packages/plugins/video-capture/src/lib/subscribers/video.subscriber.ts b/packages/plugins/videos/src/lib/subscribers/video.subscriber.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/subscribers/video.subscriber.ts rename to packages/plugins/videos/src/lib/subscribers/video.subscriber.ts diff --git a/packages/plugins/video-capture/src/lib/video.model.ts b/packages/plugins/videos/src/lib/video.model.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/video.model.ts rename to packages/plugins/videos/src/lib/video.model.ts diff --git a/packages/plugins/video-capture/src/lib/videos.controller.spec.ts b/packages/plugins/videos/src/lib/videos.controller.spec.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/videos.controller.spec.ts rename to packages/plugins/videos/src/lib/videos.controller.spec.ts diff --git a/packages/plugins/video-capture/src/lib/videos.controller.ts b/packages/plugins/videos/src/lib/videos.controller.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/videos.controller.ts rename to packages/plugins/videos/src/lib/videos.controller.ts diff --git a/packages/plugins/video-capture/src/lib/videos.module.ts b/packages/plugins/videos/src/lib/videos.module.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/videos.module.ts rename to packages/plugins/videos/src/lib/videos.module.ts diff --git a/packages/plugins/video-capture/src/lib/video-capture.plugin.ts b/packages/plugins/videos/src/lib/videos.plugin.ts similarity index 74% rename from packages/plugins/video-capture/src/lib/video-capture.plugin.ts rename to packages/plugins/videos/src/lib/videos.plugin.ts index 5d81e1dc656..80aaeec01d6 100644 --- a/packages/plugins/video-capture/src/lib/video-capture.plugin.ts +++ b/packages/plugins/videos/src/lib/videos.plugin.ts @@ -9,7 +9,7 @@ import { Video } from './entities/video.entity'; providers: [], exports: [] }) -export class VideoCapturePlugin implements IOnPluginBootstrap, IOnPluginDestroy { +export class VideosPlugin implements IOnPluginBootstrap, IOnPluginDestroy { // We disable by default additional logging for each event to avoid cluttering the logs private logEnabled = true; @@ -18,7 +18,7 @@ export class VideoCapturePlugin implements IOnPluginBootstrap, IOnPluginDestroy */ onPluginBootstrap(): void | Promise { if (this.logEnabled) { - console.log(chalk.green(`${VideoCapturePlugin.name} is being bootstrapped...`)); + console.log(chalk.green(`${VideosPlugin.name} is being bootstrapped...`)); } } @@ -27,7 +27,7 @@ export class VideoCapturePlugin implements IOnPluginBootstrap, IOnPluginDestroy */ onPluginDestroy(): void | Promise { if (this.logEnabled) { - console.log(chalk.red(`${VideoCapturePlugin.name} is being destroyed...`)); + console.log(chalk.red(`${VideosPlugin.name} is being destroyed...`)); } } } diff --git a/packages/plugins/video-capture/src/lib/videos.service.spec.ts b/packages/plugins/videos/src/lib/videos.service.spec.ts similarity index 100% rename from packages/plugins/video-capture/src/lib/videos.service.spec.ts rename to packages/plugins/videos/src/lib/videos.service.spec.ts diff --git a/packages/plugins/video-capture/tsconfig.json b/packages/plugins/videos/tsconfig.json similarity index 100% rename from packages/plugins/video-capture/tsconfig.json rename to packages/plugins/videos/tsconfig.json diff --git a/packages/plugins/video-capture/tsconfig.lib.json b/packages/plugins/videos/tsconfig.lib.json similarity index 100% rename from packages/plugins/video-capture/tsconfig.lib.json rename to packages/plugins/videos/tsconfig.lib.json diff --git a/packages/plugins/video-capture/tsconfig.spec.json b/packages/plugins/videos/tsconfig.spec.json similarity index 100% rename from packages/plugins/video-capture/tsconfig.spec.json rename to packages/plugins/videos/tsconfig.spec.json diff --git a/tsconfig.json b/tsconfig.json index 6ff02360ac4..b5322731291 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -41,7 +41,7 @@ "@gauzy/plugin-product-reviews": ["./packages/plugins/product-reviews/src/index.ts"], "@gauzy/plugin-public-layout-ui": ["./packages/plugins/public-layout-ui/src/index.ts"], "@gauzy/plugin-sentry": ["./packages/plugins/sentry-tracing/src/index.ts"], - "@gauzy/plugin-video-capture": ["./packages/plugins/video-capture/src/index.ts"], + "@gauzy/plugin-videos": ["./packages/plugins/videos/src/index.ts"], "@gauzy/ui-auth": ["./packages/ui-auth/src/index.ts"], "@gauzy/ui-config": ["./packages/ui-config/src/index.ts"], "@gauzy/ui-core": ["./packages/ui-core/src/index.ts"], From 9c44864dac21b92bf84e9e6aefca7ccc56778cb8 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 25 Dec 2024 14:45:36 +0530 Subject: [PATCH 2/3] fix(plugin-videos): updated README.md for videos plugin --- packages/plugins/videos/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugins/videos/README.md b/packages/plugins/videos/README.md index 42cb52dd5ac..903c880be38 100644 --- a/packages/plugins/videos/README.md +++ b/packages/plugins/videos/README.md @@ -1,10 +1,13 @@ # @gauzy/plugin-videos -This library was generated with [Nx](https://nx.dev). This plugins provides functionality to upload and manage videos +This library was generated with [Nx](https://nx.dev). This plugin provides functionality to upload and manage videos. ## Overview -This plugins provides functionality to upload and manage videos +This plugin enables video management capabilities including: + +- Video upload and storage +- Video metadata management ## Building From 61078411f00347ea9865b97031e22a75cc2619f5 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 25 Dec 2024 16:11:36 +0530 Subject: [PATCH 3/3] fix(migration): update video table schema for PostgreSQL and SQLite --- .../1735058989058-CreateVideoTable.ts | 178 ++++++++---------- .../videos/src/lib/entities/video.entity.ts | 44 ++--- 2 files changed, 103 insertions(+), 119 deletions(-) diff --git a/packages/core/src/lib/database/migrations/1735058989058-CreateVideoTable.ts b/packages/core/src/lib/database/migrations/1735058989058-CreateVideoTable.ts index 04b7c9f1008..0d6407aff43 100644 --- a/packages/core/src/lib/database/migrations/1735058989058-CreateVideoTable.ts +++ b/packages/core/src/lib/database/migrations/1735058989058-CreateVideoTable.ts @@ -59,20 +59,19 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TYPE "public"."video_storageprovider_enum" AS ENUM('LOCAL', 'S3', 'WASABI', 'CLOUDINARY', 'DIGITALOCEAN')`); - await queryRunner.query(`CREATE TABLE "video" ("deletedAt" TIMESTAMP, "id" uuid NOT NULL DEFAULT gen_random_uuid(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "isActive" boolean DEFAULT true, "isArchived" boolean DEFAULT false, "archivedAt" TIMESTAMP, "tenantId" uuid, "organizationId" uuid, "title" character varying NOT NULL, "file" character varying NOT NULL, "recordedAt" TIMESTAMP, "duration" integer, "size" integer, "fullUrl" character varying, "storageProvider" "public"."video_storageprovider_enum", "description" character varying, "resolution" character varying DEFAULT '1920:1080', "codec" character varying DEFAULT 'libx264', "frameRate" integer DEFAULT '15', "timeSlotId" uuid, "uploadedById" uuid, CONSTRAINT "PK_e4c86c0cf95aff16e9fb8220f6b" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE INDEX "IDX_eea665c6f09c4cd9a520a028d1" ON "video" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4adb6b1409e7b614d06e44fb84" ON "video" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1f9ad46e9fbeddbc609af9976a" ON "video" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_dcbf77e688d65ced41055c3faf" ON "video" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_cb34a3e97002e3af9cc219f4e4" ON "video" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b3e784ea168736c83f4d647abf" ON "video" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_d5a38b4293d90e31a6b1f3189e" ON "video" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_159f8e5c7959016a0863ec419a" ON "video" ("uploadedById") `); - await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_1f9ad46e9fbeddbc609af9976ae" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_dcbf77e688d65ced41055c3fafe" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE`); - await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_d5a38b4293d90e31a6b1f3189e1" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_159f8e5c7959016a0863ec419a3" FOREIGN KEY ("uploadedById") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`CREATE TABLE "video" ("deletedAt" TIMESTAMP, "id" uuid NOT NULL DEFAULT gen_random_uuid(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "isActive" boolean DEFAULT true, "isArchived" boolean DEFAULT false, "archivedAt" TIMESTAMP, "tenantId" uuid, "organizationId" uuid, "title" character varying NOT NULL, "file" character varying NOT NULL, "recordedAt" TIMESTAMP, "duration" integer, "size" integer, "fullUrl" character varying, "description" character varying, "storageProvider" text, "resolution" text DEFAULT '1920:1080', "codec" text DEFAULT 'libx264', "frameRate" integer DEFAULT '15', "timeSlotId" uuid, "uploadedById" uuid, CONSTRAINT "PK_1a2f3856250765d72e7e1636c8e" PRIMARY KEY ("id"))`); + await queryRunner.query(`CREATE INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca" ON "video" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_158647e790ce90499ed5a53c9b" ON "video" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6fd9144466152ccef62e39d853" ON "video" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_061902beee13424f6372ac19f0" ON "video" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_95bba1c05216311bf162f6d835" ON "video" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1be826cc802f4cf0abb36ab365" ON "video" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_a0c8486c125418dc0cc2e38470" ON "video" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_f42d8d7033aacb69287d0dcfd9" ON "video" ("uploadedById") `); + await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_6fd9144466152ccef62e39d853e" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_061902beee13424f6372ac19f02" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE`); + await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_a0c8486c125418dc0cc2e384703" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_f42d8d7033aacb69287d0dcfd9a" FOREIGN KEY ("uploadedById") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); } /** @@ -81,20 +80,19 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_159f8e5c7959016a0863ec419a3"`); - await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_d5a38b4293d90e31a6b1f3189e1"`); - await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_dcbf77e688d65ced41055c3fafe"`); - await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_1f9ad46e9fbeddbc609af9976ae"`); - await queryRunner.query(`DROP INDEX "public"."IDX_159f8e5c7959016a0863ec419a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d5a38b4293d90e31a6b1f3189e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b3e784ea168736c83f4d647abf"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cb34a3e97002e3af9cc219f4e4"`); - await queryRunner.query(`DROP INDEX "public"."IDX_dcbf77e688d65ced41055c3faf"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1f9ad46e9fbeddbc609af9976a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_4adb6b1409e7b614d06e44fb84"`); - await queryRunner.query(`DROP INDEX "public"."IDX_eea665c6f09c4cd9a520a028d1"`); + await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_f42d8d7033aacb69287d0dcfd9a"`); + await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_a0c8486c125418dc0cc2e384703"`); + await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_061902beee13424f6372ac19f02"`); + await queryRunner.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_6fd9144466152ccef62e39d853e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f42d8d7033aacb69287d0dcfd9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a0c8486c125418dc0cc2e38470"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1be826cc802f4cf0abb36ab365"`); + await queryRunner.query(`DROP INDEX "public"."IDX_95bba1c05216311bf162f6d835"`); + await queryRunner.query(`DROP INDEX "public"."IDX_061902beee13424f6372ac19f0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6fd9144466152ccef62e39d853"`); + await queryRunner.query(`DROP INDEX "public"."IDX_158647e790ce90499ed5a53c9b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f57c7e5cac7c7ab9809bfc9aca"`); await queryRunner.query(`DROP TABLE "video"`); - await queryRunner.query(`DROP TYPE "public"."video_storageprovider_enum"`); } /** @@ -103,35 +101,35 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE "video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "description" varchar, "resolution" varchar DEFAULT ('1920:1080'), "codec" varchar DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar)`); - await queryRunner.query(`CREATE INDEX "IDX_eea665c6f09c4cd9a520a028d1" ON "video" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4adb6b1409e7b614d06e44fb84" ON "video" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1f9ad46e9fbeddbc609af9976a" ON "video" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_dcbf77e688d65ced41055c3faf" ON "video" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_cb34a3e97002e3af9cc219f4e4" ON "video" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b3e784ea168736c83f4d647abf" ON "video" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_d5a38b4293d90e31a6b1f3189e" ON "video" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_159f8e5c7959016a0863ec419a" ON "video" ("uploadedById") `); - await queryRunner.query(`DROP INDEX "IDX_eea665c6f09c4cd9a520a028d1"`); - await queryRunner.query(`DROP INDEX "IDX_4adb6b1409e7b614d06e44fb84"`); - await queryRunner.query(`DROP INDEX "IDX_1f9ad46e9fbeddbc609af9976a"`); - await queryRunner.query(`DROP INDEX "IDX_dcbf77e688d65ced41055c3faf"`); - await queryRunner.query(`DROP INDEX "IDX_cb34a3e97002e3af9cc219f4e4"`); - await queryRunner.query(`DROP INDEX "IDX_b3e784ea168736c83f4d647abf"`); - await queryRunner.query(`DROP INDEX "IDX_d5a38b4293d90e31a6b1f3189e"`); - await queryRunner.query(`DROP INDEX "IDX_159f8e5c7959016a0863ec419a"`); - await queryRunner.query(`CREATE TABLE "temporary_video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "description" varchar, "resolution" varchar DEFAULT ('1920:1080'), "codec" varchar DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar, CONSTRAINT "FK_1f9ad46e9fbeddbc609af9976ae" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_dcbf77e688d65ced41055c3fafe" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d5a38b4293d90e31a6b1f3189e1" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_159f8e5c7959016a0863ec419a3" FOREIGN KEY ("uploadedById") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`); - await queryRunner.query(`INSERT INTO "temporary_video"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "storageProvider", "description", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "storageProvider", "description", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById" FROM "video"`); + await queryRunner.query(`CREATE TABLE "video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "description" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "resolution" text DEFAULT ('1920:1080'), "codec" text DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar)`); + await queryRunner.query(`CREATE INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca" ON "video" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_158647e790ce90499ed5a53c9b" ON "video" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6fd9144466152ccef62e39d853" ON "video" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_061902beee13424f6372ac19f0" ON "video" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_95bba1c05216311bf162f6d835" ON "video" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1be826cc802f4cf0abb36ab365" ON "video" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_a0c8486c125418dc0cc2e38470" ON "video" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_f42d8d7033aacb69287d0dcfd9" ON "video" ("uploadedById") `); + await queryRunner.query(`DROP INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca"`); + await queryRunner.query(`DROP INDEX "IDX_158647e790ce90499ed5a53c9b"`); + await queryRunner.query(`DROP INDEX "IDX_6fd9144466152ccef62e39d853"`); + await queryRunner.query(`DROP INDEX "IDX_061902beee13424f6372ac19f0"`); + await queryRunner.query(`DROP INDEX "IDX_95bba1c05216311bf162f6d835"`); + await queryRunner.query(`DROP INDEX "IDX_1be826cc802f4cf0abb36ab365"`); + await queryRunner.query(`DROP INDEX "IDX_a0c8486c125418dc0cc2e38470"`); + await queryRunner.query(`DROP INDEX "IDX_f42d8d7033aacb69287d0dcfd9"`); + await queryRunner.query(`CREATE TABLE "temporary_video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "description" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "resolution" text DEFAULT ('1920:1080'), "codec" text DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar, CONSTRAINT "FK_6fd9144466152ccef62e39d853e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_061902beee13424f6372ac19f02" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a0c8486c125418dc0cc2e384703" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f42d8d7033aacb69287d0dcfd9a" FOREIGN KEY ("uploadedById") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`); + await queryRunner.query(`INSERT INTO "temporary_video"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "description", "storageProvider", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "description", "storageProvider", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById" FROM "video"`); await queryRunner.query(`DROP TABLE "video"`); await queryRunner.query(`ALTER TABLE "temporary_video" RENAME TO "video"`); - await queryRunner.query(`CREATE INDEX "IDX_eea665c6f09c4cd9a520a028d1" ON "video" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4adb6b1409e7b614d06e44fb84" ON "video" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1f9ad46e9fbeddbc609af9976a" ON "video" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_dcbf77e688d65ced41055c3faf" ON "video" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_cb34a3e97002e3af9cc219f4e4" ON "video" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b3e784ea168736c83f4d647abf" ON "video" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_d5a38b4293d90e31a6b1f3189e" ON "video" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_159f8e5c7959016a0863ec419a" ON "video" ("uploadedById") `); + await queryRunner.query(`CREATE INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca" ON "video" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_158647e790ce90499ed5a53c9b" ON "video" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6fd9144466152ccef62e39d853" ON "video" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_061902beee13424f6372ac19f0" ON "video" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_95bba1c05216311bf162f6d835" ON "video" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1be826cc802f4cf0abb36ab365" ON "video" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_a0c8486c125418dc0cc2e38470" ON "video" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_f42d8d7033aacb69287d0dcfd9" ON "video" ("uploadedById") `); } /** @@ -140,34 +138,34 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_159f8e5c7959016a0863ec419a"`); - await queryRunner.query(`DROP INDEX "IDX_d5a38b4293d90e31a6b1f3189e"`); - await queryRunner.query(`DROP INDEX "IDX_b3e784ea168736c83f4d647abf"`); - await queryRunner.query(`DROP INDEX "IDX_cb34a3e97002e3af9cc219f4e4"`); - await queryRunner.query(`DROP INDEX "IDX_dcbf77e688d65ced41055c3faf"`); - await queryRunner.query(`DROP INDEX "IDX_1f9ad46e9fbeddbc609af9976a"`); - await queryRunner.query(`DROP INDEX "IDX_4adb6b1409e7b614d06e44fb84"`); - await queryRunner.query(`DROP INDEX "IDX_eea665c6f09c4cd9a520a028d1"`); + await queryRunner.query(`DROP INDEX "IDX_f42d8d7033aacb69287d0dcfd9"`); + await queryRunner.query(`DROP INDEX "IDX_a0c8486c125418dc0cc2e38470"`); + await queryRunner.query(`DROP INDEX "IDX_1be826cc802f4cf0abb36ab365"`); + await queryRunner.query(`DROP INDEX "IDX_95bba1c05216311bf162f6d835"`); + await queryRunner.query(`DROP INDEX "IDX_061902beee13424f6372ac19f0"`); + await queryRunner.query(`DROP INDEX "IDX_6fd9144466152ccef62e39d853"`); + await queryRunner.query(`DROP INDEX "IDX_158647e790ce90499ed5a53c9b"`); + await queryRunner.query(`DROP INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca"`); await queryRunner.query(`ALTER TABLE "video" RENAME TO "temporary_video"`); - await queryRunner.query(`CREATE TABLE "video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "description" varchar, "resolution" varchar DEFAULT ('1920:1080'), "codec" varchar DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar)`); - await queryRunner.query(`INSERT INTO "video"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "storageProvider", "description", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "storageProvider", "description", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById" FROM "temporary_video"`); + await queryRunner.query(`CREATE TABLE "video" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "file" varchar NOT NULL, "recordedAt" datetime, "duration" integer, "size" integer, "fullUrl" varchar, "description" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "resolution" text DEFAULT ('1920:1080'), "codec" text DEFAULT ('libx264'), "frameRate" integer DEFAULT (15), "timeSlotId" varchar, "uploadedById" varchar)`); + await queryRunner.query(`INSERT INTO "video"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "description", "storageProvider", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "title", "file", "recordedAt", "duration", "size", "fullUrl", "description", "storageProvider", "resolution", "codec", "frameRate", "timeSlotId", "uploadedById" FROM "temporary_video"`); await queryRunner.query(`DROP TABLE "temporary_video"`); - await queryRunner.query(`CREATE INDEX "IDX_159f8e5c7959016a0863ec419a" ON "video" ("uploadedById") `); - await queryRunner.query(`CREATE INDEX "IDX_d5a38b4293d90e31a6b1f3189e" ON "video" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_b3e784ea168736c83f4d647abf" ON "video" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_cb34a3e97002e3af9cc219f4e4" ON "video" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_dcbf77e688d65ced41055c3faf" ON "video" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_1f9ad46e9fbeddbc609af9976a" ON "video" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_4adb6b1409e7b614d06e44fb84" ON "video" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_eea665c6f09c4cd9a520a028d1" ON "video" ("isActive") `); - await queryRunner.query(`DROP INDEX "IDX_159f8e5c7959016a0863ec419a"`); - await queryRunner.query(`DROP INDEX "IDX_d5a38b4293d90e31a6b1f3189e"`); - await queryRunner.query(`DROP INDEX "IDX_b3e784ea168736c83f4d647abf"`); - await queryRunner.query(`DROP INDEX "IDX_cb34a3e97002e3af9cc219f4e4"`); - await queryRunner.query(`DROP INDEX "IDX_dcbf77e688d65ced41055c3faf"`); - await queryRunner.query(`DROP INDEX "IDX_1f9ad46e9fbeddbc609af9976a"`); - await queryRunner.query(`DROP INDEX "IDX_4adb6b1409e7b614d06e44fb84"`); - await queryRunner.query(`DROP INDEX "IDX_eea665c6f09c4cd9a520a028d1"`); + await queryRunner.query(`CREATE INDEX "IDX_f42d8d7033aacb69287d0dcfd9" ON "video" ("uploadedById") `); + await queryRunner.query(`CREATE INDEX "IDX_a0c8486c125418dc0cc2e38470" ON "video" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_1be826cc802f4cf0abb36ab365" ON "video" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_95bba1c05216311bf162f6d835" ON "video" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_061902beee13424f6372ac19f0" ON "video" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_6fd9144466152ccef62e39d853" ON "video" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_158647e790ce90499ed5a53c9b" ON "video" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca" ON "video" ("isActive") `); + await queryRunner.query(`DROP INDEX "IDX_f42d8d7033aacb69287d0dcfd9"`); + await queryRunner.query(`DROP INDEX "IDX_a0c8486c125418dc0cc2e38470"`); + await queryRunner.query(`DROP INDEX "IDX_1be826cc802f4cf0abb36ab365"`); + await queryRunner.query(`DROP INDEX "IDX_95bba1c05216311bf162f6d835"`); + await queryRunner.query(`DROP INDEX "IDX_061902beee13424f6372ac19f0"`); + await queryRunner.query(`DROP INDEX "IDX_6fd9144466152ccef62e39d853"`); + await queryRunner.query(`DROP INDEX "IDX_158647e790ce90499ed5a53c9b"`); + await queryRunner.query(`DROP INDEX "IDX_f57c7e5cac7c7ab9809bfc9aca"`); await queryRunner.query(`DROP TABLE "video"`); } @@ -177,11 +175,7 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`video\` (\`deletedAt\` datetime(6) NULL, \`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`archivedAt\` datetime NULL, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`file\` varchar(255) NOT NULL, \`recordedAt\` datetime NULL, \`duration\` int NULL, \`size\` int NULL, \`fullUrl\` varchar(255) NULL, \`storageProvider\` enum ('LOCAL', 'S3', 'WASABI', 'CLOUDINARY', 'DIGITALOCEAN') NULL, \`description\` varchar(255) NULL, \`resolution\` varchar(255) NULL DEFAULT '1920:1080', \`codec\` varchar(255) NULL DEFAULT 'libx264', \`frameRate\` int NULL DEFAULT '15', \`timeSlotId\` varchar(255) NULL, \`uploadedById\` varchar(255) NULL, INDEX \`IDX_eea665c6f09c4cd9a520a028d1\` (\`isActive\`), INDEX \`IDX_4adb6b1409e7b614d06e44fb84\` (\`isArchived\`), INDEX \`IDX_1f9ad46e9fbeddbc609af9976a\` (\`tenantId\`), INDEX \`IDX_dcbf77e688d65ced41055c3faf\` (\`organizationId\`), INDEX \`IDX_cb34a3e97002e3af9cc219f4e4\` (\`recordedAt\`), INDEX \`IDX_b3e784ea168736c83f4d647abf\` (\`storageProvider\`), INDEX \`IDX_d5a38b4293d90e31a6b1f3189e\` (\`timeSlotId\`), INDEX \`IDX_159f8e5c7959016a0863ec419a\` (\`uploadedById\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`ALTER TABLE \`video\` ADD CONSTRAINT \`FK_1f9ad46e9fbeddbc609af9976ae\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`video\` ADD CONSTRAINT \`FK_dcbf77e688d65ced41055c3fafe\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); - await queryRunner.query(`ALTER TABLE \`video\` ADD CONSTRAINT \`FK_d5a38b4293d90e31a6b1f3189e1\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`video\` ADD CONSTRAINT \`FK_159f8e5c7959016a0863ec419a3\` FOREIGN KEY (\`uploadedById\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); + } /** @@ -190,18 +184,6 @@ export class CreateVideoTable1735058989058 implements MigrationInterface { * @param queryRunner */ public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`video\` DROP FOREIGN KEY \`FK_159f8e5c7959016a0863ec419a3\``); - await queryRunner.query(`ALTER TABLE \`video\` DROP FOREIGN KEY \`FK_d5a38b4293d90e31a6b1f3189e1\``); - await queryRunner.query(`ALTER TABLE \`video\` DROP FOREIGN KEY \`FK_dcbf77e688d65ced41055c3fafe\``); - await queryRunner.query(`ALTER TABLE \`video\` DROP FOREIGN KEY \`FK_1f9ad46e9fbeddbc609af9976ae\``); - await queryRunner.query(`DROP INDEX \`IDX_159f8e5c7959016a0863ec419a\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_d5a38b4293d90e31a6b1f3189e\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_b3e784ea168736c83f4d647abf\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_cb34a3e97002e3af9cc219f4e4\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_dcbf77e688d65ced41055c3faf\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_1f9ad46e9fbeddbc609af9976a\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_4adb6b1409e7b614d06e44fb84\` ON \`video\``); - await queryRunner.query(`DROP INDEX \`IDX_eea665c6f09c4cd9a520a028d1\` ON \`video\``); - await queryRunner.query(`DROP TABLE \`video\``); + } } diff --git a/packages/plugins/videos/src/lib/entities/video.entity.ts b/packages/plugins/videos/src/lib/entities/video.entity.ts index f89be25e021..182e63d21c4 100644 --- a/packages/plugins/videos/src/lib/entities/video.entity.ts +++ b/packages/plugins/videos/src/lib/entities/video.entity.ts @@ -99,20 +99,6 @@ export class Video extends TenantOrganizationBaseEntity implements IVideo { @MultiORMColumn({ nullable: true }) fullUrl?: string | null; - /** - * Storage provider used for storing the video file. - * Optional and must match one of the predefined storage providers. - */ - @ApiPropertyOptional({ type: () => String, enum: FileStorageProviderEnum }) - @IsOptional() - @IsEnum(FileStorageProviderEnum, { - message: `Storage provider must be one of: ${Object.values(FileStorageProviderEnum).join(', ')}` - }) - @Exclude({ toPlainOnly: true }) - @ColumnIndex() - @MultiORMColumn({ type: 'simple-enum', nullable: true, enum: FileStorageProviderEnum }) - storageProvider?: FileStorageProvider; - /** * Description of the video. * Optional with a maximum length of 1000 characters. @@ -127,20 +113,34 @@ export class Video extends TenantOrganizationBaseEntity implements IVideo { @MultiORMColumn({ nullable: true }) description?: string; + /** + * Storage provider used for storing the video file. + * Optional and must match one of the predefined storage providers. + */ + @ApiPropertyOptional({ type: () => String, enum: FileStorageProviderEnum }) + @IsOptional() + @IsEnum(FileStorageProviderEnum) + @Exclude({ toPlainOnly: true }) + @ColumnIndex() + @MultiORMColumn({ type: 'text', nullable: true, enum: FileStorageProviderEnum }) + storageProvider?: FileStorageProvider; + /** * Video resolution in the format WIDTH:HEIGHT. * Optional and restricted to standard resolutions defined in VideoResolutionEnum. */ - @ApiProperty({ + @ApiPropertyOptional({ type: () => String, enum: VideoResolutionEnum, description: 'Video resolution in format WIDTH:HEIGHT (e.g., 1920:1080, 3840:2160)' }) @IsOptional() - @IsEnum(VideoResolutionEnum, { - message: `Resolution must be one of the following: ${Object.values(VideoResolutionEnum).join(', ')}` + @IsEnum(VideoResolutionEnum) + @MultiORMColumn({ + type: 'text', + nullable: true, + default: VideoResolutionEnum.FullHD }) - @MultiORMColumn({ nullable: true, default: VideoResolutionEnum.FullHD }) resolution?: VideoResolutionEnum; /** @@ -153,10 +153,12 @@ export class Video extends TenantOrganizationBaseEntity implements IVideo { description: 'Video codec used for encoding (e.g., libx264, libx265, vp9)' }) @IsOptional() - @IsEnum(VideoCodecEnum, { - message: `Codec must be one of the following: ${Object.values(VideoCodecEnum).join(', ')}` + @IsEnum(VideoCodecEnum) + @MultiORMColumn({ + type: 'text', + nullable: true, + default: VideoCodecEnum.libx264 }) - @MultiORMColumn({ nullable: true, default: VideoCodecEnum.libx264 }) codec?: VideoCodecEnum; /**