The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix a few things
Steven Tey73bc122b1cc9
diff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.tsindex 706634365c..862e9cef19 100644--- a/apps/web/lib/auth/options.ts+++ b/apps/web/lib/auth/options.ts@@ -188,34 +188,37 @@ export const authOptions: NextAuthOptions = {if (account?.provider === "google") {const userExists = await prisma.user.findUnique({where: { email: user.email },- select: { name: true },+ select: { name: true, image: true },});// if the user already exists via email,// update the user with their name and image from Google- if (userExists && !userExists.name) {+ if (userExists && profile) {await prisma.user.update({where: { email: user.email },data: {- name: profile?.name,- // @ts-ignore - this is a bug in the types, `picture` is a valid on the `Profile` type- image: profile?.picture,+ ...(userExists.name ? {} : { name: profile.name }),+ // @ts-expect-error - this is a bug in the types, `picture` is a valid on the `Profile` type+ ...(userExists.image ? {} : { image: profile.picture }),},});}} else if (account?.provider === "github") {const userExists = await prisma.user.findUnique({where: { email: user.email },- select: { name: true },+ select: { name: true, image: true },});// if the user already exists via email,// update the user with their name and image from Github- if (userExists && !userExists.name) {+ if (userExists && profile) {await prisma.user.update({where: { email: user.email },data: {- name: profile?.name,- // @ts-ignore - this is a bug in the types, `picture` is a valid on the `Profile` type- image: profile?.picture,+ ...(userExists.name+ ? {}+ : // @ts-expect-error - this is a bug in the types, `login` is a valid on the `Profile` type+ { name: profile.name || profile.login }),+ // @ts-expect-error - this is a bug in the types, `avatar_url` is a valid on the `Profile` type+ ...(userExists.image ? {} : { image: profile.avatar_url }),},});}diff --git a/apps/web/next.config.js b/apps/web/next.config.jsindex d9de2ae0fb..a5b31650d3 100644--- a/apps/web/next.config.js+++ b/apps/web/next.config.js@@ -67,6 +67,9 @@ module.exports = {{hostname: "lh3.googleusercontent.com",},+ {+ hostname: "avatars.githubusercontent.com",+ },{hostname: "media.cleanshot.cloud", // only for staging purposes},diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prismaindex 3b8c1613b1..608c6f4152 100644--- a/apps/web/prisma/schema.prisma+++ b/apps/web/prisma/schema.prisma@@ -28,18 +28,19 @@ model User {}model Account {- id String @id @default(cuid())- userId String- type String- provider String- providerAccountId String- refresh_token String? @db.Text- access_token String? @db.Text- expires_at Int?- token_type String?- scope String?- id_token String? @db.Text- session_state String?+ id String @id @default(cuid())+ userId String+ type String+ provider String+ providerAccountId String+ refresh_token String? @db.Text+ refresh_token_expires_in Int?+ access_token String? @db.Text+ expires_at Int?+ token_type String?+ scope String?+ id_token String? @db.Text+ session_state String?user User @relation(fields: [userId], references: [id], onDelete: Cascade)