1
0
Fork 0
refactor/models
Matthew 2020-09-14 02:33:43 -04:00
parent 7dc57d6c7b
commit c0c56197e9
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 3 additions and 3 deletions

View File

@ -36,8 +36,8 @@ export default class Webhook extends Route {
if (!req.query?.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR }); if (!req.query?.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
const account = await this.server.client.db.Account.findOne({ userID: req.query.id.toString() }).lean().exec(); const account = await this.server.client.db.Account.findOne({ userID: req.query.id.toString() }).lean().exec();
if (!account) return res.status(200).send({ found: false });
const moderations = await this.server.client.db.Moderation.find({ userID: req.query.id.toString() }).lean().exec(); const moderations = await this.server.client.db.Moderation.find({ userID: req.query.id.toString() }).lean().exec();
if (!account && (!moderations || moderations.length <= 0)) return res.status(200).send({ found: false });
const response: { const response: {
found: boolean, found: boolean,
@ -49,9 +49,9 @@ export default class Webhook extends Route {
deletes?: Date[], deletes?: Date[],
} = { } = {
found: true, found: true,
tier: account.tier, tier: account?.tier || 0,
totalReferrals: 0, totalReferrals: 0,
createdAt: account.createdAt, createdAt: account?.createdAt || null,
warns: [], warns: [],
locks: [], locks: [],
deletes: [], deletes: [],