Nelson
Nelson
Explore posts from servers
BABetter Auth
Created by Nelson on 3/2/2025 in #help
How to correctly update the user info?
No description
8 replies
BABetter Auth
Created by Nelson on 3/2/2025 in #help
How to manually invalidate session data?
I'm using Next.js and next-safe-action and auth.$context.internalAdapter. After that, how do we invalidate the session data/cache?
6 replies
BABetter Auth
Created by Nelson on 3/1/2025 in #help
GitHub OAuth: user name can be null
No description
6 replies
BABetter Auth
Created by Nelson on 2/25/2025 in #help
How to verify password?
'use server'

import { authenticatedActionClient } from '@/lib/safe-action'
import { changeUsernameSchema } from './schema'

export const changeUsername = authenticatedActionClient
.schema(changeUsernameSchema)
.action(async ({ parsedInput }) => {
const { username, password } = parsedInput

// verify password
})
'use server'

import { authenticatedActionClient } from '@/lib/safe-action'
import { changeUsernameSchema } from './schema'

export const changeUsername = authenticatedActionClient
.schema(changeUsernameSchema)
.action(async ({ parsedInput }) => {
const { username, password } = parsedInput

// verify password
})
Is there a function that I can use to verify the password? I want the user to type the current password to confirm before changing the username.
7 replies
BABetter Auth
Created by Nelson on 2/8/2025 in #help
Override types
No description
3 replies
DTDrizzle Team
Created by Nelson on 1/14/2024 in #help
Question about relations
I am trying to migrate from Prisma to Drizzle. But after reading the docs, I can't understand it. How to add relations to connect them? One user should have many comments. Can someone give me a real-world case so that I can learn faster?
export const users = mysqlTable('user', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
name: varchar('name', { length: 255 }),
email: varchar('email', { length: 255 }).notNull(),
emailVerified: timestamp('emailVerified', {
mode: 'date',
fsp: 3
}).defaultNow(),
image: varchar('image', { length: 255 })
})
export const users = mysqlTable('user', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
name: varchar('name', { length: 255 }),
email: varchar('email', { length: 255 }).notNull(),
emailVerified: timestamp('emailVerified', {
mode: 'date',
fsp: 3
}).defaultNow(),
image: varchar('image', { length: 255 })
})
export const comments = mysqlTable('comment', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
body: varchar('body', { length: 255 }).notNull(),
created_at: timestamp('created_at', {
mode: 'date',
fsp: 6
}).defaultNow(),
updated_at: timestamp('updated_at', {
mode: 'date',
fsp: 6
}).defaultNow(),
userId: varchar('userId', { length: 255 })
.notNull()
.references(() => users.id)
})
export const comments = mysqlTable('comment', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
body: varchar('body', { length: 255 }).notNull(),
created_at: timestamp('created_at', {
mode: 'date',
fsp: 6
}).defaultNow(),
updated_at: timestamp('updated_at', {
mode: 'date',
fsp: 6
}).defaultNow(),
userId: varchar('userId', { length: 255 })
.notNull()
.references(() => users.id)
})
Also, I am using NextAuth. Do I need to add relations to connect users with account and session?
3 replies