add /cash ui

This commit is contained in:
Nikola Petrov
2023-10-04 22:45:02 +02:00
parent 63346de8c1
commit cd169641af
4 changed files with 46 additions and 36 deletions

View File

@@ -3,11 +3,8 @@ module.exports = {
list: async function (req, res) {
try {
const transactions = await cashTransactionModel.find()
const data = {
messages: transactions
};
return res.render('cash', data);
const transactions = await cashTransactionModel.find({}, { _id: 0, __v: 0 });
return res.json(transactions);
} catch (err) {
return res.status(500).json({
message: 'Error when getting transactions.',
@@ -19,6 +16,8 @@ module.exports = {
create: async function (req, res) {
const rawString = req.body.messageBody;
if (rawString == "") return res.status(400).json({ message: "empty string" });
const transaction = new cashTransactionModel({
raw: rawString,
day: 0,