-
Notifications
You must be signed in to change notification settings - Fork 46
fix: replace .single() with .maybeSingle() in 5 API routes #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,10 @@ | |
| .from("profiles") | ||
| .select("*") | ||
| .eq("id", user.id) | ||
| .single(); | ||
| .maybeSingle(); | ||
|
|
||
| if (error) { | ||
| if (error || !profile) { | ||
| return NextResponse.json({ error: error.message }, { status: 400 }); | ||
| } | ||
|
Comment on lines
+23
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With |
||
|
|
||
| return NextResponse.json({ profile }); | ||
|
|
@@ -100,7 +100,7 @@ | |
| .from("profiles") | ||
| .select("did, resume_url") | ||
| .eq("id", user.id) | ||
| .single(); | ||
| .maybeSingle(); | ||
|
|
||
| // Check if profile is complete | ||
| const isComplete = Boolean( | ||
|
|
@@ -120,12 +120,12 @@ | |
| .update(updateData) | ||
| .eq("id", user.id) | ||
| .select() | ||
| .single(); | ||
| .maybeSingle(); | ||
|
|
||
| if (error) { | ||
| if (error || !profile) { | ||
| console.error("Profile update error:", error); | ||
| console.error("Error details:", JSON.stringify(error, null, 2)); | ||
| return NextResponse.json({ error: error.message }, { status: 400 }); | ||
| } | ||
|
|
||
| // Log profile update activity | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?)Three comments in this file had their em dash character (
—) corrupted to?(e.g.,// Apply filters ?use textSearch…,// No filter ?return both types,// Apply pagination ?ensure non-negative offset…). These are likely a text-encoding side-effect of the PR tooling. The comments should be restored to their original readable form.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!