summary refs log tree commit diff
path: root/src/db/schemas/user.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/schemas/user.js')
-rw-r--r--src/db/schemas/user.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/db/schemas/user.js b/src/db/schemas/user.js

index 9d08680..f490966 100644 --- a/src/db/schemas/user.js +++ b/src/db/schemas/user.js
@@ -1,6 +1,24 @@ import { model, Schema } from 'mongoose'; import { hash, compare } from 'bcrypt'; +export const deviceSchema = new Schema({ + name: { + type: String, + required: true, + trim: true + }, + createdAt: { + type: Date, + default: Date.now, + immutable: true + }, + lastSeen: { + type: Date, + default: Date.now, + required: true + } +}); + /** * User schema for MongoDB. * @type {module:mongoose.Schema} @@ -31,6 +49,10 @@ export const userSchema = new Schema({ type: Date, default: Date.now, immutable: true + }, + devices: { + type: [deviceSchema], + default: [] } });