Added the getMediaById method to the media controller

This commit is contained in:
Mathias Wagner 2022-09-09 15:51:19 +02:00
parent fee00cc143
commit edf7f6c25a
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -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});