Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 36 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import express from "express"; |
||
2 | import tripModel from "../../../src/models/trip.js"; |
||
3 | |||
4 | const router = express.Router(); |
||
5 | |||
6 | /** |
||
7 | * @description Route for trips for one user |
||
8 | * |
||
9 | * @param {express.Request} req Request object |
||
10 | * @param {express.Response} res Response object |
||
11 | * @param {express.NextFunction} next Next function |
||
12 | * |
||
13 | * @returns {void} |
||
14 | */ |
||
15 | router.get("/", async (req, res, next) => { |
||
16 | try { |
||
17 | const userId = req.body.user_id; |
||
18 | |||
19 | const trips = await tripModel.userTrips(userId); |
||
20 | |||
21 | res.status(200).json(trips); |
||
22 | } catch (error) { |
||
23 | next(error); |
||
24 | } |
||
25 | }); |
||
26 | |||
27 | /** |
||
28 | * @description Route for trips for one user using pagination |
||
29 | * |
||
30 | * @param {express.Request} req Request object |
||
31 | * @param {express.Response} res Response object |
||
32 | * @param {express.NextFunction} next Next function |
||
33 | * |
||
34 | * @returns {void} |
||
35 | */ |
||
36 | router.get("/limit/:limit/offset/:offset", async (req, res, next) => { |
||
37 | try { |
||
51 |