feat(auth): enhance user schema with role and ban features
This commit is contained in:
@@ -2,7 +2,7 @@ import { betterAuth } from 'better-auth'
|
||||
import { drizzleAdapter } from 'better-auth/adapters/drizzle'
|
||||
import { useDrizzle } from './db.js'
|
||||
import * as schema from '@/db/schema.ts'
|
||||
import { bearer, jwt, username } from 'better-auth/plugins'
|
||||
import { admin, bearer, jwt, username } from 'better-auth/plugins'
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: drizzleAdapter(useDrizzle(), {
|
||||
@@ -12,16 +12,13 @@ export const auth = betterAuth({
|
||||
},
|
||||
}),
|
||||
user: {
|
||||
additionalFields: {
|
||||
role: {
|
||||
type: 'string',
|
||||
defaultValue: 'user',
|
||||
input: false,
|
||||
},
|
||||
},
|
||||
additionalFields: {},
|
||||
},
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
plugins: [username(), bearer(), jwt()],
|
||||
plugins: [admin(), username(), bearer(), jwt()],
|
||||
advanced: {
|
||||
cookiePrefix: 'helios_auth',
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user