add profit to installed device

This commit is contained in:
morteza-mortezai
2025-12-03 11:07:57 +03:30
parent 5b9d14ee44
commit 85b88c426c
2 changed files with 31 additions and 26 deletions
+2 -1
View File
@@ -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)
+7 -3
View File
@@ -3,7 +3,7 @@ const mongoose = require('mongoose')
const InstalledDeviceSchema = mongoose.Schema({
deviceId: {
type: String,
ref: "Device"
ref: 'Device'
},
IMEI: String,
deviceType: String,
@@ -12,7 +12,7 @@ const InstalledDeviceSchema = mongoose.Schema({
enum: [
0, // Pending
1, // Accepted
2, // Rejected
2 // Rejected
],
default: 0
},
@@ -22,10 +22,14 @@ const InstalledDeviceSchema = mongoose.Schema({
type: Boolean,
default: false
},
profit: {
type: String,
default: ''
},
userId: {
type: String,
ref: 'UserGPS'
},
}
})
module.exports = mongoose.model('InstalledDevice', InstalledDeviceSchema)