mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-18 02:31:19 +10:00
feat: file uploads on news articles
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { triggerAsyncId } from "async_hooks";
|
||||
import prisma from "../db/database";
|
||||
import objectHandler from "../objects";
|
||||
|
||||
class NewsManager {
|
||||
async create(data: {
|
||||
@ -115,9 +116,13 @@ class NewsManager {
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
return await prisma.article.delete({
|
||||
const article = await prisma.article.delete({
|
||||
where: { id },
|
||||
});
|
||||
if (article.image) {
|
||||
return await objectHandler.delete(article.image);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user