You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
645 B
37 lines
645 B
4 years ago
|
import { model, Schema, Document } from "mongoose"
|
||
|
import { authProviders } from '../types'
|
||
|
|
||
|
export interface User extends Document {
|
||
|
providerId: string
|
||
|
name: string
|
||
|
email: string
|
||
|
provider: authProviders
|
||
|
photo?: string
|
||
|
}
|
||
|
|
||
|
const userSchema = new Schema(
|
||
|
{
|
||
|
providerId: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
},
|
||
|
provider: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
email: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
photo: String
|
||
|
},
|
||
|
{ timestamps: true }
|
||
|
)
|
||
|
|
||
|
const UserModel = model<User>("User", userSchema)
|
||
|
export default UserModel
|