From 439b28512638bb7495451954d3b10f88f005d77e Mon Sep 17 00:00:00 2001 From: gibbyb Date: Fri, 18 Oct 2024 16:53:03 -0500 Subject: [PATCH] fix errors --- package.json | 4 +- .../profile-pictures/2_1729280510919.jpg | Bin 0 -> 23232 bytes src/app/api/users/createUser/route.ts | 39 ++++++++++++------ src/app/api/users/search/route.ts | 1 + src/app/api/users/updatePfp/route.ts | 1 + src/server/functions.ts | 12 ++++-- 6 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 public/uploads/profile-pictures/2_1729280510919.jpg diff --git a/package.json b/package.json index 5945ad0..454371b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "db:studio": "drizzle-kit studio", "dev": "next dev", "lint": "next lint", - "start": "next start" + "start": "next start", + "go": "pnpm dev", + "go:prod": "pnpm build && pnpm start" }, "dependencies": { "@t3-oss/env-nextjs": "^0.10.1", diff --git a/public/uploads/profile-pictures/2_1729280510919.jpg b/public/uploads/profile-pictures/2_1729280510919.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ddf9b7b07c8356f7dfa8853f0b834d648f63755 GIT binary patch literal 23232 zcmbTcbyOTd_boa&A-Dt`AV45NgF6HW9w4|o!3KBN;O+@da2N(1+}+*XZE$xU-*gqam_UruXIsjWnLRta<2L}L1y%oUg2Eb3;&B7D_kdp(@ z0{{S201_N70O8Godn*7q5&+VFZ2&+9j`V-qN^qb5#|It&2(bVl{*RB=+xb6utNA~7 z|IZmd8~*?HfMd)?_&@f4Twjj?JU`8CoopS=ZS5%8nZE*fM5W~r|5M`|{%e2wuZcYk zj9iETR3RStz58=?C+hRs4!}W$V}xTwfTIGy-{z`b?@DBfB|g8MK2d)wOq4jus! z2^j_T9oqXh2PifG9u5Hk9uWZv=|9cDdB0r;AmSk5eqbJXLoP^;PCw7^6L8L_U``SKfK@o2>*-L+wp%f`+xAldE*6- zh=_oQ@*iGs@UH(Mj)REwkrf$NL=nZ%9*>I69~ECTE~m2N9W}es8G(_*1lk80j*U;}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k>O*<4A)#;LT=iV~ vdsc1>bZFht&iRm!l#G2TJlOvLj1ShS+mi5-+~JD;0-W~Yj(0Gsv6=tb{tjt< literal 0 HcmV?d00001 diff --git a/src/app/api/users/createUser/route.ts b/src/app/api/users/createUser/route.ts index 38cbff8..760b5ec 100644 --- a/src/app/api/users/createUser/route.ts +++ b/src/app/api/users/createUser/route.ts @@ -8,23 +8,38 @@ import type { User } from '~/server/types'; export const POST = async (request: NextRequest) => { const middlewareResponse = await middleware(request); if (middlewareResponse) return middlewareResponse; + try { - const url = new URL(request.url); - const appleId = url.searchParams.get('appleId'); - const email = url.searchParams.get('email'); - const fullName = url.searchParams.get('fullName'); - const pushToken = url.searchParams.get('pushToken'); - if (!appleId || !email || !fullName || !pushToken) + // Parse the request body + const body = await request.json() as { + appleId: string; + email: string; + fullName: string; + pushToken: string; + }; + const { appleId, email, fullName, pushToken } = body; + + // Validate the required fields + if (!appleId || !email || !fullName || !pushToken) { return NextResponse.json( - { message: 'Missing required parameters' }, { status: 400 } - ); - const newUser: User | null = await createUser(appleId, email, fullName, pushToken); - if (!newUser) { - return NextResponse.json( - { message: 'Error creating user' }, { status: 500 } + { message: 'Missing required parameters' }, + { status: 400 } ); } + + // Create the new user + const newUser: User | undefined = await createUser(appleId, email, fullName, pushToken); + + if (!newUser) { + return NextResponse.json( + { message: 'Error creating user' }, + { status: 500 } + ); + } + + // Return the new user data return NextResponse.json(newUser); + } catch (error) { console.error('Error creating user:', error); if (error instanceof Error) { diff --git a/src/app/api/users/search/route.ts b/src/app/api/users/search/route.ts index d001240..b201218 100644 --- a/src/app/api/users/search/route.ts +++ b/src/app/api/users/search/route.ts @@ -12,6 +12,7 @@ export const GET = async (request: NextRequest) => { const url = new URL(request.url); const userId = Number.parseInt(url.searchParams.get('userId') ?? ''); const searchTerm = url.searchParams.get('searchTerm'); + console.log(userId, searchTerm); if (!userId || !searchTerm || isNaN(userId)) return NextResponse.json( { message: 'Missing userId or searchTerm' }, { status: 400 } diff --git a/src/app/api/users/updatePfp/route.ts b/src/app/api/users/updatePfp/route.ts index 60a3219..3f47b31 100644 --- a/src/app/api/users/updatePfp/route.ts +++ b/src/app/api/users/updatePfp/route.ts @@ -37,6 +37,7 @@ export const POST = async (request: NextRequest) => { // Delete the old pfp file if it exists const oldPfpUrl = await getPfpUrl(userId); + console.log("Old pfp url: ", oldPfpUrl); if (oldPfpUrl) { const oldFilePath = path.join(process.cwd(), 'public', oldPfpUrl); await fs.unlink(oldFilePath).catch((error) => { diff --git a/src/server/functions.ts b/src/server/functions.ts index 1efae5b..008b858 100644 --- a/src/server/functions.ts +++ b/src/server/functions.ts @@ -91,10 +91,11 @@ export const createUser = async ( fullName: string, pushToken: string ) => { try { + console.log(appleId, email, fullName, pushToken); + if (!appleId || !email || !fullName || !pushToken) { throw new Error("Error: All required fields must be filled"); } - // Check if username or email is already taken const existingUser = await db.select().from(schema.users) .where(or(eq(schema.users.appleId, appleId), eq(schema.users.email, email))); @@ -102,15 +103,18 @@ export const createUser = async ( if (existingUser.length > 0) { throw new Error("Username or email is already in use"); } + console.log('right before we add the user'); const newUsers: User[] = await db.insert(schema.users).values({ appleId, email, fullName, pushToken }).returning() as User[]; // return the newly created user + const newUser: User | undefined = newUsers[0]; + if (!newUsers.length || !newUsers[0]?.id) throw new Error("Failed to create new user"); - return newUsers[0]; + return newUser; } catch (error) { if (error instanceof Error) { @@ -144,8 +148,10 @@ export const getPfpUrl = async (userId: number) => { try { const users = await db.select().from(schema.users) .where(eq(schema.users.id, userId)) + console.log(users); const user = users[0] as User; - return (users === undefined) ? user.pfpUrl : null; + if (!user) return null; + return user.pfpUrl; } catch (error) { console.error('Error getting pfp url:', error); }