up
This commit is contained in:
@@ -51,12 +51,13 @@ module.exports.deviceRegistration = [
|
||||
const data = {
|
||||
// deviceId: RegisteredDevice.deviceId,
|
||||
installationDate: new Date(registeredDevice.activated_at),
|
||||
deviceType: registeredDevice.device_type.name,
|
||||
deviceType: convertModel(registeredDevice.device_type.name),
|
||||
status: 1,
|
||||
registerDate: new Date(),
|
||||
userId: req.user_id,
|
||||
IMEI: req.body.IMEI,
|
||||
profit: fee.amount
|
||||
profit: fee.amount,
|
||||
score: score.amount
|
||||
}
|
||||
// 1.add to installed device
|
||||
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,
|
||||
default: ''
|
||||
},
|
||||
score: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
userId: {
|
||||
type: String,
|
||||
ref: 'UserGPS'
|
||||
|
||||
Reference in New Issue
Block a user