feat(devops,docs,verify): implement Phase 4 CI pipeline, OpenAPI synchronization, and E2E verification matrix
Deploy Canina / deploy (push) Failing after 28s
Deploy Canina / deploy (push) Failing after 28s
This commit is contained in:
1 parent
27abaa3e05
commit
ad3f149789
25 files changed
+3582
-212
No files matched your search
@@ -102,17 +102,26 @@ export class AdminService {
|
||||
};
|
||||
}
|
||||
|
||||
async adjustUserWallet(userId: string, amount: number, type: 'deposit' | 'withdrawal' | 'refund', description?: string) {
|
||||
async adjustUserWallet(
|
||||
userId: string,
|
||||
amount: number,
|
||||
type: 'deposit' | 'withdrawal' | 'refund',
|
||||
description?: string,
|
||||
) {
|
||||
const user = await this.prisma.user.findUnique({ where: { id: userId } });
|
||||
if (!user) {
|
||||
throw new NotFoundException('کاربر مورد نظر یافت نشد');
|
||||
}
|
||||
|
||||
const adjustAmount = type === 'withdrawal' ? -Math.abs(amount) : Math.abs(amount);
|
||||
const adjustAmount =
|
||||
type === 'withdrawal' ? -Math.abs(amount) : Math.abs(amount);
|
||||
const currentBalance = Number(user.walletBalance || 0);
|
||||
|
||||
if (adjustAmount < 0 && currentBalance + adjustAmount < 0) {
|
||||
throw new HttpException('موجودی کیف پول کاربر برای کسر این مبلغ کافی نیست', 400);
|
||||
throw new HttpException(
|
||||
'موجودی کیف پول کاربر برای کسر این مبلغ کافی نیست',
|
||||
400,
|
||||
);
|
||||
}
|
||||
|
||||
return this.prisma.$transaction([
|
||||
@@ -122,7 +131,13 @@ export class AdminService {
|
||||
amount: Math.abs(amount),
|
||||
type: type === 'withdrawal' ? 'withdrawal' : 'deposit',
|
||||
status: 'completed',
|
||||
description: description || (type === 'refund' ? 'بازگشت وجه توسط ادمین' : type === 'deposit' ? 'شارژ توسط ادمین' : 'کسر توسط ادمین'),
|
||||
description:
|
||||
description ||
|
||||
(type === 'refund'
|
||||
? 'بازگشت وجه توسط ادمین'
|
||||
: type === 'deposit'
|
||||
? 'شارژ توسط ادمین'
|
||||
: 'کسر توسط ادمین'),
|
||||
},
|
||||
}),
|
||||
this.prisma.user.update({
|
||||
@@ -485,7 +500,9 @@ export class AdminService {
|
||||
where.OR = [
|
||||
{ name: { contains: query.search, mode: 'insensitive' } },
|
||||
{ breed: { contains: query.search, mode: 'insensitive' } },
|
||||
{ user: { firstName: { contains: query.search, mode: 'insensitive' } } },
|
||||
{
|
||||
user: { firstName: { contains: query.search, mode: 'insensitive' } },
|
||||
},
|
||||
{ user: { lastName: { contains: query.search, mode: 'insensitive' } } },
|
||||
];
|
||||
}
|
||||
@@ -498,7 +515,13 @@ export class AdminService {
|
||||
orderBy: { createdAt: 'desc' },
|
||||
include: {
|
||||
user: {
|
||||
select: { id: true, firstName: true, lastName: true, mobile: true, email: true },
|
||||
select: {
|
||||
id: true,
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
mobile: true,
|
||||
email: true,
|
||||
},
|
||||
},
|
||||
medicalConditions: true,
|
||||
reminders: true,
|
||||
|
||||
Reference in new issue
Block a user