15 lines
378 B
TypeScript
15 lines
378 B
TypeScript
|
import { Check } from 'typeorm';
|
||
|
|
||
|
export const minValue = 0;
|
||
|
export const maxValue = Number.MAX_SAFE_INTEGER;
|
||
|
|
||
|
/**
|
||
|
* @param column the column which needs to be checked
|
||
|
*/
|
||
|
export function PercentCheck(column: string): Function {
|
||
|
return Check(
|
||
|
`${column} needs to be between ${minValue} and ${maxValue}`,
|
||
|
`${column} >= ${minValue} AND ${column} <= ${maxValue}`
|
||
|
);
|
||
|
}
|