fix(admin/b2b): add GET /b2b/partners endpoint and update B2BManager fetch path to fix 404 error
Deploy Canina / deploy (push) Failing after 29s

This commit is contained in:
parsa aghaei committed 2026-08-08 18:30:42 +03:30
1 parent 43cf55a8ef
commit 9e233bee27
3 files changed
+17 -1

No files matched your search

+9
View File
@@ -77,4 +77,13 @@ export class B2BController {
const userId = req.user.id || req.user.userId || '';
return this.b2bService.createWholesaleOrder(userId, body);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('ADMIN')
@ApiBearerAuth()
@Get('partners')
@ApiOperation({ summary: 'لیست حساب‌های همکاران تجاری (مخصوص ادمین)' })
getAllPartnerAccounts() {
return this.b2bService.getAllPartnerAccounts();
}
}
+7
View File
@@ -91,4 +91,11 @@ export class B2BService {
include: { orderItems: true },
});
}
async getAllPartnerAccounts() {
return this.prisma.partnerAccount.findMany({
include: { user: true },
orderBy: { createdAt: 'desc' },
});
}
}
@@ -48,7 +48,7 @@ export default function B2BManager() {
const fetchPartners = async () => {
try {
const res = await api.get('/admin/b2b/partners');
const res = await api.get('/b2b/partners');
const data = Array.isArray(res.data) ? res.data : (res.data?.data || []);
setPartners(data);
} catch (err) {