UNPKG

@brendon1555/authjs-mongoose-adapter

Version:
33 lines (32 loc) 1.06 kB
import { Schema } from "mongoose"; export const userSchema = new Schema({ name: { type: String }, email: { type: String, unique: true }, emailVerified: { type: Date }, image: { type: String }, }); export const accountSchema = new Schema({ userId: { type: Schema.Types.ObjectId, ref: "User" }, type: { type: String }, provider: { type: String }, providerAccountId: { type: String }, refresh_token: { type: String }, access_token: { type: String }, expires_at: { type: Number }, token_type: { type: String }, scope: { type: String }, id_token: { type: String }, oauth_token_secret: { type: String }, oauth_token: { type: String }, session_state: { type: String }, }); export const sessionSchema = new Schema({ sessionToken: { type: String, unique: true }, userId: { type: Schema.Types.ObjectId, ref: "User" }, expires: { type: Date }, }); export const verificationTokenSchema = new Schema({ token: { type: String }, identifier: { type: String }, expires: { type: Date }, });