mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 18:19:10 +03:00
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user