add historical data to score reports

pull/29/head
Matthew 2020-11-01 19:47:41 -05:00
parent 03ae4d8e61
commit 9ec5e00e89
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 3 additions and 0 deletions

View File

@ -470,6 +470,8 @@ export default class Report extends Route {
const moderations = await this.server.client.db.Moderation.find({ userID: score.userID }); 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({ return res.status(200).json({
name: `${member.username}#${member.discriminator}`, name: `${member.username}#${member.discriminator}`,
@ -487,6 +489,7 @@ export default class Report extends Route {
totalModerations: moderations?.length > 0 ? moderations.length : 0, totalModerations: moderations?.length > 0 ? moderations.length : 0,
inquiries: score.inquiries?.length > 0 ? score.inquiries : [], inquiries: score.inquiries?.length > 0 ? score.inquiries : [],
softInquiries: score.softInquiries?.length > 0 ? score.softInquiries : [], softInquiries: score.softInquiries?.length > 0 ? score.softInquiries : [],
historical: historical ?? [],
lastUpdated: score.lastUpdate, lastUpdated: score.lastUpdate,
}); });
} catch (err) { } catch (err) {