Refactor and centralize user and pagination interfaces in useAdmin hook

- Unified `User` and `PaginationMeta` type definitions into `useAdmin` to improve maintainability and consistency.
- Updated affected components (`UserManagementContent`, `UserListTable`, `UserFormDialog`, `UserActionMenu`) to reference the centralized types.
- Enhanced test coverage for user-related hooks to include create, update, delete, activate, deactivate, and bulk actions.
This commit is contained in:
Felipe Cardoso
2025-11-06 12:49:46 +01:00
parent 91bc4f190d
commit f22f87250c
6 changed files with 316 additions and 49 deletions

View File

@@ -26,6 +26,7 @@ import { toast } from 'sonner';
import {
useCreateUser,
useUpdateUser,
type User,
} from '@/lib/api/hooks/useAdmin';
// ============================================================================
@@ -58,15 +59,6 @@ type UserFormData = z.infer<typeof userFormSchema>;
// Component
// ============================================================================
interface User {
id: string;
email: string;
first_name: string;
last_name: string | null;
is_active: boolean;
is_superuser: boolean;
}
interface UserFormDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;