Skip to content

add notice board project, pranav balu - #89

Open
pranavbalu1 wants to merge 1 commit into
becloudready:masterfrom
pranavbalu1:pranav-balu-notice-board
Open

add notice board project, pranav balu#89
pranavbalu1 wants to merge 1 commit into
becloudready:masterfrom
pranavbalu1:pranav-balu-notice-board

Conversation

@pranavbalu1

Copy link
Copy Markdown

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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/"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +29 to +32
return repository.create(
name=notice.name,
message=notice.message
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant