Various m2a builder fixes (#4032)

* Fix drawer opening empty item after sort

* Fix null sorting

* Fix sending null for a type in field creation

* Fix sort / edit existing on sorted values in m2a builder

Fixes #4005, fixes #4007

* Remove stray console log
This commit is contained in:
Rijk van Zanten
2021-02-12 15:23:23 -05:00
committed by GitHub
parent 4ea1e96822
commit ee3f5cbad3
4 changed files with 36 additions and 17 deletions

View File

@@ -66,7 +66,8 @@ const newFieldSchema = Joi.object({
collection: Joi.string().optional(),
field: Joi.string().required(),
type: Joi.string()
.valid(...types, null)
.valid(...types)
.allow(null)
.required(),
schema: Joi.object({
default_value: Joi.any(),
@@ -150,7 +151,7 @@ router.patch(
const updateSchema = Joi.object({
type: Joi.string()
.valid(...types, null)
.valid(...types)
.required(),
schema: Joi.object({
default_value: Joi.any(),

View File

@@ -203,7 +203,7 @@ export class FieldsService {
throw new InvalidPayloadException(`Field "${field.field}" already exists in collection "${collection}"`);
}
if (ALIAS_TYPES.includes(field.type) === false) {
if (field.type && ALIAS_TYPES.includes(field.type) === false) {
if (table) {
this.addColumnToTable(table, field as Field);
} else {