From 9f1da16d3c55cfb5c600c494280b27e64abd7ba4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Victor=20Tozatti=20Risso?= <jvtr12@c3sl.ufpr.br>
Date: Mon, 29 Aug 2016 14:00:06 -0300
Subject: [PATCH] Clear build directory

Remove all files from build directory. The rationale is that this
directory is updated frequently during the development process and might
add too much 'noise' in the commits in the repository.
---
 build/config.json                |  16 --
 build/libs/app.js                |  43 -----
 build/libs/config.js             |   7 -
 build/libs/db/monet.js           |  24 ---
 build/libs/db/query_decorator.js |  22 ---
 build/libs/enrollment/all.js     |   1 -
 build/libs/enrollment/city.js    |   1 -
 build/libs/enrollment/common.js  |  15 --
 build/libs/enrollment/country.js |   1 -
 build/libs/enrollment/region.js  |   1 -
 build/libs/enrollment/state.js   |   1 -
 build/libs/log.js                |  33 ----
 build/libs/query_decorator.js    |  22 ---
 build/libs/routes/api.js         | 308 -------------------------------
 build/libs/routes/cities.js      |  85 ---------
 build/libs/routes/regions.js     |  54 ------
 build/libs/routes/states.js      |  70 -------
 build/logs/.gitignore            |   1 -
 build/server.js                  |  18 --
 build/test/test.js               | 139 --------------
 20 files changed, 862 deletions(-)
 delete mode 100644 build/config.json
 delete mode 100644 build/libs/app.js
 delete mode 100644 build/libs/config.js
 delete mode 100644 build/libs/db/monet.js
 delete mode 100644 build/libs/db/query_decorator.js
 delete mode 100644 build/libs/enrollment/all.js
 delete mode 100644 build/libs/enrollment/city.js
 delete mode 100644 build/libs/enrollment/common.js
 delete mode 100644 build/libs/enrollment/country.js
 delete mode 100644 build/libs/enrollment/region.js
 delete mode 100644 build/libs/enrollment/state.js
 delete mode 100644 build/libs/log.js
 delete mode 100644 build/libs/query_decorator.js
 delete mode 100644 build/libs/routes/api.js
 delete mode 100644 build/libs/routes/cities.js
 delete mode 100644 build/libs/routes/regions.js
 delete mode 100644 build/libs/routes/states.js
 delete mode 100644 build/logs/.gitignore
 delete mode 100644 build/server.js
 delete mode 100644 build/test/test.js

