mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 14:00:12 +02:00
fixed get my assets
This commit is contained in:
parent
93f86101b7
commit
84bfac8a98
@ -27,6 +27,7 @@ export class AuthService {
|
|||||||
name: 'user',
|
name: 'user',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
let balance = 1000;
|
let balance = 1000;
|
||||||
if (promoCode && promoCode.value) {
|
if (promoCode && promoCode.value) {
|
||||||
balance = promoCode.value;
|
balance = promoCode.value;
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
import { checkUserHasAccount } from 'src/utils/checkUser';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
constructor(private prisma: PrismaService) {}
|
constructor(private prisma: PrismaService) {}
|
||||||
|
|
||||||
async GetMyAssets(userId: string) {
|
async GetMyAssets(userId: string) {
|
||||||
|
await checkUserHasAccount(userId);
|
||||||
|
|
||||||
const user = await this.prisma.user.findUnique({
|
const user = await this.prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: userId,
|
id: userId,
|
||||||
@ -18,6 +21,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async GetMyTrades(userId: string) {
|
async GetMyTrades(userId: string) {
|
||||||
|
await checkUserHasAccount(userId);
|
||||||
const user = await this.prisma.trade.findMany({
|
const user = await this.prisma.trade.findMany({
|
||||||
where: {
|
where: {
|
||||||
OR: [{ id_giver: userId }, { id_receiver: userId }],
|
OR: [{ id_giver: userId }, { id_receiver: userId }],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user