transparency stuff
This commit is contained in:
parent
35abc04c72
commit
a65fc7df7f
|
@ -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)
|
||||
}
|
|
@ -27,7 +27,8 @@ exports.getVideo = async (req, res) => {
|
|||
channelId: true,
|
||||
channelAvatar: true,
|
||||
channelVerified: true,
|
||||
disabled: true
|
||||
disabled: true,
|
||||
hasBeenReported: true
|
||||
}
|
||||
})
|
||||
|
||||
|
|
2
index.js
2
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)
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue