Skip to content

Conversation

@LC0229
Copy link
Collaborator

@LC0229 LC0229 commented Nov 16, 2025

Summary

This PR includes two main improvements:

1. Database Schema Refactoring

  • Changed user field to userId (String) in InterviewQuestion, LeetcodeQuestion, and Tips models
  • Added companyName field to Application and SavedApplication models for denormalization
  • Updated all controllers to remove unnecessary .populate() calls for userId (no longer an ObjectId)
  • Updated all validators to reflect schema changes

Breaking Changes:

  • API requests must now send userId instead of user
  • Application/SavedApplication creation requires companyName field

2. Vercel Logger Fix

  • Fixed EROFS: read-only file system error on Vercel deployments
  • Logger now detects Vercel environment and uses console.log instead of file writes
  • Local development still uses file logging

Changes Made

  • Fixed a bug (Vercel logger)
  • Refactored internal code (database schema)

Briefly summarize the major changes:

  • Modified logger middleware to skip file operations on Vercel
  • Changed useruserId in InterviewQuestion, LeetcodeQuestion, Tips models
  • Added companyName field to Application and SavedApplication models
  • Removed all .populate({ path: "user" }) calls from controllers
  • Updated all validators to use userId and validate companyName

Testing

  • Manual end-to-end testing
  • Unit Tests
  • CI checks passed

Testing details:

  • Verified logger works in local dev and Vercel
  • Tested all API endpoints with updated schema
  • Confirmed database migrations work correctly

- Skip file logging when VERCEL env var is set
- Use console.log on Vercel (captured by Vercel logs)
- Keep file logging for local development
- Fixes EROFS: read-only file system error
- Fix ESLint errors in api/index.ts (use @ts-expect-error)
- Fix Prettier formatting in tipValidator.ts
@LC0229 LC0229 requested a review from n1sh1thaS as a code owner November 16, 2025 09:11
@vercel
Copy link

vercel bot commented Nov 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
opportune Ready Ready Preview Comment Nov 16, 2025 9:15am

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