Browse Source

bugfix & cleanup

tsMigration
Nareshkumar Rao 3 years ago
parent
commit
06a3f97ee7
  1. 12
      .eslintrc.js
  2. 2
      src/db/utils.ts
  3. 4
      src/routes/CodeRoute.ts
  4. 4
      src/routes/VerifyRoute.ts

12
.eslintrc.js

@ -1,12 +0,0 @@
module.exports = {
env: {
node: true,
commonjs: true,
es2021: true,
},
extends: "eslint:recommended",
parserOptions: {
ecmaVersion: 12,
},
rules: {},
};

2
src/db/utils.ts

@ -9,7 +9,7 @@ export function addContact(
): void { ): void {
User.findOne({ where: { telegram: userATelegram } }).then((userA) => { User.findOne({ where: { telegram: userATelegram } }).then((userA) => {
User.findOne({ where: { id: userBRowID } }).then((userB) => { User.findOne({ where: { id: userBRowID } }).then((userB) => {
if (!!userA || !!userB) {
if (!userA || !userB) {
done(false, "Could not find user."); done(false, "Could not find user.");
return; return;
} }

4
src/routes/CodeRoute.ts

@ -21,7 +21,7 @@ export function CodeRoute(req: Request, res: Response) {
function createQRCode( function createQRCode(
telegram: TelegramID, telegram: TelegramID,
callback: (errorMessage: string, url?: string) => void
callback: (errorMessage: string | Error, url?: string) => void
): void { ): void {
User.findOne({ User.findOne({
where: { where: {
@ -38,7 +38,7 @@ function createQRCode(
verifyURL, verifyURL,
{ width: 300, height: 300 } as QRCodeToDataURLOptions, { width: 300, height: 300 } as QRCodeToDataURLOptions,
(error, url) => { (error, url) => {
callback(error.message, url);
callback(error, url);
} }
); );
}); });

4
src/routes/VerifyRoute.ts

@ -45,6 +45,4 @@ function checkVerification(
callback(false, "No such verification"); callback(false, "No such verification");
} }
}); });
}
exports.VerifyRoute = VerifyRoute;
}
Loading…
Cancel
Save