Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #42 from vehicle-history/updated-models
Browse files Browse the repository at this point in the history
Updated models
  • Loading branch information
Zenedith committed Feb 11, 2016
2 parents e412536 + a87acf1 commit 1e81805
Show file tree
Hide file tree
Showing 79 changed files with 348 additions and 292 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"trailing": true,
"undef": true,
"unused": true,
"maxlen": 100,
"maxlen": 140,
"latedef": true
}
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ module.exports = {
* @type report
* @static
*/
report: require('./lib/model/response/report')
report: require('./lib/model/response/report'),

/**
* the vehicleReportsCollection model and builder.
* @property vehicleReportsCollection
* @type vehicleReportsCollection
* @static
*/
vehicleReportsCollection: require('./lib/model/response/vehicleReportsCollection')
},

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/builder/event/changeOwnerEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var ChangeOwnerEventBuilder = require('../../model/response/event/changeOwnerEvent').ChangeOwnerEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build changeOwner event:', event);

assert.object(event, 'event');
Expand All @@ -23,4 +21,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/changedRegistrationLocationEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var ChangedRegistrationLocationEventBuilder = require('../../model/response/event/changedRegistrationLocationEvent').ChangedRegistrationLocationEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build change registration location event:', event);

assert.object(event, 'event');
Expand All @@ -21,4 +19,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/coOwnerEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var ChangeOwnerEventBuilder = require('../../model/response/event/changeOwnerEvent').ChangeOwnerEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build coOwner event:', event);

assert.object(event, 'event');
Expand All @@ -21,4 +19,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/deregistrationEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var DeregistrationEventBuilder = require('../../model/response/event/deregistrationEvent').DeregistrationEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build deregistration event:', event);

assert.object(event, 'event');
Expand All @@ -21,4 +19,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/holderEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var ChangeOwnerEventBuilder = require('../../model/response/event/changeOwnerEvent').ChangeOwnerEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build holder event:', event);

assert.object(event, 'event');
Expand All @@ -21,4 +19,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/inspectionEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var InspectionEventBuilder = require('../../model/response/event/inspectionEvent').InspectionEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build inspection event:', event);

assert.object(event, 'event');
Expand All @@ -22,4 +20,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/productionEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var logger = require('../../logger/logger').logger;
var ProductionEventBuilder = require('../../model/response/event/productionEvent').ProductionEventBuilder;
var EventEnum = require('../../enum/eventEnum').EventEnum;

var exports = {};

exports.build = function (event, productionYear) {
var build = function build(event, productionYear) {
logger.debug('build production event:', event);

var formats = null;
Expand All @@ -30,4 +28,6 @@ exports.build = function (event, productionYear) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/registrationEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var logger = require('../../logger/logger').logger;
var RegistrationEventBuilder = require('../../model/response/event/registrationEvent').RegistrationEventBuilder;
var EventEnum = require('../../enum/eventEnum').EventEnum;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build registration event:', event);

assert.object(event, 'event');
Expand All @@ -22,4 +20,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/event/stolenEventBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ require('../../date');
var logger = require('../../logger/logger').logger;
var StolenEventBuilder = require('../../model/response/event/stolenEvent').StolenEventBuilder;

var exports = {};

exports.build = function (event) {
var build = function build(event) {
logger.debug('build stolen event:', event);

assert.object(event, 'event');
Expand All @@ -20,4 +18,6 @@ exports.build = function (event) {
.build();
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/eventsResponseBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ var holderEventBuilder = require('./event/holderEventBuilder');
var changedRegistrationLocationEventBuilder = require('./event/changedRegistrationLocationEventBuilder');
var stolenEventBuilder = require('./event/stolenEventBuilder');

var exports = {};

exports.build = function (map, callback) {
var build = function build(map, callback) {
logger.debug('build events', map);

var productionYear = map['production.year'];
Expand Down Expand Up @@ -82,4 +80,6 @@ exports.build = function (map, callback) {
return callback(null, events);
};

module.exports = exports;
module.exports = {
build: build
};
9 changes: 4 additions & 5 deletions lib/builder/responseBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ var ReportBuilder = require('./../model/response/report').ReportBuilder;
var vehicleResponseBuilder = require('./vehicleResponseBuilder');
var eventsResponseBuilder = require('./eventsResponseBuilder');

var exports = {};

var getPropertyIfExists = function (results, property) {
if (results.hasOwnProperty(property)) {
return results[property];
Expand All @@ -14,7 +12,7 @@ var getPropertyIfExists = function (results, property) {
return null;
};

exports.build = function (map, options, callback) {
var build = function build(map, options, callback) {
logger.debug('build response');

async.parallel({
Expand Down Expand Up @@ -44,5 +42,6 @@ exports.build = function (map, options, callback) {
});
};


module.exports = exports;
module.exports = {
build: build
};
9 changes: 4 additions & 5 deletions lib/builder/vehicle/engineBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Engine = require('../../model/response/vehicle/engine').Engine;
var mapHelper = require('./../../mapHelper');
var carEngineResolver = require('./../../resolver/vehicle/carEngineResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var cubicCapacity = mapHelper.getMapValue(map, carEngineResolver.ENGINE_CUBIC_CAPACITY_MAP_FIELD);
Expand All @@ -24,5 +22,6 @@ exports.build = function (map) {
return new Engine(cubicCapacity, fuel);
};


module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/vehicle/inspectionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Inspection = require('../../model/response/vehicle/inspection').Inspection;
var mapHelper = require('./../../mapHelper');
var carInspectionResolver = require('./../../resolver/vehicle/carInspectionResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var status = mapHelper.getMapValue(map, carInspectionResolver.INSPECTION_STATUS_MAP_FIELD);
Expand All @@ -19,4 +17,6 @@ exports.build = function (map) {
return new Inspection(status);
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/vehicle/mileageBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Mileage = require('../../model/response/vehicle/mileage').Mileage;
var mapHelper = require('./../../mapHelper');
var carMileageResolver = require('./../../resolver/vehicle/carMileageResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var value = mapHelper.getMapValue(map, carMileageResolver.MILEAGE_VALUE_MAP_FIELD);
Expand All @@ -25,4 +23,6 @@ exports.build = function (map) {
return new Mileage(value, type);
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/vehicle/nameBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Name = require('../../model/response/vehicle/name').Name;
var mapHelper = require('./../../mapHelper');
var carNameResolver = require('./../../resolver/vehicle/carNameResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var make = mapHelper.getMapValue(map, carNameResolver.MANUFACTURER_MAP_FIELD);
Expand All @@ -25,4 +23,6 @@ exports.build = function (map) {
return new Name(make, name, model);
};

module.exports = exports;
module.exports = {
build: build
};
9 changes: 4 additions & 5 deletions lib/builder/vehicle/plateBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Plate = require('../../model/response/vehicle/plate').Plate;
var mapHelper = require('./../../mapHelper');
var carPlateResolver = require('./../../resolver/vehicle/carPlateResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var value = mapHelper.getMapValue(map, carPlateResolver.PLATE_VALUE_MAP_FIELD);
Expand All @@ -24,5 +22,6 @@ exports.build = function (map) {
return new Plate(value, country);
};


module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/vehicle/policyBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Policy = require('../../model/response/vehicle/policy').Policy;
var mapHelper = require('./../../mapHelper');
var carPolicyResolver = require('./../../resolver/vehicle/carPolicyResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var status = mapHelper.getMapValue(map, carPolicyResolver.POLICY_STATUS_MAP_FIELD);
Expand All @@ -19,4 +17,6 @@ exports.build = function (map) {
return new Policy(status);
};

module.exports = exports;
module.exports = {
build: build
};
8 changes: 4 additions & 4 deletions lib/builder/vehicle/productionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ var Production = require('../../model/response/vehicle/production').Production;
var mapHelper = require('./../../mapHelper');
var carProductionResolver = require('./../../resolver/vehicle/carProductionResolver');

var exports = {};

exports.build = function (map) {
var build = function build(map) {
assert.object(map, 'map');

var year = mapHelper.getMapValue(map, carProductionResolver.PRODUCTION_YEAR_MAP_FIELD);
Expand All @@ -19,4 +17,6 @@ exports.build = function (map) {
return new Production(year);
};

module.exports = exports;
module.exports = {
build: build
};
Loading

0 comments on commit 1e81805

Please sign in to comment.