first commit

This commit is contained in:
kicap1992
2022-08-10 22:03:16 +08:00
commit 9ea6fc9802
7 changed files with 3450 additions and 0 deletions

68
models/device_model.js Normal file
View File

@ -0,0 +1,68 @@
const mongoose = require('mongoose');
const deviceSchema = new mongoose.Schema(
{
_id : {
type : String,
required : true,
maxLength : 12,
},
lat:{
type : String
},
lng:{
type : String
},
status : {
type : String,
// required : true,
},
created_at : {
type : Date,
default : Date.now,
},
updated_at : {
type : Date,
default : Date.now,
}
}
)
const newDeviceSchema = new mongoose.Schema(
{
_id : {
type : String,
required : true,
},
lat:{
type : String
},
lng:{
type : String
},
status: {
type : String,
default : 'Pending',
}
}
)
const notificationSchema = new mongoose.Schema(
{
_id : {
type : String,
required : true,
},
status: {
type : String,
required : true,
}
}
)
const deviceModel = mongoose.model('device', deviceSchema, 'device');
const newDeviceModel = mongoose.model('new_device', newDeviceSchema, 'new_device');
const notificationModel = mongoose.model('notification', notificationSchema, 'notification');
module.exports = {deviceModel , newDeviceModel, notificationModel};