781 new member onboarding spring 2025 course discussion board#1061
781 new member onboarding spring 2025 course discussion board#1061marla-tumenjargal wants to merge 5 commits intomainfrom
Conversation
Linting FailedNote: The status check will always pass. Run Click to expand lint output |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4698963e1
ℹ️ 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".
| export default { | ||
| typeDef: discussionTypeDefs, | ||
| resolver, |
There was a problem hiding this comment.
Register discussion module with GraphQL modules list
This module is defined but never added to the backend module registry (apps/backend/src/modules/index.ts), so its typeDef/resolver are never merged into the GraphQL schema. Any client querying courseComments/addCourseComment will get schema errors like “Cannot query field” because the schema doesn’t include this module. Please add the discussion module to the modules array so the new discussion API is actually exposed.
Useful? React with 👍 / 👎.
| const response = await fetch( | ||
| `/api/comments?subject=${encodeURIComponent(classData.subject)}&course_number=${encodeURIComponent(classData.courseNumber)}`, | ||
| { | ||
| method: "GET", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, |
There was a problem hiding this comment.
Avoid calling an unimplemented /api/comments endpoint
The UI is wired to GET /api/comments and POST /api/comments, but the backend only adds a GraphQL discussion module and there is no REST route or API handler for /api/comments in this repo. As a result, these fetches will 404 and the discussion tab will always show errors/empty state in production unless a matching REST endpoint is added or the client is switched to the GraphQL API.
Useful? React with 👍 / 👎.
Linting FailedNote: The status check will always pass. Run Click to expand lint output |
ARtheboss
left a comment
There was a problem hiding this comment.
Make sure you test your changes before you submit them.
| setIsLoading(true); | ||
| setError(null); | ||
|
|
||
| // Call your backend GET endpoint |
| const response = await fetch("/api/comments", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ | ||
| subject: classData.subject, | ||
| course_number: classData.courseNumber, | ||
| text: newComment.trim(), | ||
| }), |
There was a problem hiding this comment.
This is not correct, it is using a REST API instead of GraphQL. Have you tested this?
Make sure you use useQuery from Apollo Client
| const response = await fetch( | ||
| `/api/comments?subject=${encodeURIComponent(classData.subject)}&course_number=${encodeURIComponent(classData.courseNumber)}`, | ||
| { | ||
| method: "GET", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| } | ||
| ); |
There was a problem hiding this comment.
Also not correct. We use Apollo Client hooks
| type Comment { | ||
| id: ID! | ||
| courseId: String! | ||
| userId: String! | ||
| content: String! | ||
| createdAt: String! | ||
| } | ||
|
|
||
| type Query { | ||
| courseComments(courseId: String!, userId: String): [Comment!]! | ||
| } | ||
|
|
||
| type Mutation { | ||
| addCourseComment( | ||
| courseId: String! | ||
| content: String! | ||
| ): Comment! | ||
| } |
There was a problem hiding this comment.
There's nothing I see here that deals with the caching problem I was talking about
No description provided.