This commit is contained in:
2025-12-16 13:53:23 +01:00
parent 84f05598a6
commit 29dc11deb9
127 changed files with 538 additions and 547 deletions

View File

@@ -5,7 +5,7 @@
*/
import { Logger } from '@core/shared/application';
import type { IUserRepository, StoredUser } from '../../domain/repositories/IUserRepository';
import type { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
export class InMemoryUserRepository implements IUserRepository {
private users: Map<string, StoredUser> = new Map();
@@ -38,7 +38,7 @@ export class InMemoryUserRepository implements IUserRepository {
}
return user;
} catch (error) {
this.logger.error(`Error finding user by email ${email}:`, error);
this.logger.error(`Error finding user by email ${email}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
@@ -54,7 +54,7 @@ export class InMemoryUserRepository implements IUserRepository {
}
return user;
} catch (error) {
this.logger.error(`Error finding user by id ${id}:`, error);
this.logger.error(`Error finding user by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
@@ -71,7 +71,7 @@ export class InMemoryUserRepository implements IUserRepository {
this.logger.info(`User ${user.id} (${user.email}) created successfully.`);
return user;
} catch (error) {
this.logger.error(`Error creating user ${user.id} (${user.email}):`, error);
this.logger.error(`Error creating user ${user.id} (${user.email}):`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
@@ -98,7 +98,7 @@ export class InMemoryUserRepository implements IUserRepository {
this.logger.info(`User ${user.id} (${user.email}) updated successfully.`);
return user;
} catch (error) {
this.logger.error(`Error updating user ${user.id} (${user.email}):`, error);
this.logger.error(`Error updating user ${user.id} (${user.email}):`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
@@ -110,7 +110,7 @@ export class InMemoryUserRepository implements IUserRepository {
this.logger.debug(`Email ${email} exists: ${exists}.`);
return exists;
} catch (error) {
this.logger.error(`Error checking existence of email ${email}:`, error);
this.logger.error(`Error checking existence of email ${email}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}