diff --git a/server/src/database/migrations/1733583643678-Collection_add_visibleOnRecommended_field.ts b/server/src/database/migrations/1733583643678-Collection_add_visibleOnRecommended_field.ts new file mode 100644 index 00000000..81c39682 --- /dev/null +++ b/server/src/database/migrations/1733583643678-Collection_add_visibleOnRecommended_field.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class CollectionAddVisibleOnRecommendedField1733583643678 + implements MigrationInterface +{ + name = 'CollectionAddVisibleOnRecommendedField1733583643678'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE collection ADD COLUMN "visibleOnRecommended" boolean NOT NULL DEFAULT (0)`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE collection DROP "visibleOnRecommended"`, + ); + } +} diff --git a/server/src/modules/collections/collections.service.ts b/server/src/modules/collections/collections.service.ts index ed6a7f05..b7b746e8 100644 --- a/server/src/modules/collections/collections.service.ts +++ b/server/src/modules/collections/collections.service.ts @@ -29,6 +29,7 @@ import { ECollectionLogType } from '../../modules/collections/entities/collectio interface addCollectionDbResponse { id: number; isActive: boolean; + visibleOnRecommended: boolean; visibleOnHome: boolean; deleteAfterDays: number; manualCollection: boolean; @@ -252,7 +253,7 @@ export class CollectionsService { await this.plexApi.UpdateCollectionSettings({ libraryId: collectionObj.libraryId, collectionId: plexCollection.ratingKey, - recommended: false, + recommended: collection.visibleOnRecommended, ownHome: collection.visibleOnHome, sharedHome: collection.visibleOnHome, }); @@ -267,7 +268,7 @@ export class CollectionsService { await this.plexApi.UpdateCollectionSettings({ libraryId: collection.libraryId, collectionId: plexCollection.ratingKey, - recommended: false, + recommended: collection.visibleOnRecommended, ownHome: collection.visibleOnHome, sharedHome: collection.visibleOnHome, }); @@ -360,7 +361,7 @@ export class CollectionsService { await this.plexApi.UpdateCollectionSettings({ libraryId: dbCollection.libraryId, collectionId: dbCollection.plexId, - recommended: false, + recommended: collection.visibleOnRecommended, ownHome: collection.visibleOnHome, sharedHome: collection.visibleOnHome, }); @@ -559,7 +560,7 @@ export class CollectionsService { await this.plexApi.UpdateCollectionSettings({ libraryId: collection.libraryId, collectionId: collection.plexId, - recommended: false, + recommended: collection.visibleOnRecommended, ownHome: collection.visibleOnHome, sharedHome: collection.visibleOnHome, }); @@ -918,6 +919,7 @@ export class CollectionsService { libraryId: collection.libraryId, arrAction: collection.arrAction ? collection.arrAction : 0, isActive: collection.isActive, + visibleOnRecommended: collection.visibleOnRecommended, visibleOnHome: collection.visibleOnHome, deleteAfterDays: collection.deleteAfterDays, listExclusions: collection.listExclusions, diff --git a/server/src/modules/collections/entities/collection.entities.ts b/server/src/modules/collections/entities/collection.entities.ts index 3779a900..95884093 100644 --- a/server/src/modules/collections/entities/collection.entities.ts +++ b/server/src/modules/collections/entities/collection.entities.ts @@ -38,6 +38,9 @@ export class Collection { @Column({ default: 0 }) arrAction: number; + @Column({ default: false }) + visibleOnRecommended: boolean; + @Column({ default: false }) visibleOnHome: boolean; diff --git a/server/src/modules/collections/interfaces/collection.interface.ts b/server/src/modules/collections/interfaces/collection.interface.ts index d7462460..fb54c373 100644 --- a/server/src/modules/collections/interfaces/collection.interface.ts +++ b/server/src/modules/collections/interfaces/collection.interface.ts @@ -10,6 +10,7 @@ export interface ICollection { description?: string; isActive: boolean; arrAction: number; + visibleOnRecommended?: boolean; visibleOnHome?: boolean; listExclusions?: boolean; forceOverseerr?: boolean; diff --git a/server/src/modules/rules/rules.service.ts b/server/src/modules/rules/rules.service.ts index f088e613..25ac6a63 100644 --- a/server/src/modules/rules/rules.service.ts +++ b/server/src/modules/rules/rules.service.ts @@ -238,6 +238,7 @@ export class RulesService { forceOverseerr: params.forceOverseerr ? params.forceOverseerr : false, tautulliWatchedPercentOverride: params.tautulliWatchedPercentOverride ?? null, + visibleOnRecommended: params.collection?.visibleOnRecommended, visibleOnHome: params.collection?.visibleOnHome, deleteAfterDays: +params.collection?.deleteAfterDays, manualCollection: params.collection?.manualCollection, @@ -365,6 +366,7 @@ export class RulesService { params.tautulliWatchedPercentOverride ?? null, radarrSettingsId: params.radarrSettingsId ?? null, sonarrSettingsId: params.sonarrSettingsId ?? null, + visibleOnRecommended: params.collection.visibleOnRecommended, visibleOnHome: params.collection.visibleOnHome, deleteAfterDays: +params.collection.deleteAfterDays, manualCollection: params.collection.manualCollection, diff --git a/ui/src/components/AddModal/interfaces.tsx b/ui/src/components/AddModal/interfaces.tsx index be4c0fa1..25ddcafa 100644 --- a/ui/src/components/AddModal/interfaces.tsx +++ b/ui/src/components/AddModal/interfaces.tsx @@ -18,6 +18,7 @@ export interface ICollectionMedia { description?: string isActive?: boolean arrAction?: number + visibleOnRecommended?: boolean visibleOnHome?: boolean deleteAfterDays?: number type?: EPlexDataType diff --git a/ui/src/components/Collection/index.tsx b/ui/src/components/Collection/index.tsx index b8bb0d9b..d48bd6f6 100644 --- a/ui/src/components/Collection/index.tsx +++ b/ui/src/components/Collection/index.tsx @@ -15,6 +15,7 @@ export interface ICollection { title: string description?: string isActive: boolean + visibleOnRecommended?: boolean visibleOnHome?: boolean deleteAfterDays?: number listExclusions?: boolean diff --git a/ui/src/components/Rules/RuleGroup/AddModal/index.tsx b/ui/src/components/Rules/RuleGroup/AddModal/index.tsx index 46f013ac..0023e0f7 100644 --- a/ui/src/components/Rules/RuleGroup/AddModal/index.tsx +++ b/ui/src/components/Rules/RuleGroup/AddModal/index.tsx @@ -51,6 +51,7 @@ interface ICreateApiObject { radarrSettingsId?: number sonarrSettingsId?: number collection: { + visibleOnRecommended: boolean visibleOnHome: boolean deleteAfterDays: number manualCollection?: boolean @@ -85,6 +86,7 @@ const AddModal = (props: AddModal) => { const keepLogsForMonthsRef = useRef() const tautulliWatchedPercentOverrideRef = useRef() const manualCollectionNameRef = useRef('My custom collection') + const [showRecommended, setShowRecommended] = useState(true) const [showHome, setShowHome] = useState(true) const [listExclusion, setListExclusion] = useState(true) const [forceOverseerr, setForceOverseerr] = useState(false) @@ -288,6 +290,7 @@ const AddModal = (props: AddModal) => { if (collection) { setCollection(collection) + setShowRecommended(collection.visibleOnRecommended!) setShowHome(collection.visibleOnHome!) setListExclusion(collection.listExclusions!) setForceOverseerr(collection.forceOverseerr!) @@ -347,6 +350,7 @@ const AddModal = (props: AddModal) => { radarrSettingsId: radarrSettingsId, sonarrSettingsId: sonarrSettingsId, collection: { + visibleOnRecommended: showRecommended, visibleOnHome: showHome, deleteAfterDays: +deleteAfterRef.current.value, manualCollection: manualCollection, @@ -692,6 +696,29 @@ const AddModal = (props: AddModal) => { +
+ +
+
+ { + setShowRecommended(!showRecommended) + }} + /> +
+
+
+