mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: add Timestamps to User model
This commit is contained in:
1 parent
916b78240c
commit
d3dd12a547
1 file changed
+30
-22
+30
-22
@@ -1,25 +1,33 @@
|
|||||||
import { model } from 'mongoose'
|
import { model, Schema } from 'mongoose'
|
||||||
|
|
||||||
const User = model('User', {
|
const User = model(
|
||||||
username: {
|
'User',
|
||||||
type: String,
|
new Schema(
|
||||||
unique: true,
|
{
|
||||||
required: true,
|
username: {
|
||||||
},
|
type: String,
|
||||||
email: {
|
unique: true,
|
||||||
type: String,
|
required: true,
|
||||||
unique: true,
|
},
|
||||||
required: true,
|
email: {
|
||||||
},
|
type: String,
|
||||||
hashedPassword: String,
|
unique: true,
|
||||||
google: {
|
required: true,
|
||||||
id: String,
|
},
|
||||||
displayName: String,
|
hashedPassword: String,
|
||||||
},
|
google: {
|
||||||
github: {
|
id: String,
|
||||||
id: String,
|
displayName: String,
|
||||||
displayName: String,
|
},
|
||||||
},
|
github: {
|
||||||
})
|
id: String,
|
||||||
|
displayName: String,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timestamps: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
export default User
|
export default User
|
||||||
Reference in new issue
Block a user