remove unnecessary report api fields
All checks were successful
delpoy / build-and-deploy (push) Successful in 45s

This commit is contained in:
bytedream 2024-11-27 22:29:41 +01:00
parent 0be3c31b51
commit 676bfc23d8

View File

@ -15,17 +15,10 @@ export const GET = async ({ url }) => {
const reports = {
from_self: await Report.findAll({
where: { reporter_id: user.id },
include: [
{ model: User, as: 'reporter' },
{ model: User, as: 'reported' }
]
include: [{ model: User, as: 'reported' }]
}).then((reports) =>
reports.map((report) => {
return {
reporter: {
username: report.reporter.username,
uuid: report.reporter.uuid
},
reported: report.reported
? {
username: report.reported.username,
@ -41,10 +34,7 @@ export const GET = async ({ url }) => {
),
to_self: await Report.findAll({
where: { reported_id: user.id },
include: [
{ model: User, as: 'reporter' },
{ model: User, as: 'reported' }
]
include: [{ model: User, as: 'reporter' }]
}).then((reports) =>
reports.map((report) => {
return {
@ -52,10 +42,6 @@ export const GET = async ({ url }) => {
username: report.reporter.username,
uuid: report.reporter.uuid
},
reported: {
username: report.reported.username,
uuid: report.reported.uuid
},
subject: report.subject,
draft: report.draft,
status: report.status,