mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 13:08:23 +02:00
Remove excess console logs from user management features
Remove console.log statements used for debugging in user creation, retrieval, and update operations across frontend and backend. Replit-Commit-Author: Agent Replit-Commit-Session-Id: c52a701b-4841-4d00-b8cf-5a41c12abdf3 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/c52a701b-4841-4d00-b8cf-5a41c12abdf3/zOtcEz8
This commit is contained in:
1 parent
6f4f53c9a9
commit
8de35b9709
3 files changed
+3
-71
No files matched your search
@@ -187,18 +187,14 @@ export class DatabaseStorage implements IStorage {
|
||||
}
|
||||
|
||||
async getUserWithGroups(id: string): Promise<UserWithGroups | undefined> {
|
||||
console.log(`🔍 getUserWithGroups called for user: ${id}`);
|
||||
|
||||
// Get the user first
|
||||
const user = await this.getUser(id);
|
||||
if (!user) {
|
||||
console.log(`❌ User ${id} not found`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Fixed: Use manual SQL to avoid userGroups.createdAt column that doesn't exist
|
||||
try {
|
||||
console.log(`🔍 Querying user_groups for user: ${id}`);
|
||||
const result = await db.execute(sql`
|
||||
SELECT
|
||||
ug.user_id,
|
||||
@@ -217,9 +213,6 @@ export class DatabaseStorage implements IStorage {
|
||||
WHERE ug.user_id = ${id}
|
||||
`);
|
||||
|
||||
console.log(`🔍 Found ${result.rows.length} group assignments for user ${id}`);
|
||||
console.log(`🔍 Raw query result:`, result.rows);
|
||||
|
||||
const userGroupsData = result.rows.map((row: any) => ({
|
||||
userId: row.user_id,
|
||||
groupId: row.group_id,
|
||||
@@ -237,15 +230,12 @@ export class DatabaseStorage implements IStorage {
|
||||
}
|
||||
}));
|
||||
|
||||
console.log(`✅ Processed ${userGroupsData.length} groups for user ${id}`);
|
||||
|
||||
return {
|
||||
...user,
|
||||
userGroups: userGroupsData,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ getUserWithGroups error:', error);
|
||||
console.error('❌ Error details:', error?.code, error?.message);
|
||||
// Fallback: return user with empty groups
|
||||
return {
|
||||
...user,
|
||||
@@ -270,18 +260,13 @@ export class DatabaseStorage implements IStorage {
|
||||
}
|
||||
|
||||
async getUsersWithRolesAndGroups(): Promise<(UserWithRoles & { userGroups: any[] })[]> {
|
||||
console.log('🔍 getUsersWithRolesAndGroups called');
|
||||
const baseUsers = await this.getUsers();
|
||||
console.log('📊 Base users found:', baseUsers.length);
|
||||
|
||||
const usersWithRolesAndGroups = await Promise.all(
|
||||
baseUsers.map(async (user) => {
|
||||
console.log(`🔍 Processing user: ${user.username}`);
|
||||
const userWithRoles = await this.getUserWithRoles(user.id);
|
||||
const userWithGroups = await this.getUserWithGroups(user.id);
|
||||
|
||||
console.log(`📊 User ${user.username} groups:`, userWithGroups?.userGroups?.length || 0);
|
||||
|
||||
return {
|
||||
...user,
|
||||
userRoles: userWithRoles?.userRoles || [],
|
||||
@@ -291,12 +276,10 @@ export class DatabaseStorage implements IStorage {
|
||||
})
|
||||
);
|
||||
|
||||
console.log('🔍 Final users with roles and groups:', usersWithRolesAndGroups.length);
|
||||
return usersWithRolesAndGroups;
|
||||
}
|
||||
|
||||
async createUser(userData: UpsertUser): Promise<User> {
|
||||
console.log('🔍 Storage createUser called with:', userData.username);
|
||||
try {
|
||||
const [user] = await db
|
||||
.insert(users)
|
||||
@@ -306,19 +289,14 @@ export class DatabaseStorage implements IStorage {
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.returning();
|
||||
console.log('✅ Storage createUser successful:', user.username);
|
||||
return user;
|
||||
} catch (error) {
|
||||
console.error('❌ Storage createUser error:', error);
|
||||
console.error('❌ Storage error code:', error.code);
|
||||
console.error('❌ Storage error constraint:', error.constraint);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async updateUser(id: string, userData: Partial<UpsertUser>): Promise<User> {
|
||||
console.log('🔍 Storage updateUser called for:', id);
|
||||
console.log('🔍 Update data:', userData);
|
||||
try {
|
||||
const [user] = await db
|
||||
.update(users)
|
||||
@@ -328,12 +306,9 @@ export class DatabaseStorage implements IStorage {
|
||||
})
|
||||
.where(eq(users.id, id))
|
||||
.returning();
|
||||
console.log('✅ Storage updateUser successful:', user.username);
|
||||
return user;
|
||||
} catch (error) {
|
||||
console.error('❌ Storage updateUser error:', error);
|
||||
console.error('❌ Storage error code:', error.code);
|
||||
console.error('❌ Storage error constraint:', error.constraint);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user