add /cash ui
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user