up
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user