transparency stuff

This commit is contained in:
localhost 2024-03-15 18:11:12 +01:00
parent 35abc04c72
commit a65fc7df7f
4 changed files with 7 additions and 17 deletions

View File

@ -22,22 +22,11 @@ exports.getReports = async (req, res) => {
res.json(json) res.json(json)
} }
exports.getReport = async (req, res) => { exports.getReports = async (req, res) => {
const data = await prisma.reports.findFirst({ const reports = await prisma.reports.findMany({
where: { where: {
target: req.params.id target: req.params.id
} }
}) })
res.json(reports)
if (!data) {
res.json({
error: '404'
})
} else {
res.json({
...data,
details: (data.details).split('<').join('&lt;').split('>').join('&gt;'),
date: (data.date).toISOString().slice(0,10)
})
}
} }

View File

@ -27,7 +27,8 @@ exports.getVideo = async (req, res) => {
channelId: true, channelId: true,
channelAvatar: true, channelAvatar: true,
channelVerified: true, channelVerified: true,
disabled: true disabled: true,
hasBeenReported: true
} }
}) })

View File

@ -27,7 +27,7 @@ app.get('/search/playlist', searchController.searchPlaylist)
app.get('/search/channel', searchController.searchChannel) app.get('/search/channel', searchController.searchChannel)
app.get('/transparency/list', transparencyController.getReports) 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('/save', websocketController.save)
app.ws('/saveplaylist', websocketController.playlist) app.ws('/saveplaylist', websocketController.playlist)

View File

@ -25,6 +25,7 @@ model videos {
channelAvatar String channelAvatar String
playlist String? playlist String?
disabled Boolean @default(false) disabled Boolean @default(false)
hasBeenReported Boolean @default(false)
@@index([title], name: "idx_title") @@index([title], name: "idx_title")
} }
@ -32,7 +33,6 @@ model videos {
model reports { model reports {
uuid String @id @default(uuid()) uuid String @id @default(uuid())
target String target String
url String
title String title String
details String details String
date DateTime @default(now()) date DateTime @default(now())