diff --git a/client/src/app/screens/screen-profile/screen-profile.html b/client/src/app/screens/screen-profile/screen-profile.html
index d3ca5c9..71197f5 100644
--- a/client/src/app/screens/screen-profile/screen-profile.html
+++ b/client/src/app/screens/screen-profile/screen-profile.html
@@ -27,7 +27,7 @@
-
{{ transaction.partner }}
+ {{ transaction.senderID }}
{{ transaction.date | date:'medium' }}
@@ -35,7 +35,6 @@
0" [class.text-danger]="transaction.amount < 0">
{{ transaction.amount | currency }}
- {{ transaction.type }}
diff --git a/client/src/app/screens/screen-profile/screen-profile.ts b/client/src/app/screens/screen-profile/screen-profile.ts
index d960249..07b5bff 100644
--- a/client/src/app/screens/screen-profile/screen-profile.ts
+++ b/client/src/app/screens/screen-profile/screen-profile.ts
@@ -1,7 +1,7 @@
import { CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { APIService } from '../../services/api';
-import { Transaction } from '@shared/interfaces/transaction';
+import Transaction from '@model/transaction';
@Component({
selector: 'app-screen-profile',
diff --git a/client/src/app/services/api.ts b/client/src/app/services/api.ts
index d46f016..db3121e 100644
--- a/client/src/app/services/api.ts
+++ b/client/src/app/services/api.ts
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
-import { Transaction } from '@shared/interfaces/transaction'
+import Transaction from '@model/transaction'
@Injectable({
providedIn: 'root',
diff --git a/server/compose.yml b/server/compose.yml
index 5ecb1e8..5965381 100644
--- a/server/compose.yml
+++ b/server/compose.yml
@@ -5,6 +5,8 @@ services:
POSTGRES_PASSWORD: pass
ports:
- "5432:5432"
+ volumes:
+ - ./.docker:/var/lib/postgresql
adminer:
image: adminer
diff --git a/server/src/model/transaction.ts b/server/src/model/transaction.ts
index 65866e0..5b5400e 100644
--- a/server/src/model/transaction.ts
+++ b/server/src/model/transaction.ts
@@ -4,22 +4,22 @@ import User from './user';
@Table
export default class Transaction extends Model{
@Column
- amount: number;
+ amount!: number;
@Column
@ForeignKey(()=> User)
- senderID: string;
+ senderID!: string;
@BelongsTo(() => User, 'senderID')
- sender: User;
+ sender!: User;
@Column
@ForeignKey(()=> User)
- receiverID: string;
+ receiverID!: string;
@BelongsTo(() => User, 'receiverID')
- receiver: User;
+ receiver!: User;
@CreatedAt
- creationDate: Date;
+ date!: Date;
}
\ No newline at end of file
diff --git a/server/src/model/user.ts b/server/src/model/user.ts
index 9922009..e5c7b5a 100644
--- a/server/src/model/user.ts
+++ b/server/src/model/user.ts
@@ -4,18 +4,18 @@ import { Table, Column, Model, CreatedAt, DataType} from 'sequelize-typescript';
export default class User extends Model{
@Column({primaryKey: true, unique: true, allowNull: false})
- userID: string;
+ userID!: string;
@Column
- displayName: string;
+ displayName!: string;
@Column(DataType.DECIMAL(20,2))
- balance: number;
+ balance!: number;
@Column
- password: string;
+ password!: string;
@CreatedAt
- creationDate: Date;
+ creationDate!: Date;
}
\ No newline at end of file
diff --git a/server/src/routes/transactions.ts b/server/src/routes/transactions.ts
index 8c780a3..9484404 100644
--- a/server/src/routes/transactions.ts
+++ b/server/src/routes/transactions.ts
@@ -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;
diff --git a/tsconfig.json b/tsconfig.json
index f2d80d8..5bead01 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,7 +10,7 @@
"module": "es2022",
"lib": ["es2022", "dom"],
"paths": {
- "@shared/*": ["shared/src/*"]
+ "@model/*": ["server/src/model/*"]
}
},
"exclude": ["node_modules"]