feat: frontend send

This commit is contained in:
eneller
2026-03-18 15:30:19 +01:00
parent 7f3326c4a5
commit 76ccd88c67
8 changed files with 46 additions and 12 deletions

View File

@@ -0,0 +1,9 @@
export class LoginRequest{
constructor(
username: string,
password: string
){}
}
export class LoginResponse{
constructor(){}
}

View File

@@ -2,6 +2,9 @@ import express from 'express';
import { logger } from '../util/logging';
import User from '../model/user';
import { getJWT, requireAuth } from '../util/auth';
import { LoginRequest } from '@message/Login';
import { SendRequest, SendResponse } from '@message/Send';
const router = express.Router();
@@ -26,7 +29,7 @@ router.post('/login', async (req, res) => {
res.json({ message: 'Logged in successfully' });
}catch (err) {
logger.error('Failed to authenticate:', err);
res.status(500).json({ error: 'Failed to authenticate' });
res.status(500).json({ message: 'Failed to authenticate' });
}
});

View File

@@ -7,7 +7,10 @@ const router = express.Router();
router.get('/', requireAuth, async (req, res) => {
try {
const transactions = await Transaction.findAll({ limit: 10 });
const transactions = await Transaction.findAll({
limit: 100,
order: [['date', 'DESC']]
});
res.json(transactions);
} catch (err) {
logger.error('Failed to fetch transactions:', err);