Anujcodecraft/notes-online
### ✅ Uploading PYQ Fails – Missing `uploader` & `branch` not ObjectId**
开放
#34 创建于 2025年7月5日
NodeJSReactJsbuggood first issue
仓库指标
- 星标
- (7 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
🛠️ Uploading PYQ Fails – Missing uploader & branch not ObjectId
🐛 Description:
Uploading a PYQ fails due to two schema validation issues:
branchexpects anObjectId, but receives a string.uploaderfield is missing in the payload.
💥 Error Response:
{
"error": "Validation failed",
"details": {
"branch": {
"stringValue": "\"CSE\"",
"valueType": "string",
"kind": "ObjectId",
"value": "CSE",
"path": "branch",
"name": "CastError",
"message": "Cast to ObjectId failed for value \"CSE\" at path \"branch\""
},
"uploader": {
"name": "ValidatorError",
"message": "Path `uploader` is required.",
"properties": {
"message": "Path `uploader` is required.",
"type": "required",
"path": "uploader"
},
"kind": "required",
"path": "uploader"
}
}
}
✅ Expected Behavior:
PYQ should be uploaded successfully when valid data is provided.
❌ Actual Behavior:
Validation fails and returns 400 status.