fix: missing options when finding

This commit is contained in:
chenos 2020-12-09 23:04:53 +08:00
parent 2828a82f7d
commit f948896365
2 changed files with 4 additions and 2 deletions

View File

@ -143,6 +143,7 @@ describe('collection hooks', () => {
}); });
expect(createdField.body).toMatchObject({ expect(createdField.body).toMatchObject({
...types['string'].options,
...{ ...{
interface: 'string', interface: 'string',
title: '名称', title: '名称',
@ -152,7 +153,6 @@ describe('collection hooks', () => {
sortable: true, sortable: true,
filterable: true, filterable: true,
}, },
...types['string'].options,
sort: 1, sort: 1,
collection_name: 'tests', collection_name: 'tests',
}); });

View File

@ -14,7 +14,8 @@ export class FieldModel extends BaseModel {
constructor(values: any = {}, options: any = {}) { constructor(values: any = {}, options: any = {}) {
let data = { let data = {
...(values.options||{}), ...(values.options||{}),
..._.omit(values, 'options'), ...values,
// ..._.omit(values, 'options'),
}; };
const interfaceType = data.interface; const interfaceType = data.interface;
if (interfaceType) { if (interfaceType) {
@ -25,6 +26,7 @@ export class FieldModel extends BaseModel {
} }
// @ts-ignore // @ts-ignore
super(data, options); super(data, options);
// console.log(data);
} }
generateName() { generateName() {