From fb2b86539208048edeefda137eb2cd369ef7b79b Mon Sep 17 00:00:00 2001 From: Mitko Nikov Date: Mon, 12 Feb 2024 21:52:32 +0100 Subject: [PATCH] Hide unnecessary information of resources and bulk enable crop. --- backend/src/resources/files.ts | 16 +++++++++++++++ backend/src/resources/playlists.ts | 8 ++++++++ backend/src/resources/site.ts | 8 ++++++++ backend/src/resources/thumbnail.ts | 31 ++++++++++++++++++++++++++++++ backend/src/resources/trailer.ts | 8 ++++++++ 5 files changed, 71 insertions(+) diff --git a/backend/src/resources/files.ts b/backend/src/resources/files.ts index 2b384d3..b0a68b5 100644 --- a/backend/src/resources/files.ts +++ b/backend/src/resources/files.ts @@ -8,6 +8,14 @@ export const files = { resource: File, options: { properties: { + _id: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, link: { type: 'string', }, @@ -24,6 +32,14 @@ export const files = { type: 'reference', reference: 'Playlist', }, + filepath: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, }, }, features: [ diff --git a/backend/src/resources/playlists.ts b/backend/src/resources/playlists.ts index 6bc9b64..5872bfe 100644 --- a/backend/src/resources/playlists.ts +++ b/backend/src/resources/playlists.ts @@ -4,6 +4,14 @@ export const playlists = { resource: Playlist, options: { properties: { + _id: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, name: { type: 'string', }, diff --git a/backend/src/resources/site.ts b/backend/src/resources/site.ts index 1140f28..220f55b 100644 --- a/backend/src/resources/site.ts +++ b/backend/src/resources/site.ts @@ -4,6 +4,14 @@ export const sites = { resource: Site, options: { properties: { + _id: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, name: { type: 'string', }, diff --git a/backend/src/resources/thumbnail.ts b/backend/src/resources/thumbnail.ts index cfa56ce..ecaff3c 100644 --- a/backend/src/resources/thumbnail.ts +++ b/backend/src/resources/thumbnail.ts @@ -8,9 +8,40 @@ export const thumbnails = { resource: Thumbnail, options: { properties: { + _id: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, crop: { type: 'boolean', }, + filepath: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, + }, + actions: { + EnableCrop: { + actionType: 'bulk', + component: false, + handler: (request, response, context) => { + const { records, currentAdmin } = context; + // eslint-disable-next-line no-restricted-syntax, prefer-const + for (let record of records) { + const recordId = record.params._id as number; + Thumbnail.findByIdAndUpdate(recordId, { crop: true }).exec(); + } + return { records }; + }, + }, }, }, features: [ diff --git a/backend/src/resources/trailer.ts b/backend/src/resources/trailer.ts index 82e0077..a0c0ce2 100644 --- a/backend/src/resources/trailer.ts +++ b/backend/src/resources/trailer.ts @@ -8,6 +8,14 @@ export const trailers = { resource: Trailer, options: { properties: { + _id: { + isVisible: { + list: false, + filter: false, + show: true, + edit: false, + }, + }, visible: { type: 'boolean', },