This commit is contained in:
2026-01-08 21:36:15 +01:00
parent 05cf3bafd2
commit d689df0270
23 changed files with 25233 additions and 88 deletions

View File

@@ -15,6 +15,12 @@ export class TypeOrmTeamRepository implements ITeamRepository {
) {}
async findById(id: string): Promise<Team | null> {
// Validate UUID format to prevent database errors
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!uuidRegex.test(id)) {
return null;
}
const entity = await this.repo.findOne({ where: { id } });
return entity ? this.mapper.toDomain(entity) : null;
}

View File

@@ -13,6 +13,12 @@ export class TypeOrmDriverRepository implements IDriverRepository {
) {}
async findById(id: string): Promise<Driver | null> {
// Validate UUID format to prevent database errors
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!uuidRegex.test(id)) {
return null;
}
const repo = this.dataSource.getRepository(DriverOrmEntity);
const entity = await repo.findOne({ where: { id } });
return entity ? this.mapper.toDomain(entity) : null;