fix: autoGenId default value should be false when adding collection (#4942)

* fix: autoGenId default value  should be false when adding collection

* fix: test
This commit is contained in:
Katherine 2024-07-25 10:31:21 +08:00 committed by GitHub
parent bd5d4489fd
commit 47d2a0ee61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -169,7 +169,7 @@ export const PresetFields = observer(
]; ];
useEffect(() => { useEffect(() => {
const config = { const config = {
autoGenId: true, autoGenId: false,
createdAt: true, createdAt: true,
createdBy: true, createdBy: true,
updatedAt: true, updatedAt: true,
@ -209,7 +209,7 @@ export const PresetFields = observer(
onChange: (_, selectedRows) => { onChange: (_, selectedRows) => {
const fields = getDefaultCollectionFields(selectedRows, form.values); const fields = getDefaultCollectionFields(selectedRows, form.values);
const config = { const config = {
autoGenId: !!fields.find((v) => v.name === 'id'), autoGenId: false,
createdAt: !!fields.find((v) => v.name === 'createdAt'), createdAt: !!fields.find((v) => v.name === 'createdAt'),
createdBy: !!fields.find((v) => v.name === 'createdBy'), createdBy: !!fields.find((v) => v.name === 'createdBy'),
updatedAt: !!fields.find((v) => v.name === 'updatedAt'), updatedAt: !!fields.find((v) => v.name === 'updatedAt'),

View File

@ -26,7 +26,7 @@ test.describe('create collection with preset fields', () => {
const postData = request.postDataJSON(); const postData = request.postDataJSON();
//默认提交的数据符合预期 //默认提交的数据符合预期
expect(postData).toMatchObject({ expect(postData).toMatchObject({
autoGenId: true, autoGenId: false,
createdAt: true, createdAt: true,
createdBy: true, createdBy: true,
updatedAt: true, updatedAt: true,
@ -78,7 +78,7 @@ test.describe('create collection with preset fields', () => {
const postData = request.postDataJSON(); const postData = request.postDataJSON();
//提交的数据符合预期 //提交的数据符合预期
expect(postData).toMatchObject({ expect(postData).toMatchObject({
autoGenId: true, autoGenId: false,
createdAt: false, createdAt: false,
createdBy: false, createdBy: false,
updatedAt: false, updatedAt: false,