master
Matthew 2021-07-02 23:34:06 -04:00
parent 14a2a173e7
commit 95543ff1a2
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 2 additions and 8 deletions

View File

@ -24,20 +24,14 @@ export default class Keys extends Route {
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec(); const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
const member = this.mainGuild.members.get(req.params.userID); const member = this.mainGuild.members.get(req.params.userID);
if (!member || !memberDoc || !memberDoc?.x509) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND }); if (!member || !memberDoc || !memberDoc?.x509) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
return res.status(200).json({ return res.status(200).send(memberDoc.x509);
code: this.constants.codes.SUCCESS,
message: memberDoc.x509,
});
}); });
this.router.get('/pgp/:userID', async (req, res) => { this.router.get('/pgp/:userID', async (req, res) => {
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec(); const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
const member = this.mainGuild.members.get(req.params.userID); const member = this.mainGuild.members.get(req.params.userID);
if (!member || !memberDoc || !memberDoc?.pgp) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND }); if (!member || !memberDoc || !memberDoc?.pgp) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
return res.status(200).json({ return res.status(200).send(memberDoc.pgp);
code: this.constants.codes.SUCCESS,
message: memberDoc.pgp,
});
}); });
} }
} }