Skip to content

create subject endpoint - #3

Merged
VZhou07 merged 3 commits into
mainfrom
feat/subject-create
Jul 26, 2026
Merged

VZhou07 merged 3 commits into
mainfrom
feat/subject-create

Conversation

@VZhou07

@VZhou07 VZhou07 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@VZhou07, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a84d4d99-65c4-48f8-b8d9-5e003105eca9

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3028c and 1258f25.

📒 Files selected for processing (4)
  • routes/departments.ts
  • routes/subjects.ts
  • src/index.ts
  • src/lib/auth.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/subject-create

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the ability to create subjects via an authenticated admin-only API, and improves deployment flexibility by allowing the server port to be configured via environment variables.

Changes:

  • Read the HTTP port from process.env.PORT with a fallback.
  • Add POST /api/subjects to create a subject (admin-only), including department lookup and DB insert.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/index.ts Uses an environment variable for the server port instead of a hardcoded value.
routes/subjects.ts Introduces an admin-protected POST / endpoint to create a subject record tied to a department.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts Resolved
Comment thread routes/subjects.ts
Comment on lines +103 to +107
const [matchedDepartment] = await db
.select({ id: departments.id })
.from(departments)
.where(eq(departments.name, department))
.limit(1);
Comment thread routes/subjects.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread routes/subjects.ts Resolved
Comment thread src/lib/auth.ts
secure: isProd,
httpOnly: true,
},
},

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

cookies samesite attribute allows for cookies to be sent from frontend to backend from different sites since frontend and backend hosted on different domain and site is determined by domain

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Out of scope of pr but merge anyway

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@VZhou07
VZhou07 merged commit cc8fffa into main Jul 26, 2026
2 checks passed
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.

2 participants