forked from cartsnitch/cartsnitch
fix(auth): re-add session table model mapping
Better-Auth defaults to singular "session" table with camelCase columns, but our DB uses plural "sessions" with snake_case columns (migration 002). Add modelName and field mappings to match the existing pattern for user, account, and verification models. Fixes: 401 on login and 422 on registration. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -36,6 +36,15 @@ export const auth = betterAuth({
|
|||||||
},
|
},
|
||||||
|
|
||||||
session: {
|
session: {
|
||||||
|
modelName: "sessions",
|
||||||
|
fields: {
|
||||||
|
userId: "user_id",
|
||||||
|
expiresAt: "expires_at",
|
||||||
|
ipAddress: "ip_address",
|
||||||
|
userAgent: "user_agent",
|
||||||
|
createdAt: "created_at",
|
||||||
|
updatedAt: "updated_at",
|
||||||
|
},
|
||||||
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
||||||
updateAge: 60 * 60 * 24, // refresh after 1 day
|
updateAge: 60 * 60 * 24, // refresh after 1 day
|
||||||
cookieCache: {
|
cookieCache: {
|
||||||
|
|||||||
Reference in New Issue
Block a user