Fortellis certification updates.
This commit is contained in:
@@ -136,11 +136,7 @@ async function GetFortellisMakes(req, cdk_dealerid) {
|
||||
}
|
||||
});
|
||||
|
||||
logger.log("fortellis-replace-makes-models-response", "ERROR", req.user.email, null, {
|
||||
cdk_dealerid,
|
||||
xml: result
|
||||
});
|
||||
return result.data;
|
||||
return result.data?.data;
|
||||
} catch (error) {
|
||||
logger.log("fortellis-replace-makes-models-error", "ERROR", req.user.email, null, {
|
||||
cdk_dealerid,
|
||||
@@ -166,14 +162,17 @@ exports.fortellis = async function ReloadFortellisMakes(req, res) {
|
||||
|
||||
//Insert the new ones.
|
||||
|
||||
|
||||
const insertResult = await client.setHeaders({ Authorization: BearerToken }).request(queries.INSERT_DMS_VEHICLES, {
|
||||
vehicles: newList.map((i) => {
|
||||
//Below filtering is requried due to schema requirements.
|
||||
//Does not make sense for there to be empty entries, but leaving in to prevent prod issues.
|
||||
vehicles: newList.filter(i => i.make && i.model && i.make !== '' && i.model !== '' && i.fullMakeName && i.fullModelName && i.fullMakeName !== '' && i.fullModelName !== '').map((i) => {
|
||||
return {
|
||||
bodyshopid,
|
||||
makecode: i.makeCode,
|
||||
modelcode: i.modelCode,
|
||||
make: i.makeFullName,
|
||||
model: i.modelFullName
|
||||
makecode: i.make,
|
||||
modelcode: i.model,
|
||||
make: i.fullMakeName,
|
||||
model: i.fullModelName
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user