diff --git a/package-lock.json b/package-lock.json index 3b3f747..be5e231 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/common", - "version": "4.38.0", + "version": "4.39.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/common", - "version": "4.38.0", + "version": "4.39.0", "license": "MIT", "dependencies": { "@fastify/formbody": "^7.4.0", diff --git a/package.json b/package.json index 406694c..59cf050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/common", - "version": "4.38.0", + "version": "4.39.0", "description": "The Athenna common helpers to use in any Node.js ESM project.", "license": "MIT", "author": "João Lenon ", diff --git a/src/helpers/Path.ts b/src/helpers/Path.ts index 746ae2d..1c36c99 100644 --- a/src/helpers/Path.ts +++ b/src/helpers/Path.ts @@ -30,6 +30,7 @@ export class Path { middlewares: 'app/http/middlewares', interceptors: 'app/http/interceptors', terminators: 'app/http/terminators', + validators: 'app/validators', bootstrap: 'bootstrap', config: 'config', database: 'database', @@ -671,6 +672,22 @@ export class Path { return this } + /** + * Return the validators' path of your project. + */ + public static validators(subPath: string = sep): string { + return this.pwd(this.dirs.validators + sep + normalize(subPath)) + } + + /** + * Set the directory of validators folder. + */ + public static setValidators(directory: string): typeof Path { + this.dirs.validators = directory + + return this + } + /** * Return the migrations' path of your project. */ diff --git a/src/types/PathDirs.ts b/src/types/PathDirs.ts index df4a94d..f0f19fe 100644 --- a/src/types/PathDirs.ts +++ b/src/types/PathDirs.ts @@ -22,6 +22,7 @@ export interface PathDirs { middlewares?: string interceptors?: string terminators?: string + validators?: string bootstrap?: string config?: string database?: string diff --git a/tests/unit/PathTest.ts b/tests/unit/PathTest.ts index 334ccf0..edf884e 100644 --- a/tests/unit/PathTest.ts +++ b/tests/unit/PathTest.ts @@ -203,6 +203,7 @@ export default class PathTest { assert.isTrue(Path.middlewares().endsWith(`build${sep}app${sep}http${sep}middlewares`)) assert.isTrue(Path.interceptors().endsWith(`build${sep}app${sep}http${sep}interceptors`)) assert.isTrue(Path.terminators().endsWith(`build${sep}app${sep}http${sep}terminators`)) + assert.isTrue(Path.validators().endsWith(`build${sep}app${sep}validators`)) assert.isTrue(Path.bootstrap().endsWith(`build${sep}bootstrap`)) assert.isTrue(Path.config().endsWith(`build${sep}config`)) assert.isTrue(Path.database().endsWith(`build${sep}database`))