Passed
Push — main ( fcca7c...55cb12 )
by Julia
43s queued 16s
created

server/routes/v1/admin/users.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 84
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 15
mnd 0
bc 0
fnc 6
dl 0
loc 84
bpm 0
cpm 1
noi 18
c 0
b 0
f 0
rs 10
1
import express from "express";
2
// import some model from some file
3
4
const router = express.Router();
5
6
/**
7
 * @description Route for getting all users
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("/", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
16
    // code here for getting all users
17
});
18
19
/**
20
 * @description Route for getting all users using pagination
21
 *
22
 * @param {express.Request} req Request object
23
 * @param {express.Response} res Response object
24
 * @param {express.NextFunction} next Next function
25
 *
26
 * @returns {void}
27
 */
28
router.get("/limit/:limit/offset/:offset", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
29
    // code here for getting all users using pagination
30
});
31
32
/**
33
 * @description Route for searching for a user
34
 *
35
 * @param {express.Request} req Request object
36
 * @param {express.Response} res Response object
37
 * @param {express.NextFunction} next Next function
38
 *
39
 * @returns {void}
40
 */
41
router.get("/search/:search", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
42
    // code here for searching for a user
43
});
44
45
/**
46
 * @description Route for getting one user
47
 *
48
 * @param {express.Request} req Request object
49
 * @param {express.Response} res Response object
50
 * @param {express.NextFunction} next Next function
51
 *
52
 * @returns {void}
53
 */
54
router.get("/:id", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
55
    // code here for getting one user
56
});
57
58
/**
59
 * @description Route for billing users with negative balance
60
 *
61
 * @param {express.Request} req Request object
62
 * @param {express.Response} res Response object
63
 * @param {express.NextFunction} next Next function
64
 *
65
 * @returns {void}
66
 */
67
router.post("/invoice", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
68
    // code here for billing users with negative balance
69
});
70
71
/**
72
 * @description Route for updating a user
73
 *
74
 * @param {express.Request} req Request object
75
 * @param {express.Response} res Response object
76
 * @param {express.NextFunction} next Next function
77
 *
78
 * @returns {void}
79
 */
80
router.put("/", (req, res, next) => {
0 ignored issues
show
Unused Code introduced by
The parameter res is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter req is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
81
    // code here for updating a user
82
});
83
84
export default router;
85