mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	Merge branch 'main' of github.com:immich-app/immich
This commit is contained in:
		@@ -258,5 +258,9 @@
 | 
			
		||||
  "motion_photos_page_title": "Motion Photos",
 | 
			
		||||
  "search_page_motion_photos": "Motion Photos",
 | 
			
		||||
  "search_page_recently_added": "Recently added",
 | 
			
		||||
  "search_page_categories": "Categories"
 | 
			
		||||
  "search_page_categories": "Categories",
 | 
			
		||||
  "search_page_screenshots": "Screenshots",
 | 
			
		||||
  "search_page_selfies": "Selfies",
 | 
			
		||||
  "search_suggestion_list_smart_search_hint_1": "Smart search is enabled by default, to search for metadata use the syntax ",
 | 
			
		||||
  "search_suggestion_list_smart_search_hint_2": "m:your-search-term"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 536 KiB  | 
@@ -243,6 +243,7 @@ class BackupService {
 | 
			
		||||
          );
 | 
			
		||||
          req.headers["Authorization"] =
 | 
			
		||||
              "Bearer ${Store.get(StoreKey.accessToken)}";
 | 
			
		||||
          req.headers["Transfer-Encoding"] = "chunked";
 | 
			
		||||
 | 
			
		||||
          req.fields['deviceAssetId'] = entity.id;
 | 
			
		||||
          req.fields['deviceId'] = deviceId;
 | 
			
		||||
 
 | 
			
		||||
@@ -454,6 +454,10 @@ class EmailInput extends StatelessWidget {
 | 
			
		||||
        labelText: 'login_form_label_email'.tr(),
 | 
			
		||||
        border: const OutlineInputBorder(),
 | 
			
		||||
        hintText: 'login_form_email_hint'.tr(),
 | 
			
		||||
        hintStyle: const TextStyle(
 | 
			
		||||
          fontWeight: FontWeight.normal,
 | 
			
		||||
          fontSize: 14,
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      validator: _validateInput,
 | 
			
		||||
      autovalidateMode: AutovalidateMode.always,
 | 
			
		||||
@@ -487,6 +491,10 @@ class PasswordInput extends StatelessWidget {
 | 
			
		||||
        labelText: 'login_form_label_password'.tr(),
 | 
			
		||||
        border: const OutlineInputBorder(),
 | 
			
		||||
        hintText: 'login_form_password_hint'.tr(),
 | 
			
		||||
        hintStyle: const TextStyle(
 | 
			
		||||
          fontWeight: FontWeight.normal,
 | 
			
		||||
          fontSize: 14,
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      autofillHints: const [AutofillHints.password],
 | 
			
		||||
      keyboardType: TextInputType.text,
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ class SearchResultPageNotifier extends StateNotifier<SearchResultPageState> {
 | 
			
		||||
 | 
			
		||||
  final SearchService _searchService;
 | 
			
		||||
 | 
			
		||||
  void search(String searchTerm) async {
 | 
			
		||||
  void search(String searchTerm, {bool clipEnable = true}) async {
 | 
			
		||||
    state = state.copyWith(
 | 
			
		||||
      searchResult: [],
 | 
			
		||||
      isError: false,
 | 
			
		||||
@@ -26,7 +26,10 @@ class SearchResultPageNotifier extends StateNotifier<SearchResultPageState> {
 | 
			
		||||
      isSuccess: false,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    List<Asset>? assets = await _searchService.searchAsset(searchTerm);
 | 
			
		||||
    List<Asset>? assets = await _searchService.searchAsset(
 | 
			
		||||
      searchTerm,
 | 
			
		||||
      clipEnable: clipEnable,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    if (assets != null) {
 | 
			
		||||
      state = state.copyWith(
 | 
			
		||||
 
 | 
			
		||||
@@ -29,11 +29,16 @@ class SearchService {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<List<Asset>?> searchAsset(String searchTerm) async {
 | 
			
		||||
  Future<List<Asset>?> searchAsset(
 | 
			
		||||
    String searchTerm, {
 | 
			
		||||
    bool clipEnable = true,
 | 
			
		||||
  }) async {
 | 
			
		||||
    // TODO search in local DB: 1. when offline, 2. to find local assets
 | 
			
		||||
    try {
 | 
			
		||||
      final SearchResponseDto? results = await _apiService.searchApi
 | 
			
		||||
          .search(query: searchTerm, clip: true);
 | 
			
		||||
      final SearchResponseDto? results = await _apiService.searchApi.search(
 | 
			
		||||
        query: searchTerm,
 | 
			
		||||
        clip: clipEnable,
 | 
			
		||||
      );
 | 
			
		||||
      if (results == null) {
 | 
			
		||||
        return null;
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@ class CuratedRow extends StatelessWidget {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
 | 
			
		||||
    // Guard empty [content]
 | 
			
		||||
    if (content.isEmpty) {
 | 
			
		||||
      // Return empty thumbnail
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,7 @@ class ExploreGrid extends StatelessWidget {
 | 
			
		||||
          width: 100,
 | 
			
		||||
          child: ThumbnailWithInfo(
 | 
			
		||||
            textInfo: '',
 | 
			
		||||
            onTap: () {
 | 
			
		||||
            },
 | 
			
		||||
            onTap: () {},
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
@@ -42,9 +41,10 @@ class ExploreGrid extends StatelessWidget {
 | 
			
		||||
        return ThumbnailWithInfo(
 | 
			
		||||
          imageUrl: thumbnailRequestUrl,
 | 
			
		||||
          textInfo: content.label,
 | 
			
		||||
          borderRadius: 0,
 | 
			
		||||
          onTap: () {
 | 
			
		||||
            AutoRouter.of(context).push(
 | 
			
		||||
              SearchResultRoute(searchTerm: content.label),
 | 
			
		||||
              SearchResultRoute(searchTerm: 'm:${content.label}'),
 | 
			
		||||
            );
 | 
			
		||||
          },
 | 
			
		||||
        );
 | 
			
		||||
@@ -52,5 +52,4 @@ class ExploreGrid extends StatelessWidget {
 | 
			
		||||
      itemCount: curatedContent.length,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,10 @@ class SearchBar extends HookConsumerWidget with PreferredSizeWidget {
 | 
			
		||||
              },
 | 
			
		||||
              icon: const Icon(Icons.arrow_back_ios_rounded),
 | 
			
		||||
            )
 | 
			
		||||
          : const Icon(Icons.search_rounded),
 | 
			
		||||
          : const Icon(
 | 
			
		||||
              Icons.search_rounded,
 | 
			
		||||
              size: 20,
 | 
			
		||||
            ),
 | 
			
		||||
      title: TextField(
 | 
			
		||||
        controller: searchTermController,
 | 
			
		||||
        focusNode: searchFocusNode,
 | 
			
		||||
@@ -55,6 +58,8 @@ class SearchBar extends HookConsumerWidget with PreferredSizeWidget {
 | 
			
		||||
          hintText: 'search_bar_hint'.tr(),
 | 
			
		||||
          hintStyle: Theme.of(context).textTheme.titleSmall?.copyWith(
 | 
			
		||||
                color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
 | 
			
		||||
                fontWeight: FontWeight.w500,
 | 
			
		||||
                fontSize: 14,
 | 
			
		||||
              ),
 | 
			
		||||
          enabledBorder: const UnderlineInputBorder(
 | 
			
		||||
            borderSide: BorderSide(color: Colors.transparent),
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								mobile/lib/modules/search/ui/search_result_grid.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								mobile/lib/modules/search/ui/search_result_grid.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/home/ui/asset_grid/thumbnail_image.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/models/asset.dart';
 | 
			
		||||
 | 
			
		||||
class SearchResultGrid extends HookConsumerWidget {
 | 
			
		||||
  const SearchResultGrid({super.key, required this.assets});
 | 
			
		||||
 | 
			
		||||
  final List<Asset> assets;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context, WidgetRef ref) {
 | 
			
		||||
    return GridView.builder(
 | 
			
		||||
      gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
 | 
			
		||||
        crossAxisCount: 4,
 | 
			
		||||
        childAspectRatio: 1,
 | 
			
		||||
        crossAxisSpacing: 4,
 | 
			
		||||
        mainAxisSpacing: 4,
 | 
			
		||||
      ),
 | 
			
		||||
      itemCount: assets.length,
 | 
			
		||||
      itemBuilder: (context, index) {
 | 
			
		||||
        final asset = assets[index];
 | 
			
		||||
        return ThumbnailImage(
 | 
			
		||||
          asset: asset,
 | 
			
		||||
          assetList: assets,
 | 
			
		||||
          useGrayBoxPlaceholder: true,
 | 
			
		||||
        );
 | 
			
		||||
      },
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
import 'package:easy_localization/easy_localization.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/search/providers/search_page_state.provider.dart';
 | 
			
		||||
@@ -12,6 +13,7 @@ class SearchSuggestionList extends ConsumerWidget {
 | 
			
		||||
    final searchTerm = ref.watch(searchPageStateProvider).searchTerm;
 | 
			
		||||
    final searchSuggestion =
 | 
			
		||||
        ref.watch(searchPageStateProvider).searchSuggestion;
 | 
			
		||||
    var isDarkTheme = Theme.of(context).brightness == Brightness.dark;
 | 
			
		||||
 | 
			
		||||
    return Container(
 | 
			
		||||
      color: searchTerm.isEmpty
 | 
			
		||||
@@ -19,13 +21,38 @@ class SearchSuggestionList extends ConsumerWidget {
 | 
			
		||||
          : Theme.of(context).scaffoldBackgroundColor,
 | 
			
		||||
      child: CustomScrollView(
 | 
			
		||||
        slivers: [
 | 
			
		||||
          SliverToBoxAdapter(
 | 
			
		||||
            child: Container(
 | 
			
		||||
              color: isDarkTheme ? Colors.grey[800] : Colors.grey[100],
 | 
			
		||||
              child: Padding(
 | 
			
		||||
                padding: const EdgeInsets.all(16.0),
 | 
			
		||||
                child: RichText(
 | 
			
		||||
                  text: TextSpan(
 | 
			
		||||
                    children: [
 | 
			
		||||
                      TextSpan(
 | 
			
		||||
                        text: 'search_suggestion_list_smart_search_hint_1'.tr(),
 | 
			
		||||
                        style: Theme.of(context).textTheme.bodyMedium,
 | 
			
		||||
                      ),
 | 
			
		||||
                      TextSpan(
 | 
			
		||||
                        text: 'search_suggestion_list_smart_search_hint_2'.tr(),
 | 
			
		||||
                        style: Theme.of(context).textTheme.bodyMedium?.copyWith(
 | 
			
		||||
                              color: Theme.of(context).primaryColor,
 | 
			
		||||
                              fontWeight: FontWeight.bold,
 | 
			
		||||
                            ),
 | 
			
		||||
                      )
 | 
			
		||||
                    ],
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
          SliverFillRemaining(
 | 
			
		||||
            hasScrollBody: true,
 | 
			
		||||
            child: ListView.builder(
 | 
			
		||||
              itemBuilder: ((context, index) {
 | 
			
		||||
                return ListTile(
 | 
			
		||||
                  onTap: () {
 | 
			
		||||
                    onSubmitted(searchSuggestion[index]);
 | 
			
		||||
                    onSubmitted("m:${searchSuggestion[index]}");
 | 
			
		||||
                  },
 | 
			
		||||
                  title: Text(searchSuggestion[index]),
 | 
			
		||||
                );
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,16 @@
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/models/store.dart';
 | 
			
		||||
import 'package:immich_mobile/utils/capitalize_first_letter.dart';
 | 
			
		||||
 | 
			
		||||
// ignore: must_be_immutable
 | 
			
		||||
class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
  const ThumbnailWithInfo({
 | 
			
		||||
  ThumbnailWithInfo({
 | 
			
		||||
    Key? key,
 | 
			
		||||
    required this.textInfo,
 | 
			
		||||
    this.imageUrl,
 | 
			
		||||
    this.noImageIcon,
 | 
			
		||||
    this.borderRadius = 10,
 | 
			
		||||
    required this.onTap,
 | 
			
		||||
  }) : super(key: key);
 | 
			
		||||
 | 
			
		||||
@@ -15,6 +18,7 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
  final String? imageUrl;
 | 
			
		||||
  final Function onTap;
 | 
			
		||||
  final IconData? noImageIcon;
 | 
			
		||||
  double borderRadius;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
@@ -29,12 +33,12 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
        children: [
 | 
			
		||||
          Container(
 | 
			
		||||
            decoration: BoxDecoration(
 | 
			
		||||
              borderRadius: BorderRadius.circular(25),
 | 
			
		||||
              borderRadius: BorderRadius.circular(borderRadius),
 | 
			
		||||
              color: isDarkMode ? Colors.grey[900] : Colors.grey[100],
 | 
			
		||||
            ),
 | 
			
		||||
            child: imageUrl != null
 | 
			
		||||
                ? ClipRRect(
 | 
			
		||||
                    borderRadius: BorderRadius.circular(20),
 | 
			
		||||
                    borderRadius: BorderRadius.circular(borderRadius),
 | 
			
		||||
                    child: CachedNetworkImage(
 | 
			
		||||
                      width: double.infinity,
 | 
			
		||||
                      height: double.infinity,
 | 
			
		||||
@@ -55,15 +59,32 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
          ),
 | 
			
		||||
          Container(
 | 
			
		||||
            decoration: BoxDecoration(
 | 
			
		||||
              borderRadius: BorderRadius.circular(borderRadius),
 | 
			
		||||
              color: Colors.white,
 | 
			
		||||
              gradient: LinearGradient(
 | 
			
		||||
                begin: FractionalOffset.topCenter,
 | 
			
		||||
                end: FractionalOffset.bottomCenter,
 | 
			
		||||
                colors: [
 | 
			
		||||
                  Colors.grey.withOpacity(0.0),
 | 
			
		||||
                  textInfo == ''
 | 
			
		||||
                      ? Colors.black.withOpacity(0.1)
 | 
			
		||||
                      : Colors.black.withOpacity(0.5),
 | 
			
		||||
                ],
 | 
			
		||||
                stops: const [0.0, 1.0],
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
          Positioned(
 | 
			
		||||
            bottom: 12,
 | 
			
		||||
            left: 14,
 | 
			
		||||
            child: Text(
 | 
			
		||||
              textInfo,
 | 
			
		||||
              textInfo == '' ? textInfo : textInfo.capitalizeFirstLetter(),
 | 
			
		||||
              style: const TextStyle(
 | 
			
		||||
                color: Colors.white,
 | 
			
		||||
                fontWeight: FontWeight.bold,
 | 
			
		||||
                fontSize: 12,
 | 
			
		||||
                fontSize: 14,
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
        ref.watch(getCuratedObjectProvider);
 | 
			
		||||
    var isDarkTheme = Theme.of(context).brightness == Brightness.dark;
 | 
			
		||||
    double imageSize = MediaQuery.of(context).size.width / 3;
 | 
			
		||||
 | 
			
		||||
    TextStyle categoryTitleStyle = const TextStyle(
 | 
			
		||||
      fontWeight: FontWeight.bold,
 | 
			
		||||
      fontSize: 14.0,
 | 
			
		||||
@@ -46,7 +47,11 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
      searchFocusNode.unfocus();
 | 
			
		||||
      ref.watch(searchPageStateProvider.notifier).disableSearch();
 | 
			
		||||
 | 
			
		||||
      AutoRouter.of(context).push(SearchResultRoute(searchTerm: searchTerm));
 | 
			
		||||
      AutoRouter.of(context).push(
 | 
			
		||||
        SearchResultRoute(
 | 
			
		||||
          searchTerm: searchTerm,
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    buildPlaces() {
 | 
			
		||||
@@ -67,7 +72,9 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
            imageSize: imageSize,
 | 
			
		||||
            onTap: (content, index) {
 | 
			
		||||
              AutoRouter.of(context).push(
 | 
			
		||||
                SearchResultRoute(searchTerm: content.label),
 | 
			
		||||
                SearchResultRoute(
 | 
			
		||||
                  searchTerm: 'm:${content.label}',
 | 
			
		||||
                ),
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
          ),
 | 
			
		||||
@@ -99,7 +106,9 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
            imageSize: imageSize,
 | 
			
		||||
            onTap: (content, index) {
 | 
			
		||||
              AutoRouter.of(context).push(
 | 
			
		||||
                SearchResultRoute(searchTerm: content.label),
 | 
			
		||||
                SearchResultRoute(
 | 
			
		||||
                  searchTerm: 'm:${content.label}',
 | 
			
		||||
                ),
 | 
			
		||||
              );
 | 
			
		||||
            },
 | 
			
		||||
          ),
 | 
			
		||||
@@ -131,7 +140,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    children: [
 | 
			
		||||
                      Text(
 | 
			
		||||
                        "search_page_places",
 | 
			
		||||
                        style: Theme.of(context).textTheme.titleMedium,
 | 
			
		||||
                        style: Theme.of(context).textTheme.titleSmall,
 | 
			
		||||
                      ).tr(),
 | 
			
		||||
                      TextButton(
 | 
			
		||||
                        child: Text(
 | 
			
		||||
@@ -162,7 +171,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    children: [
 | 
			
		||||
                      Text(
 | 
			
		||||
                        "search_page_things",
 | 
			
		||||
                        style: Theme.of(context).textTheme.titleMedium,
 | 
			
		||||
                        style: Theme.of(context).textTheme.titleSmall,
 | 
			
		||||
                      ).tr(),
 | 
			
		||||
                      TextButton(
 | 
			
		||||
                        child: Text(
 | 
			
		||||
@@ -186,7 +195,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                  padding: const EdgeInsets.symmetric(horizontal: 16),
 | 
			
		||||
                  child: Text(
 | 
			
		||||
                    'search_page_your_activity',
 | 
			
		||||
                    style: Theme.of(context).textTheme.titleMedium,
 | 
			
		||||
                    style: Theme.of(context).textTheme.titleSmall,
 | 
			
		||||
                  ).tr(),
 | 
			
		||||
                ),
 | 
			
		||||
                ListTile(
 | 
			
		||||
@@ -201,13 +210,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    const FavoritesRoute(),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                const Padding(
 | 
			
		||||
                  padding: EdgeInsets.only(
 | 
			
		||||
                    left: 72,
 | 
			
		||||
                    right: 16,
 | 
			
		||||
                  ),
 | 
			
		||||
                  child: Divider(),
 | 
			
		||||
                ),
 | 
			
		||||
                const CategoryDivider(),
 | 
			
		||||
                ListTile(
 | 
			
		||||
                  leading: Icon(
 | 
			
		||||
                    Icons.schedule_outlined,
 | 
			
		||||
@@ -226,9 +229,36 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                  padding: const EdgeInsets.symmetric(horizontal: 16.0),
 | 
			
		||||
                  child: Text(
 | 
			
		||||
                    'search_page_categories',
 | 
			
		||||
                    style: Theme.of(context).textTheme.titleMedium,
 | 
			
		||||
                    style: Theme.of(context).textTheme.titleSmall,
 | 
			
		||||
                  ).tr(),
 | 
			
		||||
                ),
 | 
			
		||||
                ListTile(
 | 
			
		||||
                  title: Text('Screenshots', style: categoryTitleStyle).tr(),
 | 
			
		||||
                  leading: Icon(
 | 
			
		||||
                    Icons.screenshot,
 | 
			
		||||
                    color: categoryIconColor,
 | 
			
		||||
                  ),
 | 
			
		||||
                  onTap: () => AutoRouter.of(context).push(
 | 
			
		||||
                    SearchResultRoute(
 | 
			
		||||
                      searchTerm: 'screenshots',
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                const CategoryDivider(),
 | 
			
		||||
                ListTile(
 | 
			
		||||
                  title: Text('search_page_selfies', style: categoryTitleStyle)
 | 
			
		||||
                      .tr(),
 | 
			
		||||
                  leading: Icon(
 | 
			
		||||
                    Icons.photo_camera_front_outlined,
 | 
			
		||||
                    color: categoryIconColor,
 | 
			
		||||
                  ),
 | 
			
		||||
                  onTap: () => AutoRouter.of(context).push(
 | 
			
		||||
                    SearchResultRoute(
 | 
			
		||||
                      searchTerm: 'selfies',
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                const CategoryDivider(),
 | 
			
		||||
                ListTile(
 | 
			
		||||
                  title: Text('search_page_videos', style: categoryTitleStyle)
 | 
			
		||||
                      .tr(),
 | 
			
		||||
@@ -240,13 +270,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    const AllVideosRoute(),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                const Padding(
 | 
			
		||||
                  padding: EdgeInsets.only(
 | 
			
		||||
                    left: 72,
 | 
			
		||||
                    right: 16,
 | 
			
		||||
                  ),
 | 
			
		||||
                  child: Divider(),
 | 
			
		||||
                ),
 | 
			
		||||
                const CategoryDivider(),
 | 
			
		||||
                ListTile(
 | 
			
		||||
                  title: Text(
 | 
			
		||||
                    'search_page_motion_photos',
 | 
			
		||||
@@ -270,3 +294,20 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class CategoryDivider extends StatelessWidget {
 | 
			
		||||
  const CategoryDivider({super.key});
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    return const Padding(
 | 
			
		||||
      padding: EdgeInsets.only(
 | 
			
		||||
        left: 72,
 | 
			
		||||
        right: 16,
 | 
			
		||||
      ),
 | 
			
		||||
      child: Divider(
 | 
			
		||||
        height: 0,
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,12 +6,30 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/home/ui/asset_grid/immich_asset_grid.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/search/providers/search_page_state.provider.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/search/providers/search_result_page.provider.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/search/ui/search_result_grid.dart';
 | 
			
		||||
import 'package:immich_mobile/modules/search/ui/search_suggestion_list.dart';
 | 
			
		||||
import 'package:immich_mobile/shared/ui/immich_loading_indicator.dart';
 | 
			
		||||
 | 
			
		||||
class SearchType {
 | 
			
		||||
  SearchType({required this.isClip, required this.searchTerm});
 | 
			
		||||
 | 
			
		||||
  final bool isClip;
 | 
			
		||||
  final String searchTerm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SearchType _getSearchType(String searchTerm) {
 | 
			
		||||
  if (searchTerm.startsWith('m:')) {
 | 
			
		||||
    return SearchType(isClip: false, searchTerm: searchTerm.substring(2));
 | 
			
		||||
  } else {
 | 
			
		||||
    return SearchType(isClip: true, searchTerm: searchTerm);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
  const SearchResultPage({Key? key, required this.searchTerm})
 | 
			
		||||
      : super(key: key);
 | 
			
		||||
  const SearchResultPage({
 | 
			
		||||
    Key? key,
 | 
			
		||||
    required this.searchTerm,
 | 
			
		||||
  }) : super(key: key);
 | 
			
		||||
 | 
			
		||||
  final String searchTerm;
 | 
			
		||||
 | 
			
		||||
@@ -20,6 +38,8 @@ class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
    final searchTermController = useTextEditingController(text: "");
 | 
			
		||||
    final isNewSearch = useState(false);
 | 
			
		||||
    final currentSearchTerm = useState(searchTerm);
 | 
			
		||||
    final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
 | 
			
		||||
    final isDisplayDateGroup = useState(true);
 | 
			
		||||
 | 
			
		||||
    FocusNode? searchFocusNode;
 | 
			
		||||
 | 
			
		||||
@@ -27,9 +47,16 @@ class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
      () {
 | 
			
		||||
        searchFocusNode = FocusNode();
 | 
			
		||||
 | 
			
		||||
        var searchType = _getSearchType(searchTerm);
 | 
			
		||||
        searchType.isClip
 | 
			
		||||
            ? isDisplayDateGroup.value = false
 | 
			
		||||
            : isDisplayDateGroup.value = true;
 | 
			
		||||
 | 
			
		||||
        Future.delayed(
 | 
			
		||||
          Duration.zero,
 | 
			
		||||
          () => ref.read(searchResultPageProvider.notifier).search(searchTerm),
 | 
			
		||||
          () => ref
 | 
			
		||||
              .read(searchResultPageProvider.notifier)
 | 
			
		||||
              .search(searchType.searchTerm, clipEnable: searchType.isClip),
 | 
			
		||||
        );
 | 
			
		||||
        return () => searchFocusNode?.dispose();
 | 
			
		||||
      },
 | 
			
		||||
@@ -41,7 +68,15 @@ class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
      searchFocusNode?.unfocus();
 | 
			
		||||
      isNewSearch.value = false;
 | 
			
		||||
      currentSearchTerm.value = newSearchTerm;
 | 
			
		||||
      ref.watch(searchResultPageProvider.notifier).search(newSearchTerm);
 | 
			
		||||
 | 
			
		||||
      var searchType = _getSearchType(newSearchTerm);
 | 
			
		||||
      searchType.isClip
 | 
			
		||||
          ? isDisplayDateGroup.value = false
 | 
			
		||||
          : isDisplayDateGroup.value = true;
 | 
			
		||||
 | 
			
		||||
      ref
 | 
			
		||||
          .watch(searchResultPageProvider.notifier)
 | 
			
		||||
          .search(searchType.searchTerm, clipEnable: searchType.isClip);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    buildTextField() {
 | 
			
		||||
@@ -74,6 +109,12 @@ class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
          focusedBorder: const UnderlineInputBorder(
 | 
			
		||||
            borderSide: BorderSide(color: Colors.transparent),
 | 
			
		||||
          ),
 | 
			
		||||
          hintStyle: TextStyle(
 | 
			
		||||
            fontWeight: FontWeight.bold,
 | 
			
		||||
            fontSize: 16.0,
 | 
			
		||||
            color:
 | 
			
		||||
                isDarkTheme ? Colors.grey[500] : Colors.black.withOpacity(0.5),
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
@@ -121,11 +162,16 @@ class SearchResultPage extends HookConsumerWidget {
 | 
			
		||||
        return const Center(child: ImmichLoadingIndicator());
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      if (searchResultPageState.isSuccess) {
 | 
			
		||||
        return ImmichAssetGrid(
 | 
			
		||||
        if (isDisplayDateGroup.value) {
 | 
			
		||||
          return ImmichAssetGrid(
 | 
			
		||||
            assets: allSearchAssets,
 | 
			
		||||
        );
 | 
			
		||||
          );
 | 
			
		||||
        } else {
 | 
			
		||||
          return SearchResultGrid(
 | 
			
		||||
            assets: allSearchAssets,
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return const SizedBox();
 | 
			
		||||
 
 | 
			
		||||
@@ -144,14 +144,9 @@ class _$AppRouter extends RootStackRouter {
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    RecentlyAddedRoute.name: (routeData) {
 | 
			
		||||
      return CustomPage<dynamic>(
 | 
			
		||||
      return MaterialPageX<dynamic>(
 | 
			
		||||
        routeData: routeData,
 | 
			
		||||
        child: const RecentlyAddedPage(),
 | 
			
		||||
        transitionsBuilder: TransitionsBuilders.noTransition,
 | 
			
		||||
        durationInMilliseconds: 200,
 | 
			
		||||
        reverseDurationInMilliseconds: 200,
 | 
			
		||||
        opaque: true,
 | 
			
		||||
        barrierDismissible: false,
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    AssetSelectionRoute.name: (routeData) {
 | 
			
		||||
 
 | 
			
		||||
@@ -79,6 +79,7 @@ ThemeData immichLightTheme = ThemeData(
 | 
			
		||||
    ),
 | 
			
		||||
    titleSmall: TextStyle(
 | 
			
		||||
      fontSize: 16.0,
 | 
			
		||||
      fontWeight: FontWeight.bold,
 | 
			
		||||
    ),
 | 
			
		||||
    titleMedium: TextStyle(
 | 
			
		||||
      fontSize: 18.0,
 | 
			
		||||
@@ -176,6 +177,7 @@ ThemeData immichDarkTheme = ThemeData(
 | 
			
		||||
    ),
 | 
			
		||||
    titleSmall: const TextStyle(
 | 
			
		||||
      fontSize: 16.0,
 | 
			
		||||
      fontWeight: FontWeight.bold,
 | 
			
		||||
    ),
 | 
			
		||||
    titleMedium: const TextStyle(
 | 
			
		||||
      fontSize: 18.0,
 | 
			
		||||
@@ -185,7 +187,6 @@ ThemeData immichDarkTheme = ThemeData(
 | 
			
		||||
      fontSize: 26.0,
 | 
			
		||||
      fontWeight: FontWeight.bold,
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
  ),
 | 
			
		||||
  cardColor: Colors.grey[900],
 | 
			
		||||
  elevatedButtonTheme: ElevatedButtonThemeData(
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								mobile/openapi/lib/model/job_command.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								mobile/openapi/lib/model/job_command.dart
									
									
									
										generated
									
									
									
								
							@@ -25,12 +25,14 @@ class JobCommand {
 | 
			
		||||
 | 
			
		||||
  static const start = JobCommand._(r'start');
 | 
			
		||||
  static const pause = JobCommand._(r'pause');
 | 
			
		||||
  static const resume = JobCommand._(r'resume');
 | 
			
		||||
  static const empty = JobCommand._(r'empty');
 | 
			
		||||
 | 
			
		||||
  /// List of all possible values in this [enum][JobCommand].
 | 
			
		||||
  static const values = <JobCommand>[
 | 
			
		||||
    start,
 | 
			
		||||
    pause,
 | 
			
		||||
    resume,
 | 
			
		||||
    empty,
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
@@ -72,6 +74,7 @@ class JobCommandTypeTransformer {
 | 
			
		||||
      switch (data.toString()) {
 | 
			
		||||
        case r'start': return JobCommand.start;
 | 
			
		||||
        case r'pause': return JobCommand.pause;
 | 
			
		||||
        case r'resume': return JobCommand.resume;
 | 
			
		||||
        case r'empty': return JobCommand.empty;
 | 
			
		||||
        default:
 | 
			
		||||
          if (!allowNull) {
 | 
			
		||||
 
 | 
			
		||||
@@ -187,6 +187,16 @@ class MockAssetNotifier extends _i1.Mock implements _i2.AssetNotifier {
 | 
			
		||||
        returnValueForMissingStub: _i5.Future<void>.value(),
 | 
			
		||||
      ) as _i5.Future<void>);
 | 
			
		||||
  @override
 | 
			
		||||
  _i5.Future<void> getAllAsset({bool? clear = false}) => (super.noSuchMethod(
 | 
			
		||||
        Invocation.method(
 | 
			
		||||
          #getAllAsset,
 | 
			
		||||
          [],
 | 
			
		||||
          {#clear: clear},
 | 
			
		||||
        ),
 | 
			
		||||
        returnValue: _i5.Future<void>.value(),
 | 
			
		||||
        returnValueForMissingStub: _i5.Future<void>.value(),
 | 
			
		||||
      ) as _i5.Future<void>);
 | 
			
		||||
  @override
 | 
			
		||||
  _i5.Future<void> clearAllAsset() => (super.noSuchMethod(
 | 
			
		||||
        Invocation.method(
 | 
			
		||||
          #clearAllAsset,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,7 @@ import { DisablePasswordLoginCommand, EnablePasswordLoginCommand } from './comma
 | 
			
		||||
import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command';
 | 
			
		||||
 | 
			
		||||
@Module({
 | 
			
		||||
  imports: [
 | 
			
		||||
    DomainModule.register({
 | 
			
		||||
      imports: [InfraModule],
 | 
			
		||||
    }),
 | 
			
		||||
  ],
 | 
			
		||||
  imports: [DomainModule.register({ imports: [InfraModule] })],
 | 
			
		||||
  providers: [
 | 
			
		||||
    ResetAdminPasswordCommand,
 | 
			
		||||
    PromptPasswordQuestions,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import { AlbumEntity, AssetEntity, dataSource, UserEntity } from '@app/infra';
 | 
			
		||||
import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { dataSource } from '@app/infra/db/config';
 | 
			
		||||
import { Injectable } from '@nestjs/common';
 | 
			
		||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
			
		||||
import { Repository } from 'typeorm';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
 | 
			
		||||
import { AlbumService } from './album.service';
 | 
			
		||||
import { AlbumController } from './album.controller';
 | 
			
		||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
			
		||||
import { AlbumEntity, AssetEntity } from '@app/infra';
 | 
			
		||||
import { AlbumEntity, AssetEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { AlbumRepository, IAlbumRepository } from './album-repository';
 | 
			
		||||
import { DownloadModule } from '../../modules/download/download.module';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { AlbumService } from './album.service';
 | 
			
		||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
			
		||||
import { BadRequestException, NotFoundException, ForbiddenException } from '@nestjs/common';
 | 
			
		||||
import { AlbumEntity, UserEntity } from '@app/infra';
 | 
			
		||||
import { AlbumEntity, UserEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { AlbumResponseDto, ICryptoRepository, IJobRepository, JobName, mapUser } from '@app/domain';
 | 
			
		||||
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
 | 
			
		||||
import { IAlbumRepository } from './album-repository';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException, Logger } from '@nestjs/common';
 | 
			
		||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
			
		||||
import { CreateAlbumDto } from './dto/create-album.dto';
 | 
			
		||||
import { AlbumEntity, SharedLinkType } from '@app/infra';
 | 
			
		||||
import { AlbumEntity, SharedLinkType } from '@app/infra/db/entities';
 | 
			
		||||
import { AddUsersDto } from './dto/add-users.dto';
 | 
			
		||||
import { RemoveAssetsDto } from './dto/remove-assets.dto';
 | 
			
		||||
import { UpdateAlbumDto } from './dto/update-album.dto';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { SearchPropertiesDto } from './dto/search-properties.dto';
 | 
			
		||||
import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra/db/entities';
 | 
			
		||||
import { Inject, Injectable } from '@nestjs/common';
 | 
			
		||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
			
		||||
import { Repository } from 'typeorm/repository/Repository';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
 | 
			
		||||
import { AssetService } from './asset.service';
 | 
			
		||||
import { AssetController } from './asset.controller';
 | 
			
		||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
			
		||||
import { AssetEntity } from '@app/infra';
 | 
			
		||||
import { AssetEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { AssetRepository, IAssetRepository } from './asset-repository';
 | 
			
		||||
import { DownloadModule } from '../../modules/download/download.module';
 | 
			
		||||
import { TagModule } from '../tag/tag.module';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { IAssetRepository } from './asset-repository';
 | 
			
		||||
import { AssetService } from './asset.service';
 | 
			
		||||
import { QueryFailedError, Repository } from 'typeorm';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra/db/entities';
 | 
			
		||||
import { CreateAssetDto } from './dto/create-asset.dto';
 | 
			
		||||
import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto';
 | 
			
		||||
import { TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto';
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import {
 | 
			
		||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
			
		||||
import { QueryFailedError, Repository } from 'typeorm';
 | 
			
		||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
			
		||||
import { AssetEntity, AssetType, SharedLinkType, SystemConfig } from '@app/infra';
 | 
			
		||||
import { AssetEntity, AssetType, SharedLinkType, SystemConfig } from '@app/infra/db/entities';
 | 
			
		||||
import { constants, createReadStream, stat } from 'fs';
 | 
			
		||||
import { ServeFileDto } from './dto/serve-file.dto';
 | 
			
		||||
import { Response as Res } from 'express';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { AssetType } from '@app/infra';
 | 
			
		||||
import { AssetType } from '@app/infra/db/entities';
 | 
			
		||||
import { ApiProperty } from '@nestjs/swagger';
 | 
			
		||||
import { IsBoolean, IsEnum, IsNotEmpty, IsOptional } from 'class-validator';
 | 
			
		||||
import { ImmichFile } from '../../../config/asset-upload.config';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { TagType } from '@app/infra';
 | 
			
		||||
import { TagType } from '@app/infra/db/entities';
 | 
			
		||||
import { ApiProperty } from '@nestjs/swagger';
 | 
			
		||||
import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { Module } from '@nestjs/common';
 | 
			
		||||
import { TagService } from './tag.service';
 | 
			
		||||
import { TagController } from './tag.controller';
 | 
			
		||||
import { TagEntity } from '@app/infra';
 | 
			
		||||
import { TagEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
			
		||||
import { TagRepository, ITagRepository } from './tag.repository';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { TagEntity, TagType } from '@app/infra';
 | 
			
		||||
import { TagEntity, TagType } from '@app/infra/db/entities';
 | 
			
		||||
import { Injectable } from '@nestjs/common';
 | 
			
		||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
			
		||||
import { In, Repository } from 'typeorm';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { TagEntity, TagType, UserEntity } from '@app/infra';
 | 
			
		||||
import { TagEntity, TagType, UserEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
			
		||||
import { ITagRepository } from './tag.repository';
 | 
			
		||||
import { TagService } from './tag.service';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { TagEntity } from '@app/infra';
 | 
			
		||||
import { TagEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
 | 
			
		||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
			
		||||
import { CreateTagDto } from './dto/create-tag.dto';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
import { immichAppConfig } from '@app/domain';
 | 
			
		||||
import { Module, OnModuleInit } from '@nestjs/common';
 | 
			
		||||
import { AssetModule } from './api-v1/asset/asset.module';
 | 
			
		||||
import { ConfigModule } from '@nestjs/config';
 | 
			
		||||
import { AlbumModule } from './api-v1/album/album.module';
 | 
			
		||||
import { AppController } from './app.controller';
 | 
			
		||||
import { ScheduleModule } from '@nestjs/schedule';
 | 
			
		||||
@@ -27,7 +25,6 @@ import { AppCronJobs } from './app.cron-jobs';
 | 
			
		||||
 | 
			
		||||
@Module({
 | 
			
		||||
  imports: [
 | 
			
		||||
    ConfigModule.forRoot(immichAppConfig),
 | 
			
		||||
    DomainModule.register({ imports: [InfraModule] }),
 | 
			
		||||
    AssetModule,
 | 
			
		||||
    AlbumModule,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { AssetEntity } from '@app/infra';
 | 
			
		||||
import { AssetEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common';
 | 
			
		||||
import archiver from 'archiver';
 | 
			
		||||
import { extname } from 'path';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,7 @@
 | 
			
		||||
import { immichAppConfig } from '@app/domain';
 | 
			
		||||
import { DomainModule } from '@app/domain';
 | 
			
		||||
import { ExifEntity, InfraModule } from '@app/infra';
 | 
			
		||||
import { InfraModule } from '@app/infra';
 | 
			
		||||
import { ExifEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { Module } from '@nestjs/common';
 | 
			
		||||
import { ConfigModule } from '@nestjs/config';
 | 
			
		||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
			
		||||
import {
 | 
			
		||||
  BackgroundTaskProcessor,
 | 
			
		||||
@@ -17,7 +16,7 @@ import { VideoTranscodeProcessor } from './processors/video-transcode.processor'
 | 
			
		||||
 | 
			
		||||
@Module({
 | 
			
		||||
  imports: [
 | 
			
		||||
    ConfigModule.forRoot(immichAppConfig),
 | 
			
		||||
    //
 | 
			
		||||
    DomainModule.register({ imports: [InfraModule] }),
 | 
			
		||||
    TypeOrmModule.forFeature([ExifEntity]),
 | 
			
		||||
  ],
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ import {
 | 
			
		||||
  QueueName,
 | 
			
		||||
  WithoutProperty,
 | 
			
		||||
} from '@app/domain';
 | 
			
		||||
import { AssetEntity, AssetType, ExifEntity } from '@app/infra';
 | 
			
		||||
import { AssetEntity, AssetType, ExifEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { Process, Processor } from '@nestjs/bull';
 | 
			
		||||
import { Inject, Logger } from '@nestjs/common';
 | 
			
		||||
import { ConfigService } from '@nestjs/config';
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import {
 | 
			
		||||
  SystemConfigService,
 | 
			
		||||
  WithoutProperty,
 | 
			
		||||
} from '@app/domain';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra';
 | 
			
		||||
import { AssetEntity, AssetType } from '@app/infra/db/entities';
 | 
			
		||||
import { Process, Processor } from '@nestjs/bull';
 | 
			
		||||
import { Inject, Logger } from '@nestjs/common';
 | 
			
		||||
import { Job } from 'bull';
 | 
			
		||||
 
 | 
			
		||||
@@ -4141,6 +4141,7 @@
 | 
			
		||||
        "enum": [
 | 
			
		||||
          "start",
 | 
			
		||||
          "pause",
 | 
			
		||||
          "resume",
 | 
			
		||||
          "empty"
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { AlbumEntity } from '@app/infra';
 | 
			
		||||
import { AlbumEntity } from '@app/infra/db/entities';
 | 
			
		||||
import { Inject, Injectable } from '@nestjs/common';
 | 
			
		||||
import { IAssetRepository } from '../asset';
 | 
			
		||||
import { AuthUserDto } from '../auth';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { DynamicModule, Global, Module, ModuleMetadata, Provider } from '@nestjs/common';
 | 
			
		||||
import { DynamicModule, Global, Module, ModuleMetadata, OnApplicationShutdown, Provider } from '@nestjs/common';
 | 
			
		||||
import { AlbumService } from './album';
 | 
			
		||||
import { APIKeyService } from './api-key';
 | 
			
		||||
import { AssetService } from './asset';
 | 
			
		||||
@@ -44,7 +44,9 @@ const providers: Provider[] = [
 | 
			
		||||
 | 
			
		||||
@Global()
 | 
			
		||||
@Module({})
 | 
			
		||||
export class DomainModule {
 | 
			
		||||
export class DomainModule implements OnApplicationShutdown {
 | 
			
		||||
  constructor(private searchService: SearchService) {}
 | 
			
		||||
 | 
			
		||||
  static register(options: Pick<ModuleMetadata, 'imports'>): DynamicModule {
 | 
			
		||||
    return {
 | 
			
		||||
      module: DomainModule,
 | 
			
		||||
@@ -53,4 +55,8 @@ export class DomainModule {
 | 
			
		||||
      exports: [...providers],
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onApplicationShutdown() {
 | 
			
		||||
    this.searchService.teardown();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ export enum QueueName {
 | 
			
		||||
export enum JobCommand {
 | 
			
		||||
  START = 'start',
 | 
			
		||||
  PAUSE = 'pause',
 | 
			
		||||
  RESUME = 'resume',
 | 
			
		||||
  EMPTY = 'empty',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,7 @@ export const IJobRepository = 'IJobRepository';
 | 
			
		||||
export interface IJobRepository {
 | 
			
		||||
  queue(item: JobItem): Promise<void>;
 | 
			
		||||
  pause(name: QueueName): Promise<void>;
 | 
			
		||||
  resume(name: QueueName): Promise<void>;
 | 
			
		||||
  empty(name: QueueName): Promise<void>;
 | 
			
		||||
  isActive(name: QueueName): Promise<boolean>;
 | 
			
		||||
  getJobCounts(name: QueueName): Promise<JobCounts>;
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,12 @@ describe(JobService.name, () => {
 | 
			
		||||
      expect(jobMock.pause).toHaveBeenCalledWith(QueueName.METADATA_EXTRACTION);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('should handle a resume command', async () => {
 | 
			
		||||
      await sut.handleCommand(QueueName.METADATA_EXTRACTION, { command: JobCommand.RESUME, force: false });
 | 
			
		||||
 | 
			
		||||
      expect(jobMock.resume).toHaveBeenCalledWith(QueueName.METADATA_EXTRACTION);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('should handle an empty command', async () => {
 | 
			
		||||
      await sut.handleCommand(QueueName.METADATA_EXTRACTION, { command: JobCommand.EMPTY, force: false });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,9 @@ export class JobService {
 | 
			
		||||
      case JobCommand.PAUSE:
 | 
			
		||||
        return this.jobRepository.pause(queueName);
 | 
			
		||||
 | 
			
		||||
      case JobCommand.RESUME:
 | 
			
		||||
        return this.jobRepository.resume(queueName);
 | 
			
		||||
 | 
			
		||||
      case JobCommand.EMPTY:
 | 
			
		||||
        return this.jobRepository.empty(queueName);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ export const newJobRepositoryMock = (): jest.Mocked<IJobRepository> => {
 | 
			
		||||
  return {
 | 
			
		||||
    empty: jest.fn(),
 | 
			
		||||
    pause: jest.fn(),
 | 
			
		||||
    resume: jest.fn(),
 | 
			
		||||
    queue: jest.fn().mockImplementation(() => Promise.resolve()),
 | 
			
		||||
    isActive: jest.fn(),
 | 
			
		||||
    getJobCounts: jest.fn(),
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ import {
 | 
			
		||||
  IKeyRepository,
 | 
			
		||||
  IMachineLearningRepository,
 | 
			
		||||
  IMediaRepository,
 | 
			
		||||
  immichAppConfig,
 | 
			
		||||
  ISearchRepository,
 | 
			
		||||
  ISharedLinkRepository,
 | 
			
		||||
  ISmartInfoRepository,
 | 
			
		||||
@@ -19,6 +20,7 @@ import {
 | 
			
		||||
} from '@app/domain';
 | 
			
		||||
import { BullModule } from '@nestjs/bull';
 | 
			
		||||
import { Global, Module, Provider } from '@nestjs/common';
 | 
			
		||||
import { ConfigModule } from '@nestjs/config';
 | 
			
		||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
			
		||||
import { CryptoRepository } from './auth/crypto.repository';
 | 
			
		||||
import { CommunicationGateway, CommunicationRepository } from './communication';
 | 
			
		||||
@@ -71,6 +73,8 @@ const providers: Provider[] = [
 | 
			
		||||
@Global()
 | 
			
		||||
@Module({
 | 
			
		||||
  imports: [
 | 
			
		||||
    ConfigModule.forRoot(immichAppConfig),
 | 
			
		||||
 | 
			
		||||
    TypeOrmModule.forRoot(databaseConfig),
 | 
			
		||||
    TypeOrmModule.forFeature([
 | 
			
		||||
      AssetEntity,
 | 
			
		||||
@@ -83,6 +87,7 @@ const providers: Provider[] = [
 | 
			
		||||
      SystemConfigEntity,
 | 
			
		||||
      UserTokenEntity,
 | 
			
		||||
    ]),
 | 
			
		||||
 | 
			
		||||
    BullModule.forRootAsync({
 | 
			
		||||
      useFactory: async () => ({
 | 
			
		||||
        prefix: 'immich_bull',
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,10 @@ export class JobRepository implements IJobRepository {
 | 
			
		||||
    return this.queueMap[name].pause();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  resume(name: QueueName) {
 | 
			
		||||
    return this.queueMap[name].resume();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  empty(name: QueueName) {
 | 
			
		||||
    return this.queueMap[name].empty();
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							@@ -1222,6 +1222,7 @@ export interface GetAssetCountByTimeBucketDto {
 | 
			
		||||
export const JobCommand = {
 | 
			
		||||
    Start: 'start',
 | 
			
		||||
    Pause: 'pause',
 | 
			
		||||
    Resume: 'resume',
 | 
			
		||||
    Empty: 'empty'
 | 
			
		||||
} as const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user