From a65fc7df7fc43d1679d08667ccf0eda2f0af668e Mon Sep 17 00:00:00 2001 From: localhost Date: Fri, 15 Mar 2024 18:11:12 +0100 Subject: [PATCH] transparency stuff --- controller/transparency.js | 17 +++-------------- controller/video.js | 3 ++- index.js | 2 +- prisma/schema.prisma | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/controller/transparency.js b/controller/transparency.js index 554f038..2b581fa 100644 --- a/controller/transparency.js +++ b/controller/transparency.js @@ -22,22 +22,11 @@ exports.getReports = async (req, res) => { res.json(json) } -exports.getReport = async (req, res) => { - const data = await prisma.reports.findFirst({ +exports.getReports = async (req, res) => { + const reports = await prisma.reports.findMany({ where: { target: req.params.id } }) - - if (!data) { - res.json({ - error: '404' - }) - } else { - res.json({ - ...data, - details: (data.details).split('<').join('<').split('>').join('>'), - date: (data.date).toISOString().slice(0,10) - }) - } + res.json(reports) } \ No newline at end of file diff --git a/controller/video.js b/controller/video.js index e735ffe..a6de528 100644 --- a/controller/video.js +++ b/controller/video.js @@ -27,7 +27,8 @@ exports.getVideo = async (req, res) => { channelId: true, channelAvatar: true, channelVerified: true, - disabled: true + disabled: true, + hasBeenReported: true } }) diff --git a/index.js b/index.js index e29fe1f..64340a5 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ app.get('/search/playlist', searchController.searchPlaylist) app.get('/search/channel', searchController.searchChannel) app.get('/transparency/list', transparencyController.getReports) -app.get('/transparency/:id', transparencyController.getReport) +app.get('/transparency/:id', transparencyController.getReports) app.ws('/save', websocketController.save) app.ws('/saveplaylist', websocketController.playlist) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index df155d2..3276758 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -25,6 +25,7 @@ model videos { channelAvatar String playlist String? disabled Boolean @default(false) + hasBeenReported Boolean @default(false) @@index([title], name: "idx_title") } @@ -32,7 +33,6 @@ model videos { model reports { uuid String @id @default(uuid()) target String - url String title String details String date DateTime @default(now())