From 9ec5e00e89581e829b3f12c42e98ddcdd2c14f22 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sun, 1 Nov 2020 19:47:41 -0500 Subject: [PATCH] add historical data to score reports --- src/api/comm.libraryofcode.org/routes/report.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/comm.libraryofcode.org/routes/report.ts b/src/api/comm.libraryofcode.org/routes/report.ts index 818e59a..7cdcabe 100644 --- a/src/api/comm.libraryofcode.org/routes/report.ts +++ b/src/api/comm.libraryofcode.org/routes/report.ts @@ -470,6 +470,8 @@ export default class Report extends Route { const moderations = await this.server.client.db.Moderation.find({ userID: score.userID }); + const historical = await this.server.client.db.ScoreHistorical.find({ userID: score.userID }).lean().exec(); + return res.status(200).json({ name: `${member.username}#${member.discriminator}`, @@ -487,6 +489,7 @@ export default class Report extends Route { totalModerations: moderations?.length > 0 ? moderations.length : 0, inquiries: score.inquiries?.length > 0 ? score.inquiries : [], softInquiries: score.softInquiries?.length > 0 ? score.softInquiries : [], + historical: historical ?? [], lastUpdated: score.lastUpdate, }); } catch (err) {