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, status: 1,
registerDate: new Date(), registerDate: new Date(),
userId: req.user_id, userId: req.user_id,
IMEI: req.body.IMEI IMEI: req.body.IMEI,
profit: fee.amount
} }
// 1.add to installed device // 1.add to installed device
const installedDevice = await InstalledDevice.create(data) const installedDevice = await InstalledDevice.create(data)
+12 -8
View File
@@ -3,29 +3,33 @@ const mongoose = require('mongoose')
const InstalledDeviceSchema = mongoose.Schema({ const InstalledDeviceSchema = mongoose.Schema({
deviceId: { deviceId: {
type: String, type: String,
ref: "Device" ref: 'Device'
}, },
IMEI:String, IMEI: String,
deviceType:String, deviceType: String,
status: { status: {
type: Number, type: Number,
enum: [ enum: [
0, // Pending 0, // Pending
1, // Accepted 1, // Accepted
2, // Rejected 2 // Rejected
], ],
default: 0 default: 0
}, },
registerDate: Date, registerDate: Date,
installationDate: Date, installationDate: Date,
check:{ check: {
type:Boolean, type: Boolean,
default:false default: false
},
profit: {
type: String,
default: ''
}, },
userId: { userId: {
type: String, type: String,
ref: 'UserGPS' ref: 'UserGPS'
}, }
}) })
module.exports = mongoose.model('InstalledDevice', InstalledDeviceSchema) module.exports = mongoose.model('InstalledDevice', InstalledDeviceSchema)