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)
}
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('&lt;').split('>').join('&gt;'),
date: (data.date).toISOString().slice(0,10)
})
}
res.json(reports)
}

View File

@ -27,7 +27,8 @@ exports.getVideo = async (req, res) => {
channelId: true,
channelAvatar: 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('/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)

View File

@ -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())