Skip to content

Commit 10fbe35

Browse files
committed
fix build errors
1 parent 20010d3 commit 10fbe35

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

packages/backend/src/auth/auth.routes.config.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,16 @@ export class AuthRoutes extends CommonRoutesConfig {
1818
/**
1919
* Checks whether user's google access token is still valid
2020
*/
21-
this.app.route(`/api/auth/google`).get([
22-
verifySession(),
23-
//@ts-expect-error res.promise is not returning response types correctly
24-
authController.verifyGToken,
25-
]);
21+
this.app
22+
.route(`/api/auth/google`)
23+
.get([verifySession(), authController.verifyGToken]);
2624

2725
this.app
2826
.route(`/api/auth/session`)
2927
.all(authMiddleware.verifyIsDev)
30-
//@ts-expect-error res.promise is not returning response types correctly
3128
// eslint-disable-next-line @typescript-eslint/no-misused-promises
3229
.post(authController.createSession)
33-
.get([
34-
verifySession(),
35-
//@ts-expect-error res.promise is not returning response types correctly
36-
authController.getUserIdFromSession,
37-
]);
30+
.get([verifySession(), authController.getUserIdFromSession]);
3831

3932
this.app
4033
.route(`/api/auth/session/revoke`)
@@ -44,11 +37,12 @@ export class AuthRoutes extends CommonRoutesConfig {
4437
/**
4538
* Google calls this route after successful oauth
4639
*/
47-
this.app.route(`/api/oauth/google`).post([
48-
authMiddleware.verifyGoogleOauthCode,
49-
//@ts-expect-error res.promise is not returning response types correctly
50-
authController.loginOrSignup,
51-
]);
40+
this.app
41+
.route(`/api/oauth/google`)
42+
.post([
43+
authMiddleware.verifyGoogleOauthCode,
44+
authController.loginOrSignup,
45+
]);
5246

5347
return this.app;
5448
}

packages/backend/src/common/middleware/promise.middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const requestMiddleware = () => {
3030
res: Res_Promise,
3131
next: express.NextFunction,
3232
) => {
33-
res.promise = (p: Promise<any> | SyncFunction) => {
33+
res.promise = (p: Promise<any> | SyncFunction | unknown) => {
3434
let toResolve: Promise<unknown> | (() => any);
3535

3636
if (p instanceof Promise) {
@@ -41,9 +41,11 @@ export const requestMiddleware = () => {
4141
toResolve = Promise.resolve(p);
4242
}
4343

44-
return toResolve
44+
toResolve
4545
.then((data) => sendResponse(res, data as D))
4646
.catch((e) => handleExpressError(res, e));
47+
48+
return res;
4749
};
4850

4951
return next();

0 commit comments

Comments
 (0)