1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
const express = require("express");
const router = express.Router();
const transactionsController = require("../controllers/transactions.controller");
router.get("/agriculture", (req, res) => {
const limit = parseInt(req.query.limit, 10) || 100;
const page = req.query.page ? (req.query.page - 1) * limit : 0;
Promise.all([
transactionsController.getAgricultureTransactions(limit, page),
transactionsController.getAgricultureTransactionsCount(),
]).then((results) => {
const [transactions, count] = results;
res.render("agriculture", {
title: "Agriculture Transactions",
transactions,
count: count[0].count,
});
});
});
router.get("/hospital", (req, res) => {
const limit = parseInt(req.query.limit, 10) || 100;
const page = req.query.page ? (req.query.page - 1) * limit : 0;
Promise.all([
transactionsController.getHospitalTransactions(limit, page),
transactionsController.getHospitalTransactionsCount(),
]).then((results) => {
const [transactions, count] = results;
res.render("hospital", {
title: "Hospital Transactions",
transactions,
count: count[0].count,
});
});
});
router.get("/lpg", (req, res) => {
const limit = parseInt(req.query.limit, 10) || 100;
const page = req.query.page ? (req.query.page - 1) * limit : 0;
Promise.all([
transactionsController.getLPGTransactions(limit, page),
transactionsController.getLPGTransactionsCount(),
]).then((results) => {
const [transactions, count] = results;
res.render("lpg", {
title: "LPG Transactions",
transactions,
count: count[0].count,
});
});
});
router.get("/nregs", (req, res) => {
const limit = parseInt(req.query.limit, 10) || 100;
const page = req.query.page ? (req.query.page - 1) * limit : 0;
Promise.all([
transactionsController.getNREGSTransactions(limit, page),
transactionsController.getNREGSTransactionsCount(),
]).then((results) => {
const [transactions, count] = results;
res.render("nregs", {
title: "NREGS Transactions",
transactions,
count: count[0].count,
});
});
});
router.get("/pension", (req, res) => {
const limit = parseInt(req.query.limit, 10) || 100;
const page = req.query.page ? (req.query.page - 1) * limit : 0;
Promise.all([
transactionsController.getPensionTransactions(limit, page),
transactionsController.getPensionTransactionsCount(),
]).then((results) => {
const [transactions, count] = results;
res.render("pension", {
title: "Pension Transactions",
transactions,
count: count[0].count,
});
});
});
module.exports = router;
|