feat: implement admin API for user and representation management

- Updated UsersPage to fetch users from the new admin endpoint.
- Enhanced user data structure to include 'name' and modified rendering logic.
- Added RepresentationDetailPage for detailed representation management.
- Created AdminApiController to handle user and representation CRUD operations.
- Implemented pagination and search functionality for users and representations.
- Updated user and representation data models to reflect new API structure.
This commit is contained in:
hamed
2026-06-09 23:41:44 +03:30
parent f619449167
commit 147a2a894e
20 changed files with 1067 additions and 228 deletions
+5 -5
View File
@@ -38,7 +38,7 @@ export default function RepresentationsPage() {
queryFn: () => {
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
if (search) params.set('search', search);
return api.get<PaginatedResponse<Representation>>(`/api/v1/representations?${params}`);
return api.get<PaginatedResponse<Representation>>(`/api/v1/admin/representations?${params}`);
},
});
@@ -79,14 +79,14 @@ export default function RepresentationsPage() {
{
key: 'wallet_balance',
header: 'موجودی کیف‌پول',
render: (r) => formatRial(r.wallet_balance),
render: (r) => formatRial(r.wallet_balance ?? 0),
},
{ key: 'is_active', header: 'وضعیت', render: (r) => <ActiveBadge active={r.is_active} /> },
{ key: 'is_active', header: 'وضعیت', render: (r) => <ActiveBadge active={r.is_active ?? r.active ?? false} /> },
{ key: 'created_at', header: 'تاریخ ثبت', render: (r) => formatDate(r.created_at) },
];
const items = data?.data?.items ?? [];
const total = data?.data?.total ?? 0;
const items = data?.data ?? [];
const total = data?.meta?.totalRecords ?? 0;
return (
<div>