Completed
Push — master ( 6f490e...0d0103 )
by Emil
03:39
created

v2/route/invoices.js   A

Complexity

Total Complexity 8
Complexity/F 1

Size

Lines of Code 26
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
eloc 19
mnd 0
bc 0
fnc 8
dl 0
loc 26
ccs 17
cts 17
cp 1
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1 1
const express = require('express');
2 1
const router = express.Router();
3
4 1
const invoices = require("../models/invoices.js");
5 1
const auth = require("../models/auth.js");
6
7 1
router.get("/",
8 3
    (req, res, next) => auth.checkToken(req, res, next),
9 2
    (req, res) => invoices.getInvoices(res, req.query.api_key));
10
11 1
router.get("/:invoice_id",
12 6
    (req, res, next) => auth.checkToken(req, res, next),
13 5
    (req, res) => invoices.getInvoice(res,
14
        req.query.api_key,
15
        req.params.invoice_id));
16
17 1
router.post("/",
18 7
    (req, res, next) => auth.checkToken(req, res, next),
19 6
    (req, res) => invoices.addInvoice(res, req.body));
20
21 1
router.put("/",
22 1
    (req, res, next) => auth.checkToken(req, res, next),
23 1
    (req, res) => invoices.updateInvoice(res, req.body));
24
25 1
router.delete("/",
26 1
    (req, res, next) => auth.checkToken(req, res, next),
27 1
    (req, res) => invoices.deleteInvoice(res, req.body));
28
29
module.exports = router;
30