From dc3d902234bb73fbc8cf9787e3036f2012526e6c Mon Sep 17 00:00:00 2001 From: lutangar Date: Tue, 29 Jun 2021 16:02:05 +0200 Subject: Introduce generic video constant manager for plugins Allow a plugin developer to get back constants values, and reset constants deletions or additions. --- .../managers/plugin-playlist-privacy-manager.model.ts | 12 ++++++++---- .../server/managers/plugin-video-category-manager.model.ts | 10 +++++++++- .../server/managers/plugin-video-language-manager.model.ts | 10 +++++++++- .../server/managers/plugin-video-licence-manager.model.ts | 10 +++++++++- .../server/managers/plugin-video-privacy-manager.model.ts | 14 +++++++++----- 5 files changed, 44 insertions(+), 12 deletions(-) (limited to 'shared/models/plugins/server/managers') diff --git a/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts b/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts index 4703c0a8b..5b3b37752 100644 --- a/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts @@ -1,8 +1,12 @@ import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model' +import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' -export interface PluginPlaylistPrivacyManager { - // PUBLIC = 1, - // UNLISTED = 2, - // PRIVATE = 3 +export interface PluginPlaylistPrivacyManager extends ConstantManager { + /** + * PUBLIC = 1, + * UNLISTED = 2, + * PRIVATE = 3 + * @deprecated use `deleteConstant` instead + */ deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacy) => boolean } diff --git a/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts index 201bfa979..069ad1476 100644 --- a/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts @@ -1,5 +1,13 @@ -export interface PluginVideoCategoryManager { +import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' + +export interface PluginVideoCategoryManager extends ConstantManager { + /** + * @deprecated use `addConstant` instead + */ addCategory: (categoryKey: number, categoryLabel: string) => boolean + /** + * @deprecated use `deleteConstant` instead + */ deleteCategory: (categoryKey: number) => boolean } diff --git a/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts index 3fd577a79..969c6c670 100644 --- a/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts @@ -1,5 +1,13 @@ -export interface PluginVideoLanguageManager { +import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' + +export interface PluginVideoLanguageManager extends ConstantManager { + /** + * @deprecated use `addConstant` instead + */ addLanguage: (languageKey: string, languageLabel: string) => boolean + /** + * @deprecated use `deleteConstant` instead + */ deleteLanguage: (languageKey: string) => boolean } diff --git a/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts index 82a634d3a..900a49661 100644 --- a/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts @@ -1,5 +1,13 @@ -export interface PluginVideoLicenceManager { +import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' + +export interface PluginVideoLicenceManager extends ConstantManager { + /** + * @deprecated use `addLicence` instead + */ addLicence: (licenceKey: number, licenceLabel: string) => boolean + /** + * @deprecated use `deleteLicence` instead + */ deleteLicence: (licenceKey: number) => boolean } diff --git a/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts index 7717115e3..e26e48a53 100644 --- a/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts +++ b/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts @@ -1,9 +1,13 @@ import { VideoPrivacy } from '../../../videos/video-privacy.enum' +import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' -export interface PluginVideoPrivacyManager { - // PUBLIC = 1 - // UNLISTED = 2 - // PRIVATE = 3 - // INTERNAL = 4 +export interface PluginVideoPrivacyManager extends ConstantManager { + /** + * PUBLIC = 1, + * UNLISTED = 2, + * PRIVATE = 3 + * INTERNAL = 4 + * @deprecated use `deleteConstant` instead + */ deletePrivacy: (privacyKey: VideoPrivacy) => boolean } -- cgit v1.2.3