From 0f4474d29b56cd3cbab4c31e8d9f4e4edc9af8f3 Mon Sep 17 00:00:00 2001 From: eneller Date: Thu, 23 Jul 2026 14:28:20 +0200 Subject: [PATCH] feat(server): business owned by user data model --- .../screen-profile/screen-profile.html | 6 ++--- .../screens/screen-profile/screen-profile.ts | 5 ++-- .../screen-receive/screen-receive.html | 2 +- .../screens/screen-receive/screen-receive.ts | 5 ++-- client/src/app/services/api.ts | 3 +++ server/package.json | 3 ++- server/src/messages/User.ts | 4 +-- server/src/model/transaction.ts | 14 +++++----- server/src/model/user.ts | 26 +++++++++++++++---- server/src/routes/auth.ts | 4 +-- server/src/routes/send.ts | 10 +++---- server/src/scripts/create-user.ts | 12 +++++++++ .../src/scripts/{verify.ts => verify-hash.ts} | 0 server/src/util/auth.ts | 8 +++--- server/src/util/db.ts | 4 +-- 15 files changed, 69 insertions(+), 37 deletions(-) create mode 100644 server/src/scripts/create-user.ts rename server/src/scripts/{verify.ts => verify-hash.ts} (100%) diff --git a/client/src/app/screens/screen-profile/screen-profile.html b/client/src/app/screens/screen-profile/screen-profile.html index 7eb931c..ee40f38 100644 --- a/client/src/app/screens/screen-profile/screen-profile.html +++ b/client/src/app/screens/screen-profile/screen-profile.html @@ -6,7 +6,7 @@

{{ username }}

-

{{ userID }}

+

{{ this.api.currentUser }}

{{ balance | currency}}

@@ -31,7 +31,7 @@
- @if (transaction.receiverID == userID) { + @if (transaction.receiverID == this.api.currentUser) {
{{ transaction.senderID }}
}@else {
{{ transaction.receiverID }}
@@ -40,7 +40,7 @@
- @if (transaction.receiverID == userID) { + @if (transaction.receiverID == this.api.currentUser) {
{{ transaction.amount | currency }}
diff --git a/client/src/app/screens/screen-profile/screen-profile.ts b/client/src/app/screens/screen-profile/screen-profile.ts index f16a718..c1ca96c 100644 --- a/client/src/app/screens/screen-profile/screen-profile.ts +++ b/client/src/app/screens/screen-profile/screen-profile.ts @@ -1,5 +1,5 @@ import { CommonModule, CurrencyPipe, DatePipe } from '@angular/common'; -import { Component, OnInit } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { APIService } from '../../services/api'; import Transaction from '@model/transaction'; import { Router } from '@angular/router'; @@ -13,12 +13,11 @@ import { Router } from '@angular/router'; export class ScreenProfile implements OnInit{ // TODO display real data username = 'John Doe'; - userID = 'testuser'; balance = 200; transactions!: Transaction[]; constructor( - private api: APIService, + protected api: APIService, private router: Router, ){} diff --git a/client/src/app/screens/screen-receive/screen-receive.html b/client/src/app/screens/screen-receive/screen-receive.html index 9b5df88..201925a 100644 --- a/client/src/app/screens/screen-receive/screen-receive.html +++ b/client/src/app/screens/screen-receive/screen-receive.html @@ -40,7 +40,7 @@