This commit is contained in:
2026-02-01 16:19:13 +03:30
parent f1ff3250a9
commit d5d31d528d
2 changed files with 8 additions and 9 deletions
+4 -1
View File
@@ -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(