Skip to content

Commit 258a694

Browse files
committed
Fix: Explicitly type Express route handlers in locationProof.ts to resolve TS2769
1 parent a72d38a commit 258a694

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

src/backend/routes/locationProof.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,38 @@ router.post(
4141
'/create',
4242
authenticateJWT,
4343
validateRequest(createProofSchema),
44-
locationProofController.createProof
44+
async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
45+
try {
46+
await locationProofController.createProof(req, res, next);
47+
} catch (error) {
48+
next(error);
49+
}
50+
}
4551
);
4652

4753
router.get(
48-
'/user',
54+
'/user',
4955
authenticateJWT,
50-
locationProofController.getProofsByUser
56+
async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
57+
try {
58+
await locationProofController.getProofsByUser(req, res, next);
59+
} catch (error) {
60+
next(error);
61+
}
62+
}
5163
);
5264

5365
router.post(
54-
'/nearby',
66+
'/nearby',
5567
authenticateJWT,
5668
validateRequest(nearbyProofsSchema),
57-
locationProofController.findValidProofsNearby
69+
async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
70+
try {
71+
await locationProofController.findValidProofsNearby(req, res, next);
72+
} catch (error) {
73+
next(error);
74+
}
75+
}
5876
);
5977

6078
export default router;

0 commit comments

Comments
 (0)