fixed get my assets

This commit is contained in:
Kevsl 2024-06-07 12:18:21 +02:00
parent 93f86101b7
commit 84bfac8a98
2 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ export class AuthService {
name: 'user',
},
});
let balance = 1000;
if (promoCode && promoCode.value) {
balance = promoCode.value;

View File

@ -1,11 +1,14 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { checkUserHasAccount } from 'src/utils/checkUser';
@Injectable()
export class UserService {
constructor(private prisma: PrismaService) {}
async GetMyAssets(userId: string) {
await checkUserHasAccount(userId);
const user = await this.prisma.user.findUnique({
where: {
id: userId,
@ -18,6 +21,7 @@ export class UserService {
}
async GetMyTrades(userId: string) {
await checkUserHasAccount(userId);
const user = await this.prisma.trade.findMany({
where: {
OR: [{ id_giver: userId }, { id_receiver: userId }],