fixes
parent
4620fd41f6
commit
f1a28fa171
|
@ -202,7 +202,7 @@ export default class Internal extends Route {
|
||||||
|
|
||||||
this.router.get('/id', async (req, res) => {
|
this.router.get('/id', async (req, res) => {
|
||||||
try {
|
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?.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.pin) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
|
if (!req.query.pin) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
|
||||||
const args = req.query.pin.toString();
|
const args = req.query.pin.toString();
|
||||||
const user = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec();
|
const user = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec();
|
||||||
|
@ -215,7 +215,7 @@ export default class Internal extends Route {
|
||||||
|
|
||||||
this.router.get('/pin', async (req, res) => {
|
this.router.get('/pin', async (req, res) => {
|
||||||
try {
|
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?.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 });
|
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() });
|
const report = await this.server.client.db.Score.findOne({ userID: req.query.id.toString() });
|
||||||
|
|
Loading…
Reference in New Issue