website refactor

This commit is contained in:
2026-01-16 21:57:44 +01:00
parent 83a9092c50
commit 27f5a52e04
30 changed files with 166 additions and 161 deletions

View File

@@ -16,8 +16,8 @@ export class InMemoryPenaltyRepository implements PenaltyRepository {
this.logger = logger;
this.logger.info('InMemoryPenaltyRepository initialized.');
initialPenalties.forEach(penalty => {
this.penalties.set(penalty.id, penalty);
this.logger.debug(`Seeded penalty: ${penalty.id}`);
this.penalties.set(penalty.id.toString(), penalty);
this.logger.debug(`Seeded penalty: ${penalty.id.toString()}`);
});
}
@@ -108,31 +108,31 @@ export class InMemoryPenaltyRepository implements PenaltyRepository {
}
async create(penalty: Penalty): Promise<void> {
this.logger.debug(`Creating penalty: ${penalty.id}`);
this.logger.debug(`Creating penalty: ${penalty.id.toString()}`);
try {
if (this.penalties.has(penalty.id)) {
this.logger.warn(`Penalty with ID ${penalty.id} already exists.`);
throw new Error(`Penalty with ID ${penalty.id} already exists`);
if (this.penalties.has(penalty.id.toString())) {
this.logger.warn(`Penalty with ID ${penalty.id.toString()} already exists.`);
throw new Error(`Penalty with ID ${penalty.id.toString()} already exists`);
}
this.penalties.set(penalty.id, penalty);
this.logger.info(`Penalty ${penalty.id} created successfully.`);
this.penalties.set(penalty.id.toString(), penalty);
this.logger.info(`Penalty ${penalty.id.toString()} created successfully.`);
} catch (error) {
this.logger.error(`Error creating penalty ${penalty.id}:`, error instanceof Error ? error : new Error(String(error)));
this.logger.error(`Error creating penalty ${penalty.id.toString()}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
async update(penalty: Penalty): Promise<void> {
this.logger.debug(`Updating penalty: ${penalty.id}`);
this.logger.debug(`Updating penalty: ${penalty.id.toString()}`);
try {
if (!this.penalties.has(penalty.id)) {
this.logger.warn(`Penalty with ID ${penalty.id} not found for update.`);
throw new Error(`Penalty with ID ${penalty.id} not found`);
if (!this.penalties.has(penalty.id.toString())) {
this.logger.warn(`Penalty with ID ${penalty.id.toString()} not found for update.`);
throw new Error(`Penalty with ID ${penalty.id.toString()} not found`);
}
this.penalties.set(penalty.id, penalty);
this.logger.info(`Penalty ${penalty.id} updated successfully.`);
this.penalties.set(penalty.id.toString(), penalty);
this.logger.info(`Penalty ${penalty.id.toString()} updated successfully.`);
} catch (error) {
this.logger.error(`Error updating penalty ${penalty.id}:`, error instanceof Error ? error : new Error(String(error)));
this.logger.error(`Error updating penalty ${penalty.id.toString()}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}