feat: frontend send
This commit is contained in:
9
server/src/messages/Login.ts
Normal file
9
server/src/messages/Login.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class LoginRequest{
|
||||
constructor(
|
||||
username: string,
|
||||
password: string
|
||||
){}
|
||||
}
|
||||
export class LoginResponse{
|
||||
constructor(){}
|
||||
}
|
||||
@@ -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' });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user