Anujcodecraft / Anujcodecraft/notes-online

### ✅ Uploading PYQ Fails – Missing `uploader` & `branch` not ObjectId**

Aperta
#34 3 commenti 0 reazioni 1 assegnatario Rivendicata da @Karthik7259 Vedi su GitHub
bug good first issue NodeJS ReactJs
Lingua principale
JavaScript
Stelle
7
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## 🛠️ Uploading PYQ Fails – Missing `uploader` & `branch` not ObjectId

### 🐛 Description:
Uploading a PYQ fails due to two schema validation issues:
1. `branch` expects an `ObjectId`, but receives a string.
2. `uploader` field is missing in the payload.

---

### 💥 Error Response:

```json
{
"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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.