mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +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', {
|
||||
username: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
hashedPassword: String,
|
||||
google: {
|
||||
id: String,
|
||||
displayName: String,
|
||||
},
|
||||
github: {
|
||||
id: String,
|
||||
displayName: String,
|
||||
},
|
||||
})
|
||||
const User = model(
|
||||
'User',
|
||||
new Schema(
|
||||
{
|
||||
username: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
hashedPassword: String,
|
||||
google: {
|
||||
id: String,
|
||||
displayName: String,
|
||||
},
|
||||
github: {
|
||||
id: String,
|
||||
displayName: String,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
export default User
|
||||
Reference in new issue
Block a user