diff --git a/src/config.js b/src/config.js index 67105c3..944c80d 100644 --- a/src/config.js +++ b/src/config.js @@ -1,4 +1,4 @@ -const JoiValidator = require('./validators/joi') +const JoiValidator = require('./validators/querier/joi') const KnexAdapter = require('./adapters/knex') class Config { diff --git a/src/index.js b/src/index.js index a8ca8f3..290261b 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ const NotImplementedError = require('./errors/not_implemented') const Pager = require('./orchestrators/pager') const Schema = require('./schema') const Sorter = require('./orchestrators/sorter') -const validators = require('./validators') +const validators = require('./validators/querier') class QueryQL { constructor(query, builder, config = {}) { diff --git a/src/validators/base.js b/src/validators/querier/base.js similarity index 80% rename from src/validators/base.js rename to src/validators/querier/base.js index c701fa2..d316dee 100644 --- a/src/validators/base.js +++ b/src/validators/querier/base.js @@ -1,5 +1,5 @@ -const NotImplementedError = require('../errors/not_implemented') -const ValidationError = require('../errors/validation') +const NotImplementedError = require('../../errors/not_implemented') +const ValidationError = require('../../errors/validation') class BaseValidator { constructor(querier) { diff --git a/src/validators/index.js b/src/validators/querier/index.js similarity index 100% rename from src/validators/index.js rename to src/validators/querier/index.js diff --git a/src/validators/joi.js b/src/validators/querier/joi.js similarity index 84% rename from src/validators/joi.js rename to src/validators/querier/joi.js index 674613a..4fb34be 100644 --- a/src/validators/joi.js +++ b/src/validators/querier/joi.js @@ -1,7 +1,7 @@ const Joi = require('@hapi/joi') const BaseValidator = require('./base') -const joiValidationErrorConverter = require('../services/joi_validation_error_converter') +const joiValidationErrorConverter = require('../../services/joi_validation_error_converter') class JoiValidator extends BaseValidator { get defineValidationArgs() { diff --git a/test/src/validators/base.js b/test/src/validators/querier/base.js similarity index 86% rename from test/src/validators/base.js rename to test/src/validators/querier/base.js index 6af114b..5b0a515 100644 --- a/test/src/validators/base.js +++ b/test/src/validators/querier/base.js @@ -1,9 +1,9 @@ const knex = require('knex')({ client: 'pg' }) -const BaseValidator = require('../../../src/validators/base') -const NotImplementedError = require('../../../src/errors/not_implemented') -const TestQuerier = require('../../queriers/test') -const ValidationError = require('../../../src/errors/validation') +const BaseValidator = require('../../../../src/validators/querier/base') +const NotImplementedError = require('../../../../src/errors/not_implemented') +const TestQuerier = require('../../../queriers/test') +const ValidationError = require('../../../../src/errors/validation') describe('constructor', () => { test('accepts a querier to set', () => { diff --git a/test/src/validators/joi.js b/test/src/validators/querier/joi.js similarity index 91% rename from test/src/validators/joi.js rename to test/src/validators/querier/joi.js index cda14cf..857dab1 100644 --- a/test/src/validators/joi.js +++ b/test/src/validators/querier/joi.js @@ -1,9 +1,9 @@ const Joi = require('@hapi/joi') const knex = require('knex')({ client: 'pg' }) -const JoiValidator = require('../../../src/validators/joi') -const TestQuerier = require('../../queriers/test') -const ValidationError = require('../../../src/errors/validation') +const JoiValidator = require('../../../../src/validators/querier/joi') +const TestQuerier = require('../../../queriers/test') +const ValidationError = require('../../../../src/errors/validation') describe('constructor', () => { test('calls `querier.defineValidation` with `Joi`', () => {