This commit is contained in:
morteza-mortezai
2025-12-03 14:58:44 +03:30
parent 85b88c426c
commit 536944c51d
2 changed files with 20 additions and 2 deletions
+16 -2
View File
@@ -51,12 +51,13 @@ module.exports.deviceRegistration = [
const data = { const data = {
// deviceId: RegisteredDevice.deviceId, // deviceId: RegisteredDevice.deviceId,
installationDate: new Date(registeredDevice.activated_at), installationDate: new Date(registeredDevice.activated_at),
deviceType: registeredDevice.device_type.name, deviceType: convertModel(registeredDevice.device_type.name),
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 profit: fee.amount,
score: score.amount
} }
// 1.add to installed device // 1.add to installed device
const installedDevice = await InstalledDevice.create(data) const installedDevice = await InstalledDevice.create(data)
@@ -292,3 +293,16 @@ module.exports.updateInstalled = [
} }
} }
] ]
function convertModel(model) {
switch (model.toLowerCase()) {
case 'gs10g':
return 'G10'
case 'concox_x3':
return 'G11'
case 'concox_x5':
return 'G12'
default:
return model
}
}
+4
View File
@@ -26,6 +26,10 @@ const InstalledDeviceSchema = mongoose.Schema({
type: String, type: String,
default: '' default: ''
}, },
score: {
type: String,
default: ''
},
userId: { userId: {
type: String, type: String,
ref: 'UserGPS' ref: 'UserGPS'