mirror of
https://github.com/immich-app/immich.git
synced 2026-05-22 06:52:33 -04:00
d7f05d2510
fix(mobile): deduplicate assets in person view timeline Previously, assets with multiple face records for the same person (e.g., manual Digikam imports and Immich ML detections) appeared multiple times in the person timeline. This was caused by an inner join on the assetFaceEntity without proper deduplication. This commit refactors the timeline queries to use a subquery approach instead of joins and grouping. This ensures: - _getPersonBucketAssets: Only unique assets are fetched, even if multiple face records exist for a single asset. - _watchPersonBucket: Asset counts in timeline headers are accurate and represent unique assets. - Performance: Database overhead is reduced by avoiding complex joins and explicit groupBy operations on large result sets. Signed-off-by: thowdev <12428285+thowdev@users.noreply.github.com>
Infrastructure Layer
This directory contains the infrastructure layer of Immich. The infrastructure layer is responsible for the implementation details of the app. It includes data sources, APIs, and other external dependencies.
Structure
- Entities: These are the classes that define the database schema for the domain models.
- Repositories: These are the actual implementation of the domain interfaces. A single interface might have multiple implementations.
- Utils: These are utility classes and functions specific to infrastructure implementations.
infrastructure/
├── entities/
│ └── user.entity.dart
├── repositories/
│ └── user.repository.dart
└── utils/
└── database_utils.dart
Usage
The infrastructure layer provides concrete implementations of repository interfaces defined in the domain layer. These implementations are exposed through Riverpod providers in the root providers directory.
// In domain/services/user.service.dart
final userRepository = ref.watch(userRepositoryProvider);
final user = await userRepository.getUser(userId);
The domain layer should never directly instantiate repository implementations, but instead receive them through dependency injection.