fix: sql generation issues (#8361)

chore: fix sql gen issues
This commit is contained in:
Jason Rasmussen
2024-03-30 00:16:06 -04:00
committed by GitHub
parent 25c9b779e4
commit 4b39d37cae
19 changed files with 494 additions and 275 deletions

View File

@@ -5,7 +5,7 @@ import { LibraryStatsResponseDto } from 'src/dtos/library.dto';
import { LibraryEntity, LibraryType } from 'src/entities/library.entity';
import { ILibraryRepository } from 'src/interfaces/library.interface';
import { Instrumentation } from 'src/utils/instrumentation';
import { IsNull, Not } from 'typeorm';
import { EntityNotFoundError, IsNull, Not } from 'typeorm';
import { Repository } from 'typeorm/repository/Repository.js';
@Instrumentation()
@@ -139,6 +139,10 @@ export class LibraryRepository implements ILibraryRepository {
.where('libraries.id = :id', { id })
.getRawOne();
if (!stats) {
throw new EntityNotFoundError(LibraryEntity, { where: { id } });
}
return {
photos: Number(stats.photos),
videos: Number(stats.videos),