dtc.prototype.updateVehicle = function()

in source/services/dtc/lib/dtc.js [222:267]


    dtc.prototype.updateVehicle = function(dtcinfo, cb) {

        let params = {
            TableName: ddbTable,
            Key: {
                dtc_id: dtcinfo.dtc_id,
                vin: dtcinfo.vin
            }
        };

        let docClient = new AWS.DynamoDB.DocumentClient(dynamoConfig);
        docClient.get(params, function(err, dtc) {
            if (err) {
                console.log(err);
                return cb(err, null);
            }

            if (!_.isEmpty(dtc)) {

                dtc.Item.updated_at = moment().utc().format();

                let updateparams = {
                    TableName: ddbTable,
                    Item: dtc.Item
                };

                docClient.put(updateparams, function(err, data) {
                    if (err) {
                        console.log(err);
                        return cb(err, null);
                    }

                    return cb(null, data);

                });
            } else {
                return cb({
                    error: {
                        message: 'The dtc record requested to update does not exist.'
                    }
                }, null);
            }

        });

    };