fix(auth): add refresh & logout endpoints and ensure UsersService.findById handles fallback admin
Deploy Canina / deploy (push) Successful in 1m53s

This commit is contained in:
parsa aghaei committed 2026-08-16 15:07:07 +03:30
1 parent 28fc660f69
commit 1a21c4c642
3 files changed
+93 -47

No files matched your search

+51
View File
@@ -18,6 +18,57 @@ export class UsersService {
constructor(private prisma: PrismaService) {}
async findById(id: string) {
if (id === '12345678-1234-1234-1234-123456789012') {
const dbUser = await this.prisma.user.findUnique({
where: { id },
include: {
pets: {
include: {
medicalConditions: true,
reminders: {
include: {
completions: true,
},
},
healthLogs: true,
},
},
orders: {
orderBy: { createdAt: 'desc' },
include: {
orderItems: {
include: { product: true },
},
},
},
addresses: true,
walletTransactions: {
orderBy: { createdAt: 'desc' },
take: 50,
},
},
});
if (dbUser) return dbUser;
return {
id: '12345678-1234-1234-1234-123456789012',
firstName: 'مدیر',
lastName: 'سیستم',
email: process.env.ADMIN_EMAIL || 'admin@canina-iran.com',
mobile: '09120000000',
role: 'Admin',
walletBalance: new Prisma.Decimal(0),
charityDonationTotal: new Prisma.Decimal(0),
pets: [],
orders: [],
addresses: [],
walletTransactions: [],
createdAt: new Date(),
updatedAt: new Date(),
};
}
return this.prisma.user.findUnique({
where: { id },
include: {