diff --git a/build/config.json b/build/config.json
deleted file mode 100644
index 076d753b..00000000
--- a/build/config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-    "port": 3000,
-    "monetdb": {
-        "host": "simcaqdb1",
-        "port": 50000,
-        "dbname": "simcaq_dev",
-        "user": "monetdb",
-        "password":"monetdb",
-        "nrConnections": 16
-    },
-    "default": {
-        "api": {
-            "version" : "v1"
-        }
-    }
-}
diff --git a/build/libs/app.js b/build/libs/app.js
deleted file mode 100644
index a678b1c4..00000000
--- a/build/libs/app.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict';
-
-var express = require('express');
-var cookieParser = require('cookie-parser');
-var bodyParser = require('body-parser');
-var methodOverride = require('method-override');
-var cors = require('cors');
-
-var log = require('./log')(module);
-
-var api = require('./routes/api');
-var states = require('./routes/states');
-var regions = require('./routes/regions');
-var cities = require('./routes/cities');
-
-var app = express();
-
-app.use(bodyParser.json());
-app.use(bodyParser.urlencoded({ extended: false }));
-app.use(cookieParser());
-app.use(cors());
-app.use(methodOverride());
-
-app.use('/v1/', api);
-app.use('/v1/states', states);
-app.use('/v1/regions', regions);
-app.use('/v1/cities', cities);
-
-// catch 404 and forward to error handler
-app.use(function (req, res, next) {
-    res.status(404);
-    log.debug('%s %d %s', req.method, res.statusCode, req.url);
-    res.json({ error: 'Not found' }).end();
-});
-
-// error handlers
-app.use(function (err, req, res, next) {
-    res.status(err.status || 500);
-    log.error('%s %d %s', req.method, res.statusCode, err.message);
-    res.json({ error: err.message }).end();
-});
-
-module.exports = app;
\ No newline at end of file
diff --git a/build/libs/config.js b/build/libs/config.js
deleted file mode 100644
index 2f7bd18e..00000000
--- a/build/libs/config.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-var nconf = require('nconf');
-
-nconf.argv().env().file({ file: process.cwd() + '/config.json' });
-
-module.exports = nconf;
\ No newline at end of file
diff --git a/build/libs/db/monet.js b/build/libs/db/monet.js
deleted file mode 100644
index c8d29099..00000000
--- a/build/libs/db/monet.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-var MonetDBPool = require('monetdb-pool');
-
-var libs = process.cwd() + '/libs';
-
-var config = require(libs + '/config');
-
-var poolOptions = {
-    nrConnections: config.get('monetdb:nrConnections')
-};
-
-var options = {
-    host: config.get('monetdb:host'),
-    port: config.get('monetdb:port'),
-    dbname: config.get('monetdb:dbname'),
-    user: config.get('monetdb:user'),
-    password: config.get('monetdb:password')
-};
-
-var conn = new MonetDBPool(poolOptions, options);
-conn.connect();
-
-module.exports = conn;
\ No newline at end of file
diff --git a/build/libs/db/query_decorator.js b/build/libs/db/query_decorator.js
deleted file mode 100644
index ce0697d7..00000000
--- a/build/libs/db/query_decorator.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-
-var libs = process.cwd() + "/libs";
-var log = require(libs + "/log")(module);
-var conn = require(libs + "/db/monet");
-
-/**
- * Basic decorator to wrap SQL query strings
- */
-exports.execQuery = function (sqlQuery, sqlQueryParams) {
-    log.debug("Executing SQL query '" + sqlQuery + "' with params '" + sqlQueryParams + "'");
-    conn.prepare(sqlQuery, true).then(function (dbQuery) {
-        dbQuery.exec(sqlQueryParams).then(function (dbResult) {
-            log.debug(dbResult.data);
-            log.debug("Query result: " + dbResult.data);
-            return dbResult;
-        }, function (error) {
-            log.error("SQL query execution error: " + error.message);
-            return error;
-        });
-    });
-};
\ No newline at end of file
diff --git a/build/libs/enrollment/all.js b/build/libs/enrollment/all.js
deleted file mode 100644
index 9a390c31..00000000
--- a/build/libs/enrollment/all.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";
\ No newline at end of file
diff --git a/build/libs/enrollment/city.js b/build/libs/enrollment/city.js
deleted file mode 100644
index 9a390c31..00000000
--- a/build/libs/enrollment/city.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";
\ No newline at end of file
diff --git a/build/libs/enrollment/common.js b/build/libs/enrollment/common.js
deleted file mode 100644
index 9c788951..00000000
--- a/build/libs/enrollment/common.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-
-var libs = process.cwd() + '/libs';
-
-var log = require(libs + '/log')(module);
-
-var sqlDecorator = require(libs + '/query_decorator');
-
-var yearRange = function yearRange() {
-    var yearSql = 'SELECT MIN(t.ano_censo) AS start_year, MAX(t.ano_censo)' + 'AS end_year FROM turmas AS t';
-    log.debug('Generated SQL query for enrollments\' year range');
-    return sqlDecorator.execQuery(yearSql, []);
-};
-
-module.exports = yearRange;
\ No newline at end of file
diff --git a/build/libs/enrollment/country.js b/build/libs/enrollment/country.js
deleted file mode 100644
index 9a390c31..00000000
--- a/build/libs/enrollment/country.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";
\ No newline at end of file
diff --git a/build/libs/enrollment/region.js b/build/libs/enrollment/region.js
deleted file mode 100644
index 9a390c31..00000000
--- a/build/libs/enrollment/region.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";
\ No newline at end of file
diff --git a/build/libs/enrollment/state.js b/build/libs/enrollment/state.js
deleted file mode 100644
index 9a390c31..00000000
--- a/build/libs/enrollment/state.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";
\ No newline at end of file
diff --git a/build/libs/log.js b/build/libs/log.js
deleted file mode 100644
index e93d2ff2..00000000
--- a/build/libs/log.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict';
-
-var winston = require('winston');
-
-winston.emitErrs = true;
-
-function getFilePath(module) {
-    // using filename in log statements
-    return module.filename.split('/').slice(-2).join('/');
-}
-
-function logger(module) {
-    return new winston.Logger({
-        transports: [new winston.transports.File({
-            level: 'info',
-            filename: process.cwd() + '/logs/all.log',
-            handleException: true,
-            json: false,
-            maxSize: 5242880, // 5MB
-            maxFiles: 2,
-            colorize: false
-        }), new winston.transports.Console({
-            level: 'debug',
-            label: getFilePath(module),
-            handleException: true,
-            json: true,
-            colorize: true
-        })],
-        exitOnError: false
-    });
-}
-
-module.exports = logger;
\ No newline at end of file
diff --git a/build/libs/query_decorator.js b/build/libs/query_decorator.js
deleted file mode 100644
index ce0697d7..00000000
--- a/build/libs/query_decorator.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-
-var libs = process.cwd() + "/libs";
-var log = require(libs + "/log")(module);
-var conn = require(libs + "/db/monet");
-
-/**
- * Basic decorator to wrap SQL query strings
- */
-exports.execQuery = function (sqlQuery, sqlQueryParams) {
-    log.debug("Executing SQL query '" + sqlQuery + "' with params '" + sqlQueryParams + "'");
-    conn.prepare(sqlQuery, true).then(function (dbQuery) {
-        dbQuery.exec(sqlQueryParams).then(function (dbResult) {
-            log.debug(dbResult.data);
-            log.debug("Query result: " + dbResult.data);
-            return dbResult;
-        }, function (error) {
-            log.error("SQL query execution error: " + error.message);
-            return error;
-        });
-    });
-};
\ No newline at end of file
diff --git a/build/libs/routes/api.js b/build/libs/routes/api.js
deleted file mode 100644
index 812eae43..00000000
--- a/build/libs/routes/api.js
+++ /dev/null
@@ -1,308 +0,0 @@
-'use strict';
-
-var express = require('express');
-
-var xml = require('js2xmlparser');
-
-var enrollmentApp = express();
-
-var libs = process.cwd() + '/libs';
-
-var log = require(libs + '/log')(module);
-
-var conn = require(libs + '/db/monet');
-
-function response(req, res) {
-    if (req.query.format === 'csv') {
-        res.csv(req.result.data);
-    } else if (req.query.format === 'xml') {
-        res.send(xml('result', JSON.stringify({ state: req.result.data })));
-    } else {
-        res.json({ result: req.result.data });
-    }
-}
-
-enrollmentApp.get('/', function (req, res) {
-    res.json({ msg: 'SimCAQ API is running' });
-});
-
-/**
- * Complete range of the enrollments dataset
- *
- * Returns a tuple of start and ending years of the complete enrollments dataset.
- */
-enrollmentApp.get('/year_range', function (req, res) {
-    var yearSql = 'SELECT MIN(t.ano_censo) AS start_year, MAX(t.ano_censo)' + 'AS end_year FROM turmas AS t';
-
-    conn.query(yearSql, true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query execution error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-enrollmentApp.get('/education_level', function (req, res) {
-    var edLevelSql = 'SELECT pk_etapa_ensino_id AS id, desc_etapa AS ' + 'education_level FROM etapa_ensino';
-    conn.query(edLevelSql, true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-enrollmentApp.get('/data', function (req, res) {
-    log.debug(req.query);
-    log.debug(req.query.met);
-    log.debug(req.query.dim);
-    var schoolClassSql = 'SELECT * FROM turmas';
-    conn.query(schoolClassSql, true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-enrollmentApp.use('/enrollments', function (req, res, next) {
-    var params = req.query;
-    req.paramCnt = 0;
-
-    if (typeof params.id !== 'undefined') {
-        req.id = parseInt(params.id, 10);
-        req.paramCnt += 1;
-    }
-
-    if (typeof params.location_id !== 'undefined') {
-        req.location_id = parseInt(params.location_id, 10);
-        req.paramCnt += 1;
-    }
-
-    if (typeof params.adm_dependency_id !== 'undefined') {
-        req.adm_dependency_id = parseInt(params.adm_dependency_id, 10);
-        req.paramCnt += 1;
-    }
-
-    if (typeof params.census_year !== 'undefined') {
-        req.census_year = parseInt(params.census_year, 10);
-        req.paramCnt += 1;
-    }
-
-    if (typeof params.education_level_id !== 'undefined') {
-        req.education_level_id = parseInt(params.education_level_id, 10);
-        req.paramCnt += 1;
-    }
-
-    next();
-});
-
-enrollmentApp.use('/enrollments', function (req, res, next) {
-    var params = req.query;
-    if (typeof params.aggregate !== 'undefined' && params.aggregate === 'region') {
-        log.debug('Using enrollments query for regions');
-        req.sqlQuery = 'SELECT r.nome AS name, COALESCE(SUM(t.num_matriculas), 0) AS total ' + 'FROM regioes AS r ' + 'INNER JOIN estados AS e ON r.pk_regiao_id = e.fk_regiao_id ' + 'INNER JOIN municipios AS m ON e.pk_estado_id = m.fk_estado_id ' + 'LEFT OUTER JOIN turmas AS t ON ( ' + 'm.pk_municipio_id = t.fk_municipio_id ';
-        req.sqlQueryParams = [];
-
-        if (typeof req.census_year !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.ano_censo = ?';
-            req.sqlQueryParams.push(req.census_year);
-        }
-
-        if (typeof req.adm_dependency_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_dependencia_adm_id = ?';
-            req.sqlQueryParams.push(req.adm_dependency_id);
-        }
-
-        if (typeof req.location_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.id_localizacao = ?';
-            req.sqlQueryParams.push(req.location_id);
-        }
-
-        if (typeof req.education_level_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_etapa_ensino_id = ?';
-            req.sqlQueryParams.push(req.education_level_id);
-        }
-
-        req.sqlQuery += ')';
-        if (typeof req.id !== 'undefined') {
-            req.sqlQuery += ' WHERE ';
-            req.sqlQuery += 'r.pk_regiao_id = ?';
-            req.sqlQueryParams.push(req.id);
-        }
-        req.sqlQuery += ' GROUP BY r.nome';
-    }
-    next();
-});
-
-enrollmentApp.use('/enrollments', function (req, res, next) {
-    var params = req.query;
-    if (typeof params.aggregate !== 'undefined' && params.aggregate === 'state') {
-        log.debug('Using enrollments query for states');
-        req.sqlQuery = 'SELECT e.nome AS name, COALESCE(SUM(t.num_matriculas), 0) as total ' + 'FROM estados AS e ' + 'INNER JOIN municipios AS m ON m.fk_estado_id = e.pk_estado_id ' + 'LEFT OUTER JOIN turmas AS t ON (' + 'm.pk_municipio_id = t.fk_municipio_id ';
-        req.sqlQueryParams = [];
-
-        if (typeof req.census_year !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.ano_censo = ?';
-            req.sqlQueryParams.push(req.census_year);
-        }
-
-        if (typeof req.adm_dependency_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_dependencia_adm_id = ?';
-            req.sqlQueryParams.push(req.adm_dependency_id);
-        }
-
-        if (typeof req.location_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.id_localizacao = ?';
-            req.sqlQueryParams.push(req.location_id);
-        }
-
-        if (typeof req.education_level_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_etapa_ensino_id = ?';
-            req.sqlQueryParams.push(req.education_level_id);
-        }
-
-        req.sqlQuery += ')';
-
-        if (typeof req.id !== 'undefined') {
-            req.sqlQuery += ' WHERE ';
-            req.sqlQuery += 'e.pk_estado_id = ?';
-            req.sqlQueryParams.push(req.id);
-        }
-
-        req.sqlQuery += ' GROUP BY e.nome';
-    }
-    next();
-});
-
-enrollmentApp.use('/enrollments', function (req, res, next) {
-    var params = req.query;
-    if (typeof params.aggregate !== 'undefined' && params.aggregate === 'city') {
-        log.debug('Using enrollments query for cities');
-        req.sqlQuery = 'SELECT m.nome AS name, COALESCE(SUM(t.num_matriculas), 0) as total ' + 'FROM municipios AS m ' + 'LEFT OUTER JOIN turmas AS t ON ( ' + 'm.pk_municipio_id = t.fk_municipio_id';
-        req.sqlQueryParams = [];
-
-        if (typeof req.census_year !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.ano_censo = ?';
-            req.sqlQueryParams.push(req.census_year);
-        }
-
-        if (typeof req.adm_dependency_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_dependencia_adm_id = ?';
-            req.sqlQueryParams.push(req.adm_dependency_id);
-        }
-
-        if (typeof req.location_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.id_localizacao = ?';
-            req.sqlQueryParams.push(req.location_id);
-        }
-
-        if (typeof req.education_level_id !== 'undefined') {
-            req.sqlQuery += ' AND ';
-            req.sqlQuery += 't.fk_etapa_ensino_id = ?';
-            req.sqlQueryParams.push(req.education_level_id);
-        }
-
-        req.sqlQuery += ')';
-
-        if (typeof req.id !== 'undefined') {
-            req.sqlQuery += ' WHERE ';
-            req.sqlQuery += 'm.pk_municipio_id = ?';
-            req.sqlQueryParams.push(req.id);
-        }
-
-        req.sqlQuery += 'GROUP BY m.nome';
-    }
-    next();
-});
-
-enrollmentApp.use('/enrollments', function (req, res, next) {
-    var params = req.query;
-    if (typeof params.aggregate === 'undefined') {
-        log.debug('Using enrollments query for the whole country');
-        req.sqlQuery = 'SELECT \'Brasil\' AS name, COALESCE(SUM(t.num_matriculas),0) AS total ' + 'FROM turmas AS t';
-        req.sqlQueryParams = [];
-
-        if (req.paramCnt > 0) {
-            req.sqlQuery += ' WHERE ';
-        }
-
-        if (typeof req.census_year !== 'undefined') {
-            req.sqlQuery += 't.ano_censo = ?';
-            req.sqlQueryParams.push(req.census_year);
-        }
-
-        if (typeof req.adm_dependency_id !== 'undefined') {
-            if (req.sqlQueryParams.length > 0) {
-                req.sqlQuery += ' AND ';
-            }
-            req.sqlQuery += 't.fk_dependencia_adm_id = ?';
-            req.sqlQueryParams.push(req.adm_dependency_id);
-        }
-
-        if (typeof req.location_id !== 'undefined') {
-            if (req.sqlQueryParams.length > 0) {
-                req.sqlQuery += ' AND ';
-            }
-            req.sqlQuery += 't.id_localizacao = ?';
-            req.sqlQueryParams.push(req.location_id);
-        }
-
-        if (typeof req.education_level_id !== 'undefined') {
-            if (req.sqlQueryParams.length > 0) {
-                req.sqlQuery += ' AND ';
-            }
-            req.sqlQuery += 't.fk_etapa_ensino_id = ?';
-            req.sqlQueryParams.push(req.education_level_id);
-        }
-    }
-    next();
-});
-
-enrollmentApp.get('/enrollments', function (req, res, next) {
-    log.debug('Request parameters: ' + req);
-    if (typeof req.sqlQuery === 'undefined') {
-        // Should only happen if there is a bug in the chaining of the
-        // '/enrollments' route, since when no +aggregate+ parameter is given,
-        // it defaults to use the query for the whole country.
-        log.error('BUG -- No SQL query was found to be executed!');
-        res.send('Request could not be satisfied due to an internal error');
-    } else {
-        log.debug('SQL query: ${ req.sqlQuery }?');
-        log.debug(req.sqlQuery);
-
-        conn.prepare(req.sqlQuery, true).then(function (dbQuery) {
-            dbQuery.exec(req.sqlQueryParams).then(function (dbResult) {
-                log.debug(dbResult);
-                req.result = dbResult;
-                response(req, res);
-            }, function (dbError) {
-                log.error('SQL query execution error: ' + dbError.message);
-                // FIXME: change response to HTTP 501 status
-                res.json({ error: 'An internal error has occurred' }).end();
-            });
-        });
-    }
-});
-
-module.exports = enrollmentApp;
\ No newline at end of file
diff --git a/build/libs/routes/cities.js b/build/libs/routes/cities.js
deleted file mode 100644
index 6a0048f2..00000000
--- a/build/libs/routes/cities.js
+++ /dev/null
@@ -1,85 +0,0 @@
-'use strict';
-
-var express = require('express');
-
-var xml = require('js2xmlparser');
-
-var cityApp = express();
-
-var libs = process.cwd() + '/libs';
-
-var log = require(libs + '/log')(module);
-
-var conn = require(libs + '/db/monet');
-
-function response(req, res) {
-    if (req.query.format === 'csv') {
-        res.csv(req.result.data);
-    } else if (req.query.format === 'xml') {
-        res.send(xml('result', JSON.stringify({ city: req.result.data })));
-    } else {
-        res.json({ result: req.result.data });
-    }
-}
-
-cityApp.get('/', function (req, res) {
-    conn.query('SELECT * FROM municipios', true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query execution error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-cityApp.get('/:id', function (req, res) {
-    var citySql = 'SELECT * FROM municipios WHERE pk_municipio_id = ?';
-    var cityId = parseInt(req.params.id, 10);
-    conn.prepare(citySql, true).then(function (dbQuery) {
-        dbQuery.exec([cityId]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-cityApp.get('/ibge/:id', function (req, res) {
-    var citySql = 'SELECT * FROM municipios WHERE codigo_ibge = ?';
-    var cityIbgeCode = req.params.id;
-    conn.prepare(citySql, true).then(function (dbQuery) {
-        dbQuery.exec([cityIbgeCode]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-cityApp.get('/state/:id', function (req, res) {
-    var citySql = 'SELECT * FROM municipios WHERE fk_estado_id = ?';
-    var stateId = parseInt(req.params.id, 10);
-    conn.prepare(citySql, true).then(function (dbQuery) {
-        dbQuery.exec([stateId]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-module.exports = cityApp;
\ No newline at end of file
diff --git a/build/libs/routes/regions.js b/build/libs/routes/regions.js
deleted file mode 100644
index 75cf2bee..00000000
--- a/build/libs/routes/regions.js
+++ /dev/null
@@ -1,54 +0,0 @@
-'use strict';
-
-var express = require('express');
-
-var xml = require('js2xmlparser');
-
-var regionApp = express();
-
-var libs = process.cwd() + '/libs';
-
-var log = require(libs + '/log')(module);
-
-var conn = require(libs + '/db/monet');
-
-function response(req, res) {
-    if (req.query.format === 'csv') {
-        res.csv(req.result.data);
-    } else if (req.query.format === 'xml') {
-        res.send(xml('result', JSON.stringify({ state: req.result.data })));
-    } else {
-        res.json({ result: req.result.data });
-    }
-}
-
-regionApp.get('/', function (req, res) {
-    var regionSql = 'SELECT * FROM regioes';
-    conn.query(regionSql, true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query execution error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-regionApp.get('/:id', function (req, res) {
-    var regionSql = 'SELECT * FROM regioes WHERE pk_regiao_id = ?';
-    var regionId = parseInt(req.params.id, 10);
-    conn.prepare(regionSql, true).then(function (dbQuery) {
-        dbQuery.exec([regionId]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-module.exports = regionApp;
\ No newline at end of file
diff --git a/build/libs/routes/states.js b/build/libs/routes/states.js
deleted file mode 100644
index 8579f392..00000000
--- a/build/libs/routes/states.js
+++ /dev/null
@@ -1,70 +0,0 @@
-'use strict';
-
-var express = require('express');
-
-var xml = require('js2xmlparser');
-
-var stateApp = express();
-
-var libs = process.cwd() + '/libs';
-
-var log = require(libs + '/log')(module);
-
-var conn = require(libs + '/db/monet');
-
-function response(req, res) {
-    if (req.query.format === 'csv') {
-        res.csv(req.result.data);
-    } else if (req.query.format === 'xml') {
-        res.send(xml('result', JSON.stringify({ state: req.result.data })));
-    } else {
-        res.json({ result: req.result.data });
-    }
-}
-
-stateApp.get('/', function (req, res, next) {
-    var stateSql = 'SELECT * FROM estados';
-    conn.query(stateSql, true).then(function (dbResult) {
-        log.debug(dbResult);
-        req.result = dbResult;
-        response(req, res);
-    }, function (dbError) {
-        log.error('SQL query execution error: ' + dbError.message);
-        // FIXME: change response to HTTP 501 status
-        res.json({ error: 'An internal error has occurred' }).end();
-    });
-});
-
-stateApp.get('/:id', function (req, res, next) {
-    var stateSql = 'SELECT * FROM estados WHERE pk_estado_id = ?';
-    var stateId = parseInt(req.params.id, 10);
-    conn.prepare(stateSql, true).then(function (dbQuery) {
-        dbQuery.exec([stateId]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-stateApp.get('/region/:id', function (req, res, next) {
-    var stateSql = 'SELECT * FROM estados WHERE fk_regiao_id = ?';
-    var regionId = parseInt(req.params.id, 10);
-    conn.prepare(stateSql, true).then(function (dbQuery) {
-        dbQuery.exec([regionId]).then(function (dbResult) {
-            log.debug(dbResult);
-            req.result = dbResult;
-            response(req, res);
-        }, function (dbError) {
-            log.error('SQL query execution error: ' + dbError.message);
-            // FIXME: change response to HTTP 501 status
-            res.json({ error: 'An internal error has occurred' }).end();
-        });
-    });
-});
-
-module.exports = stateApp;
\ No newline at end of file
diff --git a/build/logs/.gitignore b/build/logs/.gitignore
deleted file mode 100644
index 397b4a76..00000000
--- a/build/logs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.log
diff --git a/build/server.js b/build/server.js
deleted file mode 100644
index 5f2171cc..00000000
--- a/build/server.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-var debug = require('debug')('node-express-base');
-
-var libs = process.cwd() + '/libs';
-
-var config = require(libs + '/config');
-
-var log = require(libs + '/log')(module);
-
-var app = require(libs + '/app');
-
-app.set('port', config.get('port') || 3000);
-
-var server = app.listen(app.get('port'), function () {
-    debug('Express server listening on port ' + server.address().port);
-    log.info('Express server listening on port ' + config.get('port'));
-});
\ No newline at end of file
diff --git a/build/test/test.js b/build/test/test.js
deleted file mode 100644
index 55caa55c..00000000
--- a/build/test/test.js
+++ /dev/null
@@ -1,139 +0,0 @@
-'use strict';
-
-var chai = require('chai');
-var chaiHttp = require('chai-http');
-var assert = chai.assert;
-var expect = chai.expect;
-var should = chai.should(); // actually call the function
-var server = require('../libs/app');
-
-chai.use(chaiHttp);
-
-describe('request enrollments', function () {
-    it('should list enrollments', function (done) {
-        chai.request(server).get('/v1/enrollments').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('name');
-            res.body.result[0].should.have.property('total');
-            done();
-        });
-    });
-});
-
-describe('request regions', function () {
-    it('should list all regions', function (done) {
-        chai.request(server).get('/v1/regions').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_regiao_id');
-            res.body.result[0].should.have.property('nome');
-            done();
-        });
-    });
-
-    it('should list region by id', function (done) {
-        chai.request(server).get('/v1/regions/1').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result.should.have.length(1);
-            res.body.result[0].should.have.property('pk_regiao_id');
-            res.body.result[0].should.have.property('nome');
-            done();
-        });
-    });
-});
-
-describe('request states', function () {
-
-    it('should list all states', function (done) {
-        chai.request(server).get('/v1/states').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_estado_id');
-            res.body.result[0].should.have.property('fk_regiao_id');
-            res.body.result[0].should.have.property('nome');
-            done();
-        });
-    });
-
-    it('should list a state by id', function (done) {
-        chai.request(server).get('/v1/states/11').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result.should.have.length(1);
-            res.body.result[0].should.have.property('pk_estado_id');
-            res.body.result[0].should.have.property('fk_regiao_id');
-            res.body.result[0].should.have.property('nome');
-            done();
-        });
-    });
-
-    it('should list states by region id', function (done) {
-        chai.request(server).get('/v1/states/region/1').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_estado_id');
-            res.body.result[0].should.have.property('fk_regiao_id');
-            res.body.result[0].should.have.property('nome');
-            done();
-        });
-    });
-});
-
-describe('request cities', function () {
-
-    it('should list all cities', function (done) {
-        chai.request(server).get('/v1/cities').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_municipio_id');
-            res.body.result[0].should.have.property('fk_estado_id');
-            res.body.result[0].should.have.property('nome');
-            res.body.result[0].should.have.property('codigo_ibge');
-            done();
-        });
-    });
-
-    it('should list a city by id', function (done) {
-        chai.request(server).get('/v1/cities/1').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_municipio_id');
-            res.body.result[0].should.have.property('fk_estado_id');
-            res.body.result[0].should.have.property('nome');
-            res.body.result[0].should.have.property('codigo_ibge');
-            done();
-        });
-    });
-
-    it('should list a city by codigo_ibge', function (done) {
-        chai.request(server).get('/v1/cities/ibge/1200013').end(function (err, res) {
-            res.should.have.status(200);
-            res.should.be.json;
-            res.body.should.have.property('result');
-            res.body.result.should.be.a('array');
-            res.body.result[0].should.have.property('pk_municipio_id');
-            res.body.result[0].should.have.property('fk_estado_id');
-            res.body.result[0].should.have.property('nome');
-            res.body.result[0].should.have.property('codigo_ibge');
-            done();
-        });
-    });
-});
\ No newline at end of file
-- 
GitLab