Fix --no-prototype-builtins
parent
f40354e79a
commit
a4be89c5fc
|
@ -5,9 +5,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
import { AxiosResponse } from "axios";
|
||||
// Public modules from npm
|
||||
import validator from "class-validator";
|
||||
import { IsInt, Min, validateSync } from "class-validator";
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
// Module from files
|
||||
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
|
||||
|
@ -70,10 +70,10 @@ export default class HandiworkSearchQuery implements IQuery {
|
|||
* Results presentation order.
|
||||
*/
|
||||
public order: THandiworkOrder = "relevance";
|
||||
@validator.IsInt({
|
||||
@IsInt({
|
||||
message: "$property expect an integer, received $value"
|
||||
})
|
||||
@validator.Min(HandiworkSearchQuery.MIN_PAGE, {
|
||||
@Min(HandiworkSearchQuery.MIN_PAGE, {
|
||||
message: "The minimum $property value must be $constraint1, received $value"
|
||||
})
|
||||
public page = 1;
|
||||
|
@ -103,7 +103,7 @@ export default class HandiworkSearchQuery implements IQuery {
|
|||
}
|
||||
|
||||
public validate(): boolean {
|
||||
return validator.validateSync(this).length === 0;
|
||||
return validateSync(this).length === 0;
|
||||
}
|
||||
|
||||
public async execute(): Promise<TExecuteResult> {
|
||||
|
@ -112,7 +112,7 @@ export default class HandiworkSearchQuery implements IQuery {
|
|||
|
||||
// Check if the query is valid
|
||||
if (!this.validate()) {
|
||||
throw new Error(`Invalid query: ${validator.validateSync(this).join("\n")}`);
|
||||
throw new Error(`Invalid query: ${validateSync(this).join("\n")}`);
|
||||
}
|
||||
|
||||
// Convert the query
|
||||
|
@ -144,7 +144,7 @@ export default class HandiworkSearchQuery implements IQuery {
|
|||
// Cast the basic query object and copy common values
|
||||
const query: LatestSearchQuery = new LatestSearchQuery();
|
||||
Object.keys(this).forEach((key) => {
|
||||
if (query.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(query, key)) {
|
||||
query[key] = this[key];
|
||||
}
|
||||
});
|
||||
|
@ -165,7 +165,7 @@ export default class HandiworkSearchQuery implements IQuery {
|
|||
// Cast the basic query object and copy common values
|
||||
const query: ThreadSearchQuery = new ThreadSearchQuery();
|
||||
Object.keys(this).forEach((key) => {
|
||||
if (query.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(query, key)) {
|
||||
query[key] = this[key];
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue