Meet application logic and folder struture

This commit is contained in:
Daniel García Aubert 2018-04-09 16:18:30 +02:00
parent 7e68f5270d
commit 6167562758
59 changed files with 69 additions and 69 deletions

View File

@ -13,11 +13,11 @@ const TemplateMaps = require('../backends/template_maps.js');
const PgQueryRunner = require('../backends/pg_query_runner');
const StatsBackend = require('../backends/stats');
const AuthApi = require('../api/auth_api');
const UserLimitsApi = require('../api/user_limits_api');
const OverviewsMetadataApi = require('../api/overviews_metadata_api');
const FilterStatsApi = require('../api/filter_stats_api');
const TablesExtentApi = require('../api/tables_extent_api');
const AuthApi = require('../backends/api/auth_api');
const UserLimitsApi = require('../backends/api/user_limits_api');
const OverviewsMetadataApi = require('../backends/api/overviews_metadata_api');
const FilterStatsApi = require('../backends/api/filter_stats_api');
const TablesExtentApi = require('../backends/api/tables_extent_api');
const LayergroupAffectedTablesCache = require('../cache/layergroup_affected_tables');
const SurrogateKeysCache = require('../cache/surrogate_keys_cache');
@ -51,8 +51,8 @@ const sendResponse = require('./middlewares/send-response');
const syntaxError = require('./middlewares/syntax-error');
const errorMiddleware = require('./middlewares/error-middleware');
const MapRouter = require('./map-router');
const TemplateRouter = require('./template-router');
const MapRouter = require('./map/map-router');
const TemplateRouter = require('./template/template-router');
module.exports = class ApiRouter {
constructor ({ serverOptions, environmentOptions }) {

View File

@ -1,12 +1,12 @@
const PSQL = require('cartodb-psql');
const cleanUpQueryParams = require('./middlewares/clean-up-query-params');
const credentials = require('./middlewares/credentials');
const authorize = require('./middlewares/authorize');
const dbConnSetup = require('./middlewares/db-conn-setup');
const rateLimit = require('./middlewares/rate-limit');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const authorize = require('../middlewares/authorize');
const dbConnSetup = require('../middlewares/db-conn-setup');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const cacheControlHeader = require('./middlewares/cache-control-header');
const dbParamsFromResLocals = require('../utils/database-params');
const cacheControlHeader = require('../middlewares/cache-control-header');
const dbParamsFromResLocals = require('../../utils/database-params');
function AnalysesController(pgConnection, authApi, userLimitsApi) {
this.pgConnection = pgConnection;

View File

@ -5,19 +5,19 @@ const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const initProfiler = require('./middlewares/init-profiler');
const checkJsonContentType = require('./middlewares/check-json-content-type');
const incrementMapViewCount = require('./middlewares/increment-map-view-count');
const augmentLayergroupData = require('./middlewares/augment-layergroup-data');
const initProfiler = require('../middlewares/init-profiler');
const checkJsonContentType = require('../middlewares/check-json-content-type');
const incrementMapViewCount = require('../middlewares/increment-map-view-count');
const augmentLayergroupData = require('../middlewares/augment-layergroup-data');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const lastUpdatedTimeLayergroup = require('./middlewares/last-updated-time-layergroup');
const layerStats = require('./middlewares/layer-stats');
const layergroupIdHeader = require('./middlewares/layergroup-id-header');
const layergroupMetadata = require('./middlewares/layergroup-metadata');
const mapError = require('./middlewares/map-error');
const lastUpdatedTimeLayergroup = require('../middlewares/last-updated-time-layergroup');
const layerStats = require('../middlewares/layer-stats');
const layergroupIdHeader = require('../middlewares/layergroup-id-header');
const layergroupMetadata = require('../middlewares/layergroup-metadata');
const mapError = require('../middlewares/map-error');
const CreateLayergroupMapConfigProvider = require('../../models/mapconfig/provider/create-layergroup-provider');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;

View File

@ -5,7 +5,7 @@ const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('./middlewares/map-store-map-config-provider');
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -5,7 +5,7 @@ const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('./middlewares/map-store-map-config-provider');
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -1,13 +1,13 @@
const { Router: router } = require('express');
const AnalysisLayergroupController = require('./layergroup/analysis');
const AttributesLayergroupController = require('./layergroup/attributes');
const DataviewLayergroupController = require('./layergroup/dataview');
const PreviewLayergroupController = require('./layergroup/preview');
const TileLayergroupController = require('./layergroup/tile');
const AnonymousMapController = require('./map/anonymous');
const PreviewTemplateController = require('./template/preview');
const AnalysesController = require('./analyses');
const AnalysisLayergroupController = require('./analysis-layergroup-controller');
const AttributesLayergroupController = require('./attributes-layergroup-controller');
const DataviewLayergroupController = require('./dataview-layergroup-controller');
const PreviewLayergroupController = require('./preview-layergroup-controller');
const TileLayergroupController = require('./tile-layergroup-controller');
const AnonymousMapController = require('./anonymous-map-controller');
const PreviewTemplateController = require('./preview-template-controller');
const AnalysesCatalogController = require('./analyses-catalog-controller');
module.exports = class MapRouter {
constructor ({ collaborators }) {
@ -108,7 +108,7 @@ module.exports = class MapRouter {
userLimitsApi
);
this.analysesController = new AnalysesController(
this.analysesController = new AnalysesCatalogController(
pgConnection,
authApi,
userLimitsApi

View File

@ -5,7 +5,7 @@ const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('./middlewares/map-store-map-config-provider');
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -2,7 +2,7 @@ const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const namedMapProvider = require('./middlewares/named-map-provider');
const namedMapProvider = require('../middlewares/named-map-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -5,7 +5,7 @@ const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('./middlewares/map-store-map-config-provider');
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -1,4 +1,4 @@
const MapStoreMapConfigProvider = require('../../../models/mapconfig/provider/map-store-provider');
const MapStoreMapConfigProvider = require('../../models/mapconfig/provider/map-store-provider');
module.exports = function createMapStoreMapConfigProvider (
mapStore,

View File

@ -2,19 +2,19 @@ const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const initProfiler = require('./middlewares/init-profiler');
const checkJsonContentType = require('./middlewares/check-json-content-type');
const incrementMapViewCount = require('./middlewares/increment-map-view-count');
const augmentLayergroupData = require('./middlewares/augment-layergroup-data');
const initProfiler = require('../middlewares/init-profiler');
const checkJsonContentType = require('../middlewares/check-json-content-type');
const incrementMapViewCount = require('../middlewares/increment-map-view-count');
const augmentLayergroupData = require('../middlewares/augment-layergroup-data');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const lastUpdatedTimeLayergroup = require('./middlewares/last-updated-time-layergroup');
const layerStats = require('./middlewares/layer-stats');
const layergroupIdHeader = require('./middlewares/layergroup-id-header');
const layergroupMetadata = require('./middlewares/layergroup-metadata');
const mapError = require('./middlewares/map-error');
const lastUpdatedTimeLayergroup = require('../middlewares/last-updated-time-layergroup');
const layerStats = require('../middlewares/layer-stats');
const layergroupIdHeader = require('../middlewares/layergroup-id-header');
const layergroupMetadata = require('../middlewares/layergroup-metadata');
const mapError = require('../middlewares/map-error');
const NamedMapMapConfigProvider = require('../../models/mapconfig/provider/named-map-provider');
const CreateLayergroupMapConfigProvider = require('../../models/mapconfig/provider/create-layergroup-provider');
const rateLimit = require('../middlewares/rate-limit');

View File

@ -1,8 +1,8 @@
const { Router: router } = require('express');
const NamedMapController = require('./map/named');
const AdminTemplateController = require('./template/admin');
const TileTemplateController = require('./template/tile');
const NamedMapController = require('./named-template-controller');
const AdminTemplateController = require('./admin-template-controller');
const TileTemplateController = require('./tile-template-controller');
module.exports = class TemplateRouter {
constructor ({ collaborators }) {

View File

@ -2,7 +2,7 @@ const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const namedMapProvider = require('./middlewares/named-map-provider');
const namedMapProvider = require('../middlewares/named-map-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');

View File

@ -1,6 +1,6 @@
var _ = require('underscore');
var step = require('step');
var AnalysisFilter = require('../models/filter/analysis');
var AnalysisFilter = require('../../models/filter/analysis');
function FilterStatsApi(pgQueryRunner) {
this.pgQueryRunner = pgQueryRunner;

View File

@ -1,4 +1,4 @@
var SubstitutionTokens = require('../utils/substitution-tokens');
var SubstitutionTokens = require('../../utils/substitution-tokens');
function OverviewsMetadataApi(pgQueryRunner) {
this.pgQueryRunner = pgQueryRunner;

View File

@ -1,4 +1,4 @@
var HealthCheck = require('../monitoring/health_check');
var HealthCheck = require('./monitoring/health_check');
var WELCOME_MSG = "This is the CartoDB Maps API, " +
"see the documentation at http://docs.cartodb.com/cartodb-platform/maps-api.html";

View File

@ -5,8 +5,8 @@ const { mapnik } = windshaft;
const jsonReplacer = require('./utils/json-replacer');
const ApiRouter = require('./routers/api-router');
const ServerInfoController = require('./routers/server-info');
const ApiRouter = require('./api/api-router');
const ServerInfoController = require('./server-info-controller');
const StatsClient = require('./stats/client');

View File

@ -5,8 +5,8 @@ const redis = require('redis');
const RedisPool = require('redis-mpool');
const cartodbRedis = require('cartodb-redis');
const TestClient = require('../support/test-client');
const UserLimitsApi = require('../../lib/cartodb/api/user_limits_api');
const rateLimitMiddleware = require('../../lib/cartodb/routers/middlewares/rate-limit');
const UserLimitsApi = require('../../lib/cartodb/backends/api/user_limits_api');
const rateLimitMiddleware = require('../../lib/cartodb/api/middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimitMiddleware;
let userLimitsApi;

View File

@ -5,8 +5,8 @@ var RedisPool = require('redis-mpool');
var cartodbRedis = require('cartodb-redis');
var PgConnection = require(__dirname + '/../../lib/cartodb/backends/pg_connection');
var PgQueryRunner = require('../../lib/cartodb/backends/pg_query_runner');
var OverviewsMetadataApi = require('../../lib/cartodb/api/overviews_metadata_api');
var FilterStatsApi = require('../../lib/cartodb/api/filter_stats_api');
var OverviewsMetadataApi = require('../../lib/cartodb/backends/api/overviews_metadata_api');
var FilterStatsApi = require('../../lib/cartodb/backends/api/filter_stats_api');
var MapConfigOverviewsAdapter = require('../../lib/cartodb/models/mapconfig/adapter/mapconfig-overviews-adapter');
var redisPool = new RedisPool(global.environment.redis);

View File

@ -7,7 +7,7 @@ var cartodbRedis = require('cartodb-redis');
var PgConnection = require('../../lib/cartodb/backends/pg_connection');
var PgQueryRunner = require('../../lib/cartodb/backends/pg_query_runner');
var OverviewsMetadataApi = require('../../lib/cartodb/api/overviews_metadata_api');
var OverviewsMetadataApi = require('../../lib/cartodb/backends/api/overviews_metadata_api');
describe('OverviewsMetadataApi', function() {

View File

@ -1,7 +1,7 @@
require('../../support/test_helper.js');
var assert = require('assert');
var errorMiddleware = require('../../../lib/cartodb/routers/middlewares/error-middleware');
var errorMiddleware = require('../../../lib/cartodb/api/middlewares/error-middleware');
describe('error-middleware', function() {

View File

@ -2,7 +2,7 @@ require('../../support/test_helper');
var assert = require('assert');
var errorMiddleware = require('../../../lib/cartodb/routers/middlewares/error-middleware');
var errorMiddleware = require('../../../lib/cartodb/api/middlewares/error-middleware');
describe('error messages clean up', function() {

View File

@ -1,7 +1,7 @@
var assert = require('assert');
var testHelper = require('../../support/test_helper');
var lzmaMiddleware = require('../../../lib/cartodb/routers/middlewares/lzma');
var lzmaMiddleware = require('../../../lib/cartodb/api/middlewares/lzma');
describe('lzma-middleware', function() {

View File

@ -4,13 +4,13 @@ var _ = require('underscore');
var RedisPool = require('redis-mpool');
var cartodbRedis = require('cartodb-redis');
var PgConnection = require('../../../lib/cartodb/backends/pg_connection');
var AuthApi = require('../../../lib/cartodb/api/auth_api');
var AuthApi = require('../../../lib/cartodb/backends/api/auth_api');
var TemplateMaps = require('../../../lib/cartodb/backends/template_maps');
const cleanUpQueryParamsMiddleware = require('../../../lib/cartodb/routers/middlewares/clean-up-query-params');
const authorizeMiddleware = require('../../../lib/cartodb/routers/middlewares/authorize');
const dbConnSetupMiddleware = require('../../../lib/cartodb/routers/middlewares/db-conn-setup');
const credentialsMiddleware = require('../../../lib/cartodb/routers/middlewares/credentials');
const cleanUpQueryParamsMiddleware = require('../../../lib/cartodb/api/middlewares/clean-up-query-params');
const authorizeMiddleware = require('../../../lib/cartodb/api/middlewares/authorize');
const dbConnSetupMiddleware = require('../../../lib/cartodb/api/middlewares/db-conn-setup');
const credentialsMiddleware = require('../../../lib/cartodb/api/middlewares/credentials');
var windshaft = require('windshaft');