This commit is contained in:
eneller committed 2026-03-06 19:22:29 +01:00
1 parent 0dabdaa136
commit a618ce5e1e
8 files changed
+26 -26

No files matched your search

+9 -10
View File
@@ -1,17 +1,16 @@
import express from 'express';
import { Transaction } from "@shared/interfaces/transaction"
import Transaction from '../model/transaction';
const router = express.Router();
// Mock data
const mockTransactions: Transaction[] = [
{ id: '1', partner: 'Alice Smith', amount: 50.00, date: new Date('2026-03-01'), type: 'Received' },
{ id: '2', partner: 'Bob Johnson', amount: -25.50, date: new Date('2026-02-28'), type: 'Sent' },
];
// GET /api/transactions
router.get('/', (req, res) => {
res.json(mockTransactions);
router.get('/', async (req, res) => {
try {
const transactions = await Transaction.findAll({ limit: 10 });
res.json(transactions);
} catch (err) {
console.error('Failed to fetch transactions:', err);
res.status(500).json({ error: 'Failed to fetch transactions' });
}
});
export default router;