BREAKING: change user social login schema

This commit is contained in:
wancat committed 2023-11-18 16:29:37 +08:00
1 parent 9e935b320a
commit 81581c4635
8 files changed
+59 -32

No files matched your search

+20 -7
View File
@@ -1,5 +1,20 @@
import { model, Schema } from 'mongoose'
const socialLoginSchema = new Schema({
provider: {
type: String,
required: true,
},
id: {
type: String,
required: true,
},
displayName: {
type: String,
required: false,
},
})
const User = model(
'User',
new Schema(
@@ -15,13 +30,11 @@ const User = model(
required: true,
},
hashedPassword: String,
google: {
id: String,
displayName: String,
},
github: {
id: String,
displayName: String,
socialLogins: {
type: Map,
of: socialLoginSchema,
default: {},
required: true,
},
},
{