Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(path): add validators to Path #123

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
17 changes: 17 additions & 0 deletions src/helpers/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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.
*/
Expand Down
1 change: 1 addition & 0 deletions src/types/PathDirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface PathDirs {
middlewares?: string
interceptors?: string
terminators?: string
validators?: string
bootstrap?: string
config?: string
database?: string
Expand Down
1 change: 1 addition & 0 deletions tests/unit/PathTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`))
Expand Down
Loading