From edf7f6c25adea5b5b0a886703ced90294f7dcb60 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Fri, 9 Sep 2022 15:51:19 +0200 Subject: [PATCH] Added the getMediaById method to the media controller --- controller/media.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/controller/media.ts b/controller/media.ts index 2d9d98f..0bb9ba6 100644 --- a/controller/media.ts +++ b/controller/media.ts @@ -12,7 +12,13 @@ export const createMedia = (clientId: number, assetName: string, assetEnding: st Media.create({clientId, assetName, assetEnding: assetEnding || "txt"}); /** - * Gets a media object by the asset id + * Gets a media object from an id + * @param assetId The id of the asset to search + */ +export const getMediaById = (assetId: string) => Media.findOne({assetId}, {_id: 0, __v: 0}); + +/** + * Gets a complete media object by the asset id * @param assetId The id of the asset to search */ export const getMediaObject = (assetId: string) => Media.findOne({assetId});