Anujcodecraft / Anujcodecraft/notes-online

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

Offen
#34 3 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @Karthik7259 Auf GitHub ansehen
bug good first issue NodeJS ReactJs
Vorherrschende Sprache
JavaScript
Sterne
7
Forks
7
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## 🛠️ 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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.