Conversation
tarinagarwal
left a comment
There was a problem hiding this comment.
Great work on the Labs CRUD implementation! The core functionality is solid. A few improvements needed:
1. Use existing Prisma instance
Replace const prisma = new PrismaClient(); with import prisma from "../db.js"; to use the existing connection.
2. Add input validation
- Validate required fields (title, language, difficulty, etc.)
- Validate enum values for difficulty ("beginner", "intermediate", "advanced")
- Validate visibility ("private", "public", "link")
3. Add filters to GET /api/labs
Add query parameter support for filtering by language, difficulty, creator, etc.
4. Minor fixes
- Add newline at end of schema.prisma file
- Add basic validation for empty/invalid ObjectIds
5. Error handling
Add validation for invalid ObjectId format in route parameters.
The MongoDB adaptations and ObjectId usage are perfect for this setup. Core CRUD logic and auth checks look excellent!
|
Hello, @tarinagarwal |
|
Hello @tarinagarwal please review the changes |
|
@Priyamanjare54 going thru it |
|
Hello any changes required? |
📝 Description
Implemented full Labs CRUD functionality with authentication and authorization.Fixes #58
Key highlights:
This completes the Labs module backend functionality and prepares it for frontend integration.
🔗 Related Issue
Closes: N/A
🏷️ Type of Change
📸 Screenshots (if applicable)
N/A (Backend-only changes)
✅ Checklist
🧪 Testing
How I tested:
Generated JWT token via login
Tested protected endpoints using Authorization header
Verified ownership checks for update/delete
Confirmed Prisma works with MongoDB replica set
Tested API endpoints (Postman)
Tested on Chrome
Tested on Firefox
Tested on mobile
📋 Additional Notes
201,403,404, etc.).SWOC 2026 Participant ✅
Please add the
swoc2026label to this PR 🎉