-
Notifications
You must be signed in to change notification settings - Fork 0
Feat filter bookmarks saved entry handling #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
809bd92
build(deps): update git dependencies to tagged versions
fulleni 617af8b
fix(auth_service): add savedFilters to default user preferences
fulleni 7043258
fix(database): add savedFilters to user_content_preferences
fulleni 156bac5
feat(limits): add saved filters limit check
fulleni 933af74
feat(database): add saved filters to user preferences migration
fulleni 4e605f0
feat(database): add savedFilters field to user_content_preferences
fulleni 2731d77
build: add initial version number to pubspec.yaml
fulleni 66593c5
chore: add initial CHANGELOG.md for version 1.0.0 release
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # 1.0.0 - 2025εΉ΄10ζ13ζ₯ | ||
|
|
||
| * chore!: initial release under semantic versioning. |
39 changes: 39 additions & 0 deletions
lib/src/database/migrations/20251013000056_add_saved_filters_to_user_preferences.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 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 `savedFilters` field to existing | ||
| /// `user_content_preferences` documents. | ||
| class AddSavedFiltersToUserPreferences extends Migration { | ||
| /// {@macro add_saved_filters_to_user_preferences} | ||
| AddSavedFiltersToUserPreferences() | ||
| : super( | ||
| prDate: '20251013000056', | ||
| prId: '56', | ||
| prSummary: 'Add savedFilters field to user_content_preferences', | ||
| ); | ||
|
|
||
| @override | ||
| Future<void> up(Db db, Logger log) async { | ||
| final collection = db.collection('user_content_preferences'); | ||
| final result = await collection.updateMany( | ||
| // Filter for documents where 'savedFilters' does not exist. | ||
| where.notExists('savedFilters'), | ||
| // Set 'savedFilters' to an empty array. | ||
| modify.set('savedFilters', <dynamic>[]), | ||
| ); | ||
| log.info( | ||
| 'Updated ${result.nModified} documents in user_content_preferences.', | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Future<void> down(Db db, Logger log) async { | ||
| final collection = db.collection('user_content_preferences'); | ||
| await collection.updateMany( | ||
| where.exists('savedFilters'), | ||
| modify.unset('savedFilters'), | ||
| ); | ||
| log.info('Removed "savedFilters" field from user_content_preferences.'); | ||
| } | ||
| } |
6 changes: 4 additions & 2 deletions
lib/src/database/migrations/all_migrations.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| 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/20251013000056_add_saved_filters_to_user_preferences.dart'; | ||
| import 'package:flutter_news_app_api_server_full_source_code/src/services/database_migration_service.dart' | ||
| show DatabaseMigrationService; | ||
|
|
||
| /// A central list of all database migrations to be applied. | ||
| /// | ||
| /// New migration classes should be added to this list. The | ||
| /// [DatabaseMigrationService] will automatically sort and apply them based on | ||
| /// their `prDate` property. | ||
| /// [DatabaseMigrationService] will automatically sort and apply them based | ||
| /// on their `prDate` property. | ||
| final List<Migration> allMigrations = [ | ||
| RefactorAdConfigToRoleBased(), | ||
| AddSavedFiltersToUserPreferences(), | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.