fix fields not updateable because type is null (#4061)

This commit is contained in:
Nitwel
2021-02-15 18:01:26 +01:00
committed by GitHub
parent e1b353b38b
commit 953b141245

View File

@@ -7,6 +7,7 @@ import Joi from 'joi';
import { types, Field } from '../types';
import useCollection from '../middleware/use-collection';
import { respond } from '../middleware/respond';
import { ALIAS_TYPES } from '../constants';
const router = Router();
@@ -66,7 +67,7 @@ const newFieldSchema = Joi.object({
collection: Joi.string().optional(),
field: Joi.string().required(),
type: Joi.string()
.valid(...types)
.valid(...types, ...ALIAS_TYPES)
.allow(null)
.required(),
schema: Joi.object({
@@ -150,7 +151,9 @@ router.patch(
);
const updateSchema = Joi.object({
type: Joi.string().valid(...types),
type: Joi.string()
.valid(...types, ...ALIAS_TYPES)
.allow(null),
schema: Joi.object({
default_value: Joi.any(),
max_length: [Joi.number(), Joi.string(), Joi.valid(null)],