diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:45:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:45:42 +0200 |
commit | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (patch) | |
tree | 64021f952b125ae3d152c07180804fd13adfeb48 /shared/models | |
parent | 435990290a61ca6fdb679e6b076ef9157b89a6ce (diff) | |
parent | 2b9f672b58bc2c13c96ee79f522003979e4bfc02 (diff) | |
download | PeerTube-5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565.tar.gz PeerTube-5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565.tar.zst PeerTube-5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565.zip |
Merge branch 'constant-registry' into develop
Diffstat (limited to 'shared/models')
6 files changed, 51 insertions, 12 deletions
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 @@ | |||
1 | import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model' | 1 | import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model' |
2 | import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' | ||
2 | 3 | ||
3 | export interface PluginPlaylistPrivacyManager { | 4 | export interface PluginPlaylistPrivacyManager extends ConstantManager<VideoPlaylistPrivacy> { |
4 | // PUBLIC = 1, | 5 | /** |
5 | // UNLISTED = 2, | 6 | * PUBLIC = 1, |
6 | // PRIVATE = 3 | 7 | * UNLISTED = 2, |
8 | * PRIVATE = 3 | ||
9 | * @deprecated use `deleteConstant` instead | ||
10 | */ | ||
7 | deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacy) => boolean | 11 | deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacy) => boolean |
8 | } | 12 | } |
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 @@ | |||
1 | export interface PluginVideoCategoryManager { | 1 | import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' |
2 | |||
3 | export interface PluginVideoCategoryManager extends ConstantManager<number> { | ||
4 | /** | ||
5 | * @deprecated use `addConstant` instead | ||
6 | */ | ||
2 | addCategory: (categoryKey: number, categoryLabel: string) => boolean | 7 | addCategory: (categoryKey: number, categoryLabel: string) => boolean |
3 | 8 | ||
9 | /** | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
4 | deleteCategory: (categoryKey: number) => boolean | 12 | deleteCategory: (categoryKey: number) => boolean |
5 | } | 13 | } |
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 @@ | |||
1 | export interface PluginVideoLanguageManager { | 1 | import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' |
2 | |||
3 | export interface PluginVideoLanguageManager extends ConstantManager<string> { | ||
4 | /** | ||
5 | * @deprecated use `addConstant` instead | ||
6 | */ | ||
2 | addLanguage: (languageKey: string, languageLabel: string) => boolean | 7 | addLanguage: (languageKey: string, languageLabel: string) => boolean |
3 | 8 | ||
9 | /** | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
4 | deleteLanguage: (languageKey: string) => boolean | 12 | deleteLanguage: (languageKey: string) => boolean |
5 | } | 13 | } |
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 @@ | |||
1 | export interface PluginVideoLicenceManager { | 1 | import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' |
2 | |||
3 | export interface PluginVideoLicenceManager extends ConstantManager<number> { | ||
4 | /** | ||
5 | * @deprecated use `addLicence` instead | ||
6 | */ | ||
2 | addLicence: (licenceKey: number, licenceLabel: string) => boolean | 7 | addLicence: (licenceKey: number, licenceLabel: string) => boolean |
3 | 8 | ||
9 | /** | ||
10 | * @deprecated use `deleteLicence` instead | ||
11 | */ | ||
4 | deleteLicence: (licenceKey: number) => boolean | 12 | deleteLicence: (licenceKey: number) => boolean |
5 | } | 13 | } |
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 @@ | |||
1 | import { VideoPrivacy } from '../../../videos/video-privacy.enum' | 1 | import { VideoPrivacy } from '../../../videos/video-privacy.enum' |
2 | import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model' | ||
2 | 3 | ||
3 | export interface PluginVideoPrivacyManager { | 4 | export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacy> { |
4 | // PUBLIC = 1 | 5 | /** |
5 | // UNLISTED = 2 | 6 | * PUBLIC = 1, |
6 | // PRIVATE = 3 | 7 | * UNLISTED = 2, |
7 | // INTERNAL = 4 | 8 | * PRIVATE = 3 |
9 | * INTERNAL = 4 | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
8 | deletePrivacy: (privacyKey: VideoPrivacy) => boolean | 12 | deletePrivacy: (privacyKey: VideoPrivacy) => boolean |
9 | } | 13 | } |
diff --git a/shared/models/plugins/server/plugin-constant-manager.model.ts b/shared/models/plugins/server/plugin-constant-manager.model.ts new file mode 100644 index 000000000..4de3ce38f --- /dev/null +++ b/shared/models/plugins/server/plugin-constant-manager.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface ConstantManager <K extends string | number> { | ||
2 | addConstant: (key: K, label: string) => boolean | ||
3 | deleteConstant: (key: K) => boolean | ||
4 | getConstantValue: (key: K) => string | ||
5 | getConstants: () => Record<K, string> | ||
6 | resetConstants: () => void | ||
7 | } | ||