anomaly.prototype.deleteAnomaly = function()

in source/services/anomaly/lib/anomaly.js [207:243]


    anomaly.prototype.deleteAnomaly = function(id, vin, cb) {

        let params = {
            TableName: ddbTable,
            Key: {
                dtc_id: id,
                vin: 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)) {
                docClient.delete(params, function(err, data) {
                    if (err) {
                        console.log(err);
                        return cb(err, null);
                    }

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

        });

    };