mirror of
https://github.com/directus/directus.git
synced 2026-01-23 13:37:58 -05:00
Use dropdown for boolean default value
This commit is contained in:
@@ -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()'
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user