Skip to content

Commit

Permalink
Move querier validators into sub-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jstayton committed Aug 22, 2019
1 parent 293da30 commit 7be35e9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const JoiValidator = require('./validators/joi')
const JoiValidator = require('./validators/querier/joi')
const KnexAdapter = require('./adapters/knex')

class Config {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) {
Expand Down
4 changes: 2 additions & 2 deletions src/validators/base.js → src/validators/querier/base.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/validators/joi.js → src/validators/querier/joi.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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`', () => {
Expand Down

0 comments on commit 7be35e9

Please sign in to comment.