This commit is contained in:
eneller
2026-03-06 19:07:22 +01:00
parent 0dabdaa136
commit a618ce5e1e
8 changed files with 26 additions and 26 deletions

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;