Repository navigation
onboarding backend - #1056
onboarding backend#1056ethanransing wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25fd43a27b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| try { | ||
| // Create new comment in MongoDB | ||
| await CommentModel.create({ | ||
| courseId, | ||
| createdBy: context.user._id, | ||
| text: text.trim(), |
There was a problem hiding this comment.
Validate courseId to avoid 500s on bad input
If a client passes an empty/whitespace courseId, Mongoose will raise a validation error (schema requires non-empty strings after trim), but the catch block converts that into a generic INTERNAL_SERVER_ERROR. This turns a user-input problem into a 500 and makes it hard to diagnose. Consider validating courseId similarly to text and returning BAD_USER_INPUT so clients get a proper error instead of a server error.
Useful? React with 👍 / 👎.
| "Unique identifier" | ||
| _id: ID! | ||
| "Course identifier" | ||
| courseId: String! | ||
| "User ID who created the comment" | ||
| createdBy: String! | ||
| "Comment text content" | ||
| text: String! | ||
| "Timestamp when comment was created" | ||
| createdAt: String! |
There was a problem hiding this comment.
These comments are probably not necessary, pretty self-explanatory
No description provided.