From fe00ba0a0cb35f4daeff8d986bf7d100186b35d5 Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年10月24日 07:57:24 +0100 Subject: [PATCH 1/4] docs: remove changelog in favor of GitHub releases page Removed the existing CHANGELOG.md file to encourage the use of the GitHub releases page for tracking changes and updates. --- CHANGELOG.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e0a360e..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,13 +0,0 @@ -# Changelog - -## Upcoming Release - -- **fix**: prevent race condition during concurrent dependency initialization. - -## 1.0.1 - 2025年10月17日 - -- **chore**: A new migration ensures that existing user preference documents are updated to include the savedFilters field, initialized as an empty array. - -## 1.0.0 - 2025年10月13日 - -- **chore!**: initial release under semantic versioning. \ No newline at end of file From bd1bd12112b937f109bb55a9171867e471cb40db Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年10月24日 07:58:09 +0100 Subject: [PATCH 2/4] feat(database): add logoUrl field to existing sources - New migration to add logoUrl field to sources collection - Uses Clearbit Logo API to generate logo URLs based on source website URLs - Updates 66 files, adds 1 new migration file --- ...0251024000000_add_logo_url_to_sources.dart | 66 +++++++++++++++++++ .../database/migrations/all_migrations.dart | 2 + 2 files changed, 68 insertions(+) create mode 100644 lib/src/database/migrations/20251024000000_add_logo_url_to_sources.dart diff --git a/lib/src/database/migrations/20251024000000_add_logo_url_to_sources.dart b/lib/src/database/migrations/20251024000000_add_logo_url_to_sources.dart new file mode 100644 index 0000000..914173d --- /dev/null +++ b/lib/src/database/migrations/20251024000000_add_logo_url_to_sources.dart @@ -0,0 +1,66 @@ +import 'package:flutter_news_app_api_server_full_source_code/src/database/migration.dart'; +import 'package:logging/logging.dart'; +import 'package:mongo_dart/mongo_dart.dart'; + +/// Migration to add the `logoUrl` field to existing `sources` documents. +class AddLogoUrlToSources extends Migration { + /// {@macro add_logo_url_to_sources} + AddLogoUrlToSources() + : super( + prDate: '20251024000000', + prId: '60', + prSummary: + 'Adds the required `logoUrl` field to all existing ' + 'documents in the `sources` collection to align with the ' + 'core v1.3.0 model update.', + ); + + @override + Future up(Db db, Logger log) async { + final collection = db.collection('sources'); + final sourcesToUpdate = await collection + .find(where.notExists('logoUrl')) + .toList(); + + if (sourcesToUpdate.isEmpty) { + log.info('No sources found needing a logoUrl. Migration is up to date.'); + return; + } + + log.info( + 'Found ${sourcesToUpdate.length} sources to update with a logoUrl.', + ); + var count = 0; + for (final source in sourcesToUpdate) { + final sourceUrl = source['url'] as String?; + if (sourceUrl != null && sourceUrl.isNotEmpty) { + try { + final host = Uri.parse(sourceUrl).host; + final logoUrl = 'https://logo.clearbit.com/$host?size=200'; + await collection.updateOne( + where.id(source['_id'] as ObjectId), + modify.set('logoUrl', logoUrl), + ); + count++; + } catch (e) { + log.warning( + 'Could not parse URL for source ${source['_id']}: $sourceUrl', + ); + } + } + } + log.info('Updated $count sources with a new logoUrl.'); + } + + @override + Future down(Db db, Logger log) async { + final collection = db.collection('sources'); + await collection.updateMany( + where.exists('logoUrl'), + modify.unset('logoUrl'), + ); + log.info( + 'Removed "logoUrl" field from all documents in the sources collection.', + ); + } +} diff --git a/lib/src/database/migrations/all_migrations.dart b/lib/src/database/migrations/all_migrations.dart index 699d2dc..d9e88a5 100644 --- a/lib/src/database/migrations/all_migrations.dart +++ b/lib/src/database/migrations/all_migrations.dart @@ -1,5 +1,6 @@ import 'package:flutter_news_app_api_server_full_source_code/src/database/migration.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20250924084800__refactor_ad_config_to_role_based.dart'; +import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251024000000_add_logo_url_to_sources.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251013000056_add_saved_filters_to_user_preferences.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251013000057_add_saved_filters_to_remote_config.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/services/database_migration_service.dart' @@ -14,4 +15,5 @@ final List allMigrations = [ RefactorAdConfigToRoleBased(), AddSavedFiltersToUserPreferences(), AddSavedFiltersToRemoteConfig(), + AddLogoUrlToSources(), ]; From e47ac8c3b178d0d69231eb7f9dab6bfc3ef4e85a Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年10月24日 08:03:06 +0100 Subject: [PATCH 3/4] build(deps): update core dependency to v1.3.0 - Bump core dependency from v1.2.0 to v1.3.0 - Update package version from 1.0.1 to 1.1.0 - Add dependency_overrides for core package --- pubspec.lock | 6 +++--- pubspec.yaml | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 243c0c3..88078da 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -117,11 +117,11 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.2.0" - resolved-ref: d052799c1ebb7bcdd1a725a2a7919948c14fa001 + ref: "v1.3.0" + resolved-ref: ee2ad7de28baec04d64c0afd3e3a61d7e4ad6cb0 url: "https://github.com/flutter-news-app-full-source-code/core.git" source: git - version: "1.2.0" + version: "1.3.0" coverage: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0f18913..6e9aefe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_news_app_api_server_full_source_code description: The complete backend API server for the Flutter News App Toolkit, built with Dart Frog. Powers authentication, data management, user settings, and more. repository: https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code publish_to: none -version: 1.0.1 +version: 1.1.0 environment: sdk: ^3.9.0 @@ -12,7 +12,7 @@ dependencies: core: git: url: https://github.com/flutter-news-app-full-source-code/core.git - ref: v1.2.0 + ref: v1.3.0 dart_frog: ^1.1.0 dart_jsonwebtoken: ^3.2.0 data_client: @@ -54,3 +54,9 @@ dev_dependencies: mocktail: ^1.0.3 test: ^1.25.5 very_good_analysis: ^9.0.0 + +dependency_overrides: + core: + git: + url: https://github.com/flutter-news-app-full-source-code/core.git + ref: v1.3.0 From a65e33e21f418cc224aa0a4113ea01c7ca4ce192 Mon Sep 17 00:00:00 2001 From: fulleni Date: 2025年10月24日 08:03:21 +0100 Subject: [PATCH 4/4] style: format --- lib/src/database/migrations/all_migrations.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/database/migrations/all_migrations.dart b/lib/src/database/migrations/all_migrations.dart index d9e88a5..2ab7f5c 100644 --- a/lib/src/database/migrations/all_migrations.dart +++ b/lib/src/database/migrations/all_migrations.dart @@ -1,8 +1,8 @@ import 'package:flutter_news_app_api_server_full_source_code/src/database/migration.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20250924084800__refactor_ad_config_to_role_based.dart'; -import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251024000000_add_logo_url_to_sources.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251013000056_add_saved_filters_to_user_preferences.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251013000057_add_saved_filters_to_remote_config.dart'; +import 'package:flutter_news_app_api_server_full_source_code/src/database/migrations/20251024000000_add_logo_url_to_sources.dart'; import 'package:flutter_news_app_api_server_full_source_code/src/services/database_migration_service.dart' show DatabaseMigrationService;

AltStyle によって変換されたページ (->オリジナル) /