fix(submissions): handle null blogPostId in populate query
- Changed populate to use options object with strictPopulate: false - Allows submissions without blogPostId (standalone packages) to be returned - Fixes 500 error on /api/submissions endpoint - Le Monde package should now be visible in UI after server restart
This commit is contained in:
parent
431078b81f
commit
f1ad7812f7
2 changed files with 14 additions and 10 deletions
|
|
@ -43,8 +43,8 @@
|
|||
"last_deliberation": null
|
||||
},
|
||||
"FileEditHook": {
|
||||
"timestamp": "2025-10-23T20:52:52.632Z",
|
||||
"file": "/home/theflow/projects/tractatus/public/js/admin/blog-validation.js",
|
||||
"timestamp": "2025-10-23T20:54:49.723Z",
|
||||
"file": "/home/theflow/projects/tractatus/src/controllers/submissions.controller.js",
|
||||
"result": "passed"
|
||||
},
|
||||
"FileWriteHook": {
|
||||
|
|
@ -58,25 +58,25 @@
|
|||
"tokens": 30000
|
||||
},
|
||||
"alerts": [],
|
||||
"last_updated": "2025-10-23T20:52:52.632Z",
|
||||
"last_updated": "2025-10-23T20:54:49.723Z",
|
||||
"initialized": true,
|
||||
"framework_components": {
|
||||
"CrossReferenceValidator": {
|
||||
"message": 0,
|
||||
"tokens": 0,
|
||||
"timestamp": "2025-10-23T20:53:10.672Z",
|
||||
"last_validation": "2025-10-23T20:53:10.671Z",
|
||||
"validations_performed": 643
|
||||
"timestamp": "2025-10-23T20:55:48.702Z",
|
||||
"last_validation": "2025-10-23T20:55:48.702Z",
|
||||
"validations_performed": 653
|
||||
},
|
||||
"BashCommandValidator": {
|
||||
"message": 0,
|
||||
"tokens": 0,
|
||||
"timestamp": null,
|
||||
"last_validation": "2025-10-23T20:53:10.673Z",
|
||||
"validations_performed": 310,
|
||||
"last_validation": "2025-10-23T20:55:48.703Z",
|
||||
"validations_performed": 319,
|
||||
"blocks_issued": 37
|
||||
}
|
||||
},
|
||||
"action_count": 310,
|
||||
"action_count": 319,
|
||||
"auto_compact_events": []
|
||||
}
|
||||
|
|
@ -82,7 +82,11 @@ async function getSubmissions(req, res) {
|
|||
if (publicationId) query.publicationId = publicationId;
|
||||
|
||||
const submissions = await SubmissionTracking.find(query)
|
||||
.populate('blogPostId', 'title slug')
|
||||
.populate({
|
||||
path: 'blogPostId',
|
||||
select: 'title slug',
|
||||
options: { strictPopulate: false } // Allow null blogPostId
|
||||
})
|
||||
.populate('createdBy', 'email')
|
||||
.sort({ submittedAt: -1, createdAt: -1 })
|
||||
.limit(parseInt(limit, 10))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue