Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature document database migration #15

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
fulleni merged 23 commits into main from feature_document_database_migration
Jul 12, 2025
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
49d1e91
feat(auth): create ownership check middleware
fulleni Jul 11, 2025
ea709e9
feat(auth): apply ownership check middleware to item routes
fulleni Jul 11, 2025
cc9d32f
refactor(api): adapt GET /data to use native document query
fulleni Jul 11, 2025
34a0029
refactor(api): adapt GET /data to use native document query
fulleni Jul 11, 2025
c065be4
feat(db): replace postgres seeding service with mongodb
fulleni Jul 11, 2025
fe51a1e
feat(db): replace postgres seeding service with mongodb
fulleni Jul 11, 2025
1bca9ab
refactor(deps): remove postgres dependencies
fulleni Jul 11, 2025
bfb3e5f
feat(db): migrate dependency injection to mongodb
fulleni Jul 11, 2025
bf6f59d
docs: update readme for mongodb migration
fulleni Jul 11, 2025
c6877bc
refactor(auth): use readAll with filter in AuthService
fulleni Jul 11, 2025
38853ea
docs: update .env.example for mongodb connection string
fulleni Jul 11, 2025
b07d6d2
fix(config): make .env file loading robust
fulleni Jul 11, 2025
7b24b53
/// issues where the execution context's working directory is not the
fulleni Jul 11, 2025
20a92d2
fix(config): correct directory traversal in .env search
fulleni Jul 11, 2025
96912c2
feat(config): enhance .env loading logs
fulleni Jul 11, 2025
e7d0d8d
fix(config): prevent state corruption on failed dependency init
fulleni Jul 11, 2025
d1ac01a
fix(config): make dependency init robust against all throwables
fulleni Jul 11, 2025
6e84bcf
chore
fulleni Jul 11, 2025
4ce3cc5
fix(api): make database seeding idempotent and preserve IDs
fulleni Jul 12, 2025
5207475
fix(api): ensure all user data is deleted on account deletion
fulleni Jul 12, 2025
dbae817
refactor(api): use repository count method for dashboard summary
fulleni Jul 12, 2025
c49d2c4
fix(api): improve error handling for invalid JSON body
fulleni Jul 12, 2025
b2b4363
fix(api): correct admin data scoping in generic data handlers
fulleni Jul 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore
  • Loading branch information
fulleni committed Jul 11, 2025
commit 6e84bcf068fb15c78471baf255866b6bcee7d5be
17 changes: 3 additions & 14 deletions lib/src/services/database_seeding_service.dart
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,19 @@ class DatabaseSeedingService {
final operations = <Map<String, Object>>[];

for (final item in fixtureData) {
final id = getId(item);

if (!ObjectId.isValidHexId(id)) {
_log.warning('Skipping document with invalid ID format: $id');
continue;
}

final objectId = ObjectId.fromHexString(id);
// Generate a new ObjectId for each document
final objectId = ObjectId();
final document = toJson(item)..remove('id');

operations.add({
'replaceOne': {
'filter': {'_id': objectId},
'filter': {}, // Match all documents (replace existing or insert new)
'replacement': document,
'upsert': true,
},
});
}

if (operations.isEmpty) {
_log.info('No valid documents to write for "$collectionName".');
return;
}

final result = await collection.bulkWrite(operations);
_log.info(
'Seeding for "$collectionName" complete. '
Expand Down

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /