Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented May 28, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a unified API endpoint for generating signed upload URLs, allowing uploads to specified folders within a workspace.
    • Added a new endpoint for securely uploading resume files with rate limiting and CORS support.
  • Refactor

    • Updated screenshot and program logo upload functionality in forms to use the new upload URL endpoint with folder specification for improved flexibility and consistency.
  • Chores

    • Removed legacy API endpoints for generating signed upload URLs for OAuth app screenshots, CSV imports, and program logos.

@vercel
Copy link
Contributor

vercel bot commented May 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dub ✅ Ready (Inspect) Visit Preview May 28, 2025 9:15pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 28, 2025

Walkthrough

The changes consolidate multiple upload URL endpoints into a single, parameterized API route for generating signed upload URLs within a workspace. The UI components are updated to use the new unified endpoint and provide a folder name in the request body. Legacy endpoints and their handlers are removed. Additionally, a new resume upload URL endpoint with CORS and rate limiting is introduced.

Changes

File(s) Change Summary
apps/web/app/api/oauth/apps/upload-url/route.ts,
apps/web/app/api/workspaces/[idOrSlug]/import/csv/upload-url/route.ts,
apps/web/app/api/workspaces/[idOrSlug]/programs/upload-logo/route.ts
Removed legacy API endpoints for generating signed upload URLs for screenshots, CSV imports, and program logos.
apps/web/app/api/workspaces/[idOrSlug]/upload-url/route.ts Added a new unified API endpoint for generating signed upload URLs, accepting a folder parameter.
apps/web/app/api/resumes/upload-url/route.ts Added a new API endpoint for generating signed upload URLs for resumes with CORS and rate limiting.
apps/web/ui/oauth-apps/add-edit-app-form.tsx,
apps/web/ui/oauth-apps/add-edit-integration-form.tsx,
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/programs/new/form.tsx
Updated UI logic to use the new unified upload URL API, sending the folder name in the request.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI_Component
    participant API_Endpoint
    participant Storage_Service

    User->>UI_Component: Selects file to upload
    UI_Component->>API_Endpoint: POST /api/workspaces/{workspaceId}/upload-url { folder }
    API_Endpoint->>Storage_Service: Request signed URL for {folder}/{nanoid}
    Storage_Service-->>API_Endpoint: Returns signed URL and key
    API_Endpoint-->>UI_Component: Responds with signed URL and key
    UI_Component->>Storage_Service: Uploads file to signed URL
    Storage_Service-->>UI_Component: Confirms upload
Loading

Poem

Oh, what a hop to a single route,
Where folders guide what files go out!
Old endpoints fade like dusk’s soft hue,
Now one path serves both old and new.
Signed URLs for every need,
The code is clean—let’s munch some seed!
🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bead32 and c6458ba.

📒 Files selected for processing (3)
  • apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/programs/new/form.tsx (1 hunks)
  • apps/web/app/api/workspaces/[idOrSlug]/programs/upload-logo/route.ts (0 hunks)
  • apps/web/app/api/workspaces/[idOrSlug]/upload-url/route.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/app/api/workspaces/[idOrSlug]/programs/upload-logo/route.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
apps/web/app/api/workspaces/[idOrSlug]/upload-url/route.ts (1)

1-25: LGTM! Clean consolidation of upload URL endpoints.

The implementation effectively consolidates multiple upload endpoints into a single, well-structured API route. The code demonstrates good practices with proper authentication, input validation, and secure folder restrictions that address the previous security concerns.

apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/programs/new/form.tsx (1)

85-90: Proper integration with the new consolidated upload API.

The changes correctly adapt to the new upload URL endpoint by:

  • Using the consolidated /upload-url route instead of the specific program upload endpoint
  • Including the appropriate folder specification in the request body
  • Maintaining the existing upload flow and error handling

The "program-logos" folder value properly aligns with the enum validation in the API route.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/web/app/api/workspaces/[idOrSlug]/upload-url/route.ts (1)

12-20: Well-designed unified endpoint with room for error handling improvement.

The implementation successfully consolidates upload URL generation into a single, flexible endpoint. The key generation pattern and response format are appropriate.

Consider adding explicit error handling for the storage operation:

 export const POST = withWorkspace(async ({ req }) => {
   const { folder } = schema.parse(await req.json());
 
   const key = `${folder}/${nanoid(16)}`;
 
-  const signedUrl = await storage.getSignedUrl(key);
+  try {
+    const signedUrl = await storage.getSignedUrl(key);
+    return NextResponse.json({ key, signedUrl });
+  } catch (error) {
+    return NextResponse.json({ error: "Failed to generate upload URL" }, { status: 500 });
+  }
-
-  return NextResponse.json({ key, signedUrl });
 });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c04a595 and e952463.

📒 Files selected for processing (5)
  • apps/web/app/api/oauth/apps/upload-url/route.ts (0 hunks)
  • apps/web/app/api/workspaces/[idOrSlug]/import/csv/upload-url/route.ts (0 hunks)
  • apps/web/app/api/workspaces/[idOrSlug]/upload-url/route.ts (1 hunks)
  • apps/web/ui/oauth-apps/add-edit-app-form.tsx (1 hunks)
  • apps/web/ui/oauth-apps/add-edit-integration-form.tsx (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/web/app/api/workspaces/[idOrSlug]/import/csv/upload-url/route.ts
  • apps/web/app/api/oauth/apps/upload-url/route.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
apps/web/ui/oauth-apps/add-edit-integration-form.tsx (1)

65-70: LGTM! Clean migration to the new unified upload endpoint.

The refactoring correctly updates the API call to use the new parameterized endpoint with explicit folder specification. The change from query parameters to JSON body makes the API more RESTful and clearer about the upload destination.

apps/web/ui/oauth-apps/add-edit-app-form.tsx (1)

150-155: Consistent migration pattern - looks good!

The changes mirror those in the integration form, maintaining consistency across the codebase. Both files correctly use the same folder name "integration-screenshots" for OAuth app screenshots.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01f1783 and 0bead32.

📒 Files selected for processing (1)
  • apps/web/app/api/resumes/upload-url/route.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/web/app/api/resumes/upload-url/route.ts (2)
apps/web/lib/storage.ts (1)
  • storage (151-151)
packages/utils/src/constants/main.ts (1)
  • R2_URL (77-77)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
apps/web/app/api/resumes/upload-url/route.ts (2)

1-4: LGTM - Clean imports.

All imports are necessary and properly used throughout the file.


18-18: LGTM - Appropriate key generation.

Using nanoid(16) with the "resumes/" prefix provides good uniqueness and organization.

@steven-tey steven-tey merged commit 42d67df into main May 28, 2025
7 of 8 checks passed
@steven-tey steven-tey deleted the upload-url branch May 28, 2025 21:20
@coderabbitai coderabbitai bot mentioned this pull request Jul 21, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 2025
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.

3 participants