bug
This commit is contained in:
@@ -17,10 +17,13 @@ export class CreditService {
|
||||
) { }
|
||||
|
||||
async getCurrentCredit(userId: string,): Promise<number> {
|
||||
|
||||
const user = await this.userRepository.findOne(userId)
|
||||
|
||||
if (!user) {
|
||||
throw new BadRequestException("User not found")
|
||||
}
|
||||
|
||||
const maxCredit = user.maxCredit
|
||||
|
||||
const latestTransaction = await this.creditRepository.findOne(
|
||||
@@ -32,7 +35,7 @@ export class CreditService {
|
||||
const balance = latestTransaction?.balance || 0
|
||||
|
||||
const remained = maxCredit - balance
|
||||
|
||||
|
||||
return remained
|
||||
}
|
||||
// async getUserWalletTransactions(
|
||||
|
||||
Reference in New Issue
Block a user