diff --git a/server/controllers/GPS.InstalledDevice.js b/server/controllers/GPS.InstalledDevice.js index 9e85d14..8bb1748 100644 --- a/server/controllers/GPS.InstalledDevice.js +++ b/server/controllers/GPS.InstalledDevice.js @@ -55,7 +55,8 @@ module.exports.deviceRegistration = [ status: 1, registerDate: new Date(), userId: req.user_id, - IMEI: req.body.IMEI + IMEI: req.body.IMEI, + profit: fee.amount } // 1.add to installed device const installedDevice = await InstalledDevice.create(data) diff --git a/server/models/GPS.InstalledDevice.js b/server/models/GPS.InstalledDevice.js index e77e0b4..dcfc2db 100644 --- a/server/models/GPS.InstalledDevice.js +++ b/server/models/GPS.InstalledDevice.js @@ -1,31 +1,35 @@ const mongoose = require('mongoose') const InstalledDeviceSchema = mongoose.Schema({ - deviceId: { - type: String, - ref: "Device" - }, - IMEI:String, - deviceType:String, - status: { - type: Number, - enum: [ - 0, // Pending - 1, // Accepted - 2, // Rejected - ], - default: 0 - }, - registerDate: Date, - installationDate: Date, - check:{ - type:Boolean, - default:false - }, - userId: { - type: String, - ref: 'UserGPS' - }, + deviceId: { + type: String, + ref: 'Device' + }, + IMEI: String, + deviceType: String, + status: { + type: Number, + enum: [ + 0, // Pending + 1, // Accepted + 2 // Rejected + ], + default: 0 + }, + registerDate: Date, + installationDate: Date, + check: { + type: Boolean, + default: false + }, + profit: { + type: String, + default: '' + }, + userId: { + type: String, + ref: 'UserGPS' + } }) module.exports = mongoose.model('InstalledDevice', InstalledDeviceSchema)