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): ClassDecorator & PropertyDecorator {
  return Check(
    `${column} needs to be between ${minValue} and ${maxValue}`,
    `${column} >= ${minValue} AND ${column} <= ${maxValue}`
  );
}
