-
Notifications
You must be signed in to change notification settings - Fork 111
feat: add custom background images for user profiles #645
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 1 commit
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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import prisma from "@/lib/prisma"; | ||
| import { getServerSession } from "next-auth"; | ||
| import { authOptions } from "@/lib/auth"; | ||
|
|
||
| export async function PATCH(req: NextRequest) { | ||
| try { | ||
| const session = await getServerSession(authOptions); | ||
| if (!session?.user?.email) { | ||
| return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); | ||
| } | ||
|
|
||
| const body = await req.json(); | ||
| const { backgroundImage } = body; | ||
|
|
||
| if (backgroundImage !== null && typeof backgroundImage !== "string") { | ||
| return NextResponse.json({ error: "Invalid backgroundImage" }, { status: 400 }); | ||
| } | ||
|
|
||
| const updatedUser = await prisma.user.update({ | ||
| where: { email: session.user.email }, | ||
| data: { backgroundImage }, | ||
| }); | ||
|
|
||
| return NextResponse.json({ success: true, backgroundImage: updatedUser.backgroundImage }, { status: 200 }); | ||
| } catch (error) { | ||
| console.error("Failed to update background image:", error); | ||
| return NextResponse.json({ error: "Internal server error" }, { status: 500 }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ model User { | |
| email String @unique | ||
| emailVerified DateTime? | ||
| image String? | ||
| backgroundImage String? | ||
|
Contributor
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. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Schema declarations:"
rg -n 'backgroundImage' prisma/schema.prisma
echo "Migration references:"
rg -n 'backgroundImage' prisma/migrations 2>/dev/null || trueRepository: vishnukothakapu/linkid Length of output: 292 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Repository files relevant to Prisma/migrations:"
git ls-files | rg '(^|/)prisma(/|$)|schema\.prisma|migration\.)|migrations' | sed -n '1,200p'
echo
echo "schema.prisma around declarations:"
sed -n '1,40p;200,245p' prisma/schema.prisma
echo
echo "Changed files summary:"
git diff --statRepository: vishnukothakapu/linkid Length of output: 381 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Repository files relevant to Prisma/migrations:"
git ls-files | rg '(^|/)prisma(/|$)|schema\.prisma|migration|index\.d\.prisma|migrations' | sed -n '1,220p' || true
echo
echo "schema.prisma around backgroundImage declarations:"
sed -n '1,40p;200,245p' prisma/schema.prisma
echo
echo "Changed files summary:"
git diff --statRepository: vishnukothakapu/linkid Length of output: 3722 Add migration coverage for
🤖 Prompt for AI Agents |
||
|
|
||
| password String? | ||
|
|
||
|
|
@@ -214,6 +215,7 @@ model ProfileDraft { | |
| username String? | ||
| bio String? | ||
| image String? | ||
| backgroundImage String? | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| themeType String? | ||
| themeColor String? | ||
| themeCustom String? | ||
|
|
@@ -232,6 +234,7 @@ model ProfileVersion { | |
| username String? | ||
| bio String? | ||
| image String? | ||
| backgroundImage String? | ||
| themeType String? | ||
| themeColor String? | ||
| themeCustom String? | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.