Skip to content
Snippets Groups Projects
Commit 7d29c79d authored by michael.minelli's avatar michael.minelli
Browse files

DojoValidator => Remove unused vars and validators

parent 419956e3
No related branches found
No related tags found
No related merge requests found
import ApiRequest from '../models/ApiRequest';
import ApiRequest from '../types/ApiRequest';
import Config from '../config/Config';
import { StatusCodes } from 'http-status-codes';
import { CustomValidator, ErrorMessage, FieldMessageFactory, Meta } from 'express-validator/src/base';
......@@ -36,11 +36,7 @@ class DojoValidators {
}
readonly nullSanitizer = this.toValidatorSchemaOptions({
options: (value, {
req,
location,
path
}) => {
options: (value) => {
try {
return value == 'null' || value == 'undefined' || value == '' ? null : value;
} catch ( e ) {
......@@ -50,11 +46,7 @@ class DojoValidators {
});
readonly jsonSanitizer = this.toValidatorSchemaOptions({
options: (value, {
req,
location,
path
}) => {
options: (value) => {
try {
return JSON.parse(value);
} catch ( e ) {
......@@ -68,7 +60,6 @@ class DojoValidators {
errorMessage: 'Template doesn\'t exist or you don\'t have access to it',
options : (value, {
req,
location,
path
}) => {
return new Promise((resolve, reject) => {
......@@ -86,7 +77,6 @@ class DojoValidators {
readonly templateUrlSanitizer = this.toValidatorSchemaOptions({
options: (value, {
req,
location,
path
}) => {
try {
......@@ -101,26 +91,6 @@ class DojoValidators {
return value;
}
});
readonly enonceValidator = this.toValidatorSchemaOptions({
bail : true,
errorMessage: 'Template doesn\'t exist or you don\'t have access to it',
options : (value, {
req,
location,
path
}) => {
return new Promise((resolve, reject) => {
const template = this.getParamValue(req, path);
if ( template ) {
GitlabManager.checkTemplateAccess(template, req).then((templateAccess) => {
templateAccess !== StatusCodes.OK ? reject() : resolve(true);
});
}
resolve(true);
});
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment