fixes
parent
c34d193939
commit
329a4cce9c
|
@ -212,5 +212,18 @@ export default class Internal extends Route {
|
|||
return this.handleError(err, res);
|
||||
}
|
||||
});
|
||||
|
||||
this.router.get('/pin', async (req, res) => {
|
||||
try {
|
||||
if (req.query?.auth.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED });
|
||||
if (!req.query.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
|
||||
|
||||
const report = await this.server.client.db.Score.findOne({ userID: req.query.id.toString() });
|
||||
if (!report) return res.status(404).json({ code: this.constants.codes.ACCOUNT_NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
||||
return res.status(200).json({ pin: report.pin });
|
||||
} catch (err) {
|
||||
return this.handleError(err, res);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue