Added deleteMedia to the media controller
This commit is contained in:
parent
4afba19ee9
commit
99b6102847
@ -28,4 +28,13 @@ export const getMediaObject = (assetId: string) => Media.findOne({assetId});
|
||||
* @param assetId The id of the asset to pipe
|
||||
* @param res The express response controller
|
||||
*/
|
||||
export const pipeMedia = (assetId: string, res: Response) => bucket.file(assetId).createReadStream().pipe(res);
|
||||
export const pipeMedia = (assetId: string, res: Response) => bucket.file(assetId).createReadStream().pipe(res);
|
||||
|
||||
/**
|
||||
* Deletes the provided asset from the database & bucket
|
||||
* @param assetId The id of the asset to delete
|
||||
*/
|
||||
export const deleteMedia = async (assetId: string) => {
|
||||
await Media.deleteOne({assetId});
|
||||
await bucket.file(assetId).delete();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user