Use dropdown for boolean default value

This commit is contained in:
rijkvanzanten
2020-11-11 16:10:33 -05:00
parent ef901218a5
commit ae0fcc28fe
4 changed files with 31 additions and 13 deletions

View File

@@ -292,7 +292,7 @@ export class FieldsService {
column = table[field.type](field.field);
}
if (field.schema.default_value) {
if (field.schema.default_value !== undefined) {
if (
typeof field.schema.default_value === 'string' &&
field.schema.default_value.toLowerCase() === 'now()'

View File

@@ -77,13 +77,16 @@ function validateFilter(filter: Query['filter']) {
}
function validateFilterPrimitive(value: any, key: string) {
if ((typeof value === 'string' || typeof value === 'number') === false) {
if (
(typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') ===
false
) {
throw new InvalidQueryException(
`The filter value for "${key}" has to be a string or a number`
);
}
if (Number.isNaN(value)) {
if (typeof value === 'number' && Number.isNaN(value)) {
throw new InvalidQueryException(`The filter value for "${key}" is not a valid number`);
}