Merge branch 'master' of https://bitbucket.org/green-caterpillar/autocatbackend
This commit is contained in:
commit
b1c77ba9c5
15
migration.js
15
migration.js
@ -51,9 +51,22 @@ async function fixNullEvents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fixNullNotes() {
|
||||||
|
let client = await MongoClient.connect(process.env.MONGO_CONNECTION_STRING, { useUnifiedTopology: true });
|
||||||
|
let db = client.db('autocatdev');
|
||||||
|
let collection = db.collection('vehicles');
|
||||||
|
let vehicles = await collection.find().toArray();
|
||||||
|
for(let vehicle of vehicles) {
|
||||||
|
if(vehicle.notes == null) {
|
||||||
|
//console.log(vehicle.events);
|
||||||
|
await collection.updateOne({ number: vehicle.number }, { $set: { notes: [] } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
//await addUpdatedDate();
|
//await addUpdatedDate();
|
||||||
//await addDebugInfoStatus();
|
//await addDebugInfoStatus();
|
||||||
await fixNullEvents();
|
await fixNullNotes();
|
||||||
console.log('====== Done ======');
|
console.log('====== Done ======');
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -75,7 +75,7 @@ router.post('/check', async (req, res) => {
|
|||||||
} else if(autocod.status == 'rejected') {
|
} else if(autocod.status == 'rejected') {
|
||||||
vehicle = vin01.value;
|
vehicle = vin01.value;
|
||||||
Object.assign(vehicle.debugInfo, autocod.reason.debugInfo);
|
Object.assign(vehicle.debugInfo, autocod.reason.debugInfo);
|
||||||
if(!vehicle.brand.name.normalized) {
|
if(!vehicle.brand?.name?.normalized) {
|
||||||
throw autocod.reason;
|
throw autocod.reason;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user