add notice board project, pranav balu - #89
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c44b7fb58e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| print("MongoDB connection closed") | ||
|
|
||
|
|
||
| app = FastAPI( |
There was a problem hiding this comment.
Expose a Lambda handler for API Gateway
The workshop backend is invoked by API Gateway as a Python Lambda, but this module only exposes an ASGI app; I checked this new project tree and there is no lambda_function.py, lambda_handler, or Mangum adapter for Lambda to call. If this backend is packaged as the assignment Lambda, invocations fail before reaching any route, so add a Lambda handler/adapter or deploy it as an ASGI service instead.
Useful? React with 👍 / 👎.
| return ( | ||
| "mongodb+srv://" | ||
| f"{self.MONGO_USERNAME}:{self.MONGO_PASSWORD}" | ||
| "@cluster0.jcaprlc.mongodb.net/" |
There was a problem hiding this comment.
Make the MongoDB endpoint configurable
This hard-codes the Atlas cluster host, so deployments that set credentials for the assignment's MongoDB instance or for a different cluster still connect to cluster0.jcaprlc.mongodb.net. In those environments the API will either fail authentication/DNS or read and write the wrong database; accept a full MONGO_URI or at least a configurable host instead of baking this cluster name into code.
Useful? React with 👍 / 👎.
| response_model=list[NoticeResponse] | ||
| ) | ||
| def get_notices(): | ||
| return repository.get_all() |
There was a problem hiding this comment.
Wrap GET notices in the frontend contract
The provided notice-board UI populates from data.notices, but this handler returns a bare list. Once the frontend points at this backend, successful GETs are interpreted as an empty board, so return an object such as {"notices": ...} or update the frontend contract in the same change.
Useful? React with 👍 / 👎.
| return repository.create( | ||
| name=notice.name, | ||
| message=notice.message | ||
| ) |
There was a problem hiding this comment.
Wrap created notices for the UI
The existing frontend treats creation as successful only when the response has data.notice, but this route returns the raw notice object from the repository. In that case the insert succeeds in MongoDB while the UI reports a failed create and does not prepend the new notice; keep the {"notice": ...} envelope or change the client alongside this API.
Useful? React with 👍 / 👎.
No description provided.