chore: update test fixtures and frontend for UUID identity (refs #217)
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 6m41s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 52s
Deploy to Staging / Verify Staging (pull_request) Failing after 4m7s
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 9s
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 6m41s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 52s
Deploy to Staging / Verify Staging (pull_request) Failing after 4m7s
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 9s
Backend test fixtures: - Replace auth0|xxx format with UUID in all test userId values - Update admin tests for new id/userProfileId schema - Add missing deletionRequestedAt/deletionScheduledFor to auth test mocks - Fix admin integration test supertest usage (app.server) Frontend: - AdminUser type: auth0Sub -> id + userProfileId - admin.api.ts: all user management methods use userId (UUID) params - useUsers/useAdmins hooks: auth0Sub -> userId/id in mutations - AdminUsersPage + AdminUsersMobileScreen: user.auth0Sub -> user.id - Remove encodeURIComponent (UUIDs don't need encoding) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -71,8 +71,8 @@ import { AdminSectionHeader } from '../../features/admin/components';
|
||||
const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
||||
|
||||
// Expandable vehicle row component
|
||||
const UserVehiclesRow: React.FC<{ auth0Sub: string; isOpen: boolean }> = ({ auth0Sub, isOpen }) => {
|
||||
const { data, isLoading, error } = useUserVehicles(auth0Sub);
|
||||
const UserVehiclesRow: React.FC<{ userId: string; isOpen: boolean }> = ({ userId, isOpen }) => {
|
||||
const { data, isLoading, error } = useUserVehicles(userId);
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
@@ -222,8 +222,8 @@ export const AdminUsersPage: React.FC = () => {
|
||||
}, []);
|
||||
|
||||
const handleTierChange = useCallback(
|
||||
(auth0Sub: string, newTier: SubscriptionTier) => {
|
||||
updateTierMutation.mutate({ auth0Sub, data: { subscriptionTier: newTier } });
|
||||
(userId: string, newTier: SubscriptionTier) => {
|
||||
updateTierMutation.mutate({ userId, data: { subscriptionTier: newTier } });
|
||||
},
|
||||
[updateTierMutation]
|
||||
);
|
||||
@@ -246,7 +246,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
const handleDeactivateConfirm = useCallback(() => {
|
||||
if (selectedUser) {
|
||||
deactivateMutation.mutate(
|
||||
{ auth0Sub: selectedUser.auth0Sub, data: { reason: deactivateReason || undefined } },
|
||||
{ userId: selectedUser.id, data: { reason: deactivateReason || undefined } },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setDeactivateDialogOpen(false);
|
||||
@@ -260,7 +260,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
|
||||
const handleReactivate = useCallback(() => {
|
||||
if (selectedUser) {
|
||||
reactivateMutation.mutate(selectedUser.auth0Sub);
|
||||
reactivateMutation.mutate(selectedUser.id);
|
||||
setAnchorEl(null);
|
||||
setSelectedUser(null);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
}
|
||||
if (Object.keys(updates).length > 0) {
|
||||
updateProfileMutation.mutate(
|
||||
{ auth0Sub: selectedUser.auth0Sub, data: updates },
|
||||
{ userId: selectedUser.id, data: updates },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setEditDialogOpen(false);
|
||||
@@ -316,7 +316,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
const handlePromoteConfirm = useCallback(() => {
|
||||
if (selectedUser) {
|
||||
promoteToAdminMutation.mutate(
|
||||
{ auth0Sub: selectedUser.auth0Sub, data: { role: promoteRole } },
|
||||
{ userId: selectedUser.id, data: { role: promoteRole } },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setPromoteDialogOpen(false);
|
||||
@@ -342,7 +342,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
const handleHardDeleteConfirm = useCallback(() => {
|
||||
if (selectedUser && hardDeleteConfirmText === 'DELETE') {
|
||||
hardDeleteMutation.mutate(
|
||||
{ auth0Sub: selectedUser.auth0Sub, reason: hardDeleteReason || undefined },
|
||||
{ userId: selectedUser.id, reason: hardDeleteReason || undefined },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setHardDeleteDialogOpen(false);
|
||||
@@ -496,11 +496,11 @@ export const AdminUsersPage: React.FC = () => {
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{users.map((user) => (
|
||||
<React.Fragment key={user.auth0Sub}>
|
||||
<React.Fragment key={user.id}>
|
||||
<TableRow
|
||||
sx={{
|
||||
opacity: user.deactivatedAt ? 0.6 : 1,
|
||||
'& > *': { borderBottom: expandedRow === user.auth0Sub ? 'unset' : undefined },
|
||||
'& > *': { borderBottom: expandedRow === user.id ? 'unset' : undefined },
|
||||
}}
|
||||
>
|
||||
<TableCell>{user.email}</TableCell>
|
||||
@@ -510,7 +510,7 @@ export const AdminUsersPage: React.FC = () => {
|
||||
<Select
|
||||
value={user.subscriptionTier}
|
||||
onChange={(e) =>
|
||||
handleTierChange(user.auth0Sub, e.target.value as SubscriptionTier)
|
||||
handleTierChange(user.id, e.target.value as SubscriptionTier)
|
||||
}
|
||||
disabled={!!user.deactivatedAt || updateTierMutation.isPending}
|
||||
size="small"
|
||||
@@ -527,12 +527,12 @@ export const AdminUsersPage: React.FC = () => {
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => setExpandedRow(
|
||||
expandedRow === user.auth0Sub ? null : user.auth0Sub
|
||||
expandedRow === user.id ? null : user.id
|
||||
)}
|
||||
aria-label="show vehicles"
|
||||
sx={{ minWidth: 44, minHeight: 44 }}
|
||||
>
|
||||
{expandedRow === user.auth0Sub ? (
|
||||
{expandedRow === user.id ? (
|
||||
<KeyboardArrowUp fontSize="small" />
|
||||
) : (
|
||||
<KeyboardArrowDown fontSize="small" />
|
||||
@@ -569,8 +569,8 @@ export const AdminUsersPage: React.FC = () => {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<UserVehiclesRow
|
||||
auth0Sub={user.auth0Sub}
|
||||
isOpen={expandedRow === user.auth0Sub}
|
||||
userId={user.id}
|
||||
isOpen={expandedRow === user.id}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user