feat: change to use commonjs output

This commit is contained in:
Lin, Hung-Shin authored and wancat committed 2024-01-29 12:42:50 +08:00
1 parent 2bdb804f24
commit 557af91d4b
24 files changed
+35 -18

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
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(
{
username: {
type: String,
unique: true,
required: true,
},
email: {
type: String,
unique: true,
required: true,
},
hashedPassword: String,
socialLogins: {
type: Map,
of: socialLoginSchema,
default: {},
required: true,
},
},
{
timestamps: true,
}
)
)
export default User