From 1888a876bca08e98c445c6e613bf233f0de4e29d Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 01:26:25 +0000 Subject: [PATCH] Update user ID type to string throughout the application. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/fd178635-7356-4ff4-a868-0a00dcf186f0.jpg --- client/src/pages/users-roles.tsx | 6 +++--- server/storage.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/src/pages/users-roles.tsx b/client/src/pages/users-roles.tsx index b18a050..41301a8 100644 --- a/client/src/pages/users-roles.tsx +++ b/client/src/pages/users-roles.tsx @@ -77,7 +77,7 @@ const userFormSchema = z.object({ password: z.string().min(8, "Password must be at least 8 characters"), fullName: z.string().optional(), role: z.enum(systemRoles as unknown as [string, ...string[]]), - organizationId: z.number().optional(), + organizationId: z.string().optional(), }); export default function UsersRolesPage() { @@ -152,7 +152,7 @@ export default function UsersRolesPage() { // Update user role mutation const updateRoleMutation = useMutation({ - mutationFn: async ({ userId, role }: { userId: number, role: UserRole }) => { + mutationFn: async ({ userId, role }: { userId: string, role: UserRole }) => { const res = await apiRequest("PUT", `/api/users/${userId}`, { role }); return await res.json(); }, @@ -176,7 +176,7 @@ export default function UsersRolesPage() { // Delete user mutation const deleteUserMutation = useMutation({ - mutationFn: async (userId: number) => { + mutationFn: async (userId: string) => { await apiRequest("DELETE", `/api/users/${userId}`); }, onSuccess: () => { diff --git a/server/storage.ts b/server/storage.ts index c85afee..950bf32 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -364,10 +364,10 @@ export class MemStorage implements IStorage { } async createApiToken(token: InsertApiToken): Promise { - const id = this.apiTokenIdCounter++; + const numId = this.apiTokenIdCounter++; const createdAt = new Date(); const newToken: ApiToken = { - id: id.toString(), + id: numId.toString(), name: token.name, token: token.token, organizationId: token.organizationId, @@ -377,7 +377,7 @@ export class MemStorage implements IStorage { expiresAt: token.expiresAt ?? null, createdAt }; - this.apiTokensMap.set(id, newToken); + this.apiTokensMap.set(numId, newToken); return newToken; } @@ -403,11 +403,11 @@ export class MemStorage implements IStorage { newValue?: string, userId?: string ): Promise { - const id = this.historyIdCounter++; + const numId = this.historyIdCounter++; const timestamp = new Date(); const historyEntry: DnsHistory = { - id: id.toString(), + id: numId.toString(), recordId, action, previousValue: previousValue ?? null, @@ -416,7 +416,7 @@ export class MemStorage implements IStorage { timestamp }; - this.historyMap.set(id, historyEntry); + this.historyMap.set(numId, historyEntry); return historyEntry; }