transparency stuff
This commit is contained in:
parent
35abc04c72
commit
a65fc7df7f
|
@ -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('<').split('>').join('>'),
|
|
||||||
date: (data.date).toISOString().slice(0,10)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
2
index.js
2
index.js
|
@ -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)
|
||||||
|
|
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue