mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix(plugin-field-sort): fix move action to trigger workflow (#6145)
This commit is contained in:
parent
b3b6a31ae9
commit
2783e62aa5
@ -7,9 +7,9 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { pick } from 'lodash';
|
||||||
import { BelongsToManyRepository, Collection, HasManyRepository, TargetKey, Model, Op } from '@nocobase/database';
|
import { BelongsToManyRepository, Collection, HasManyRepository, TargetKey, Model, Op } from '@nocobase/database';
|
||||||
import { Context } from '@nocobase/actions';
|
import { Context } from '@nocobase/actions';
|
||||||
import { pick } from 'lodash';
|
|
||||||
|
|
||||||
import { SortField } from './sort-field';
|
import { SortField } from './sort-field';
|
||||||
|
|
||||||
|
@ -164,6 +164,36 @@ describe('workflow > triggers > collection', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('config.mode', () => {
|
describe('config.mode', () => {
|
||||||
|
it('update by move action', async () => {
|
||||||
|
db.getCollection('posts').addField('sort', {
|
||||||
|
type: 'sort',
|
||||||
|
name: 'sort',
|
||||||
|
});
|
||||||
|
await db.sync();
|
||||||
|
const p1 = await PostRepo.create({ values: { title: 't1' } });
|
||||||
|
const p2 = await PostRepo.create({ values: { title: 't2' } });
|
||||||
|
|
||||||
|
const workflow = await WorkflowModel.create({
|
||||||
|
enabled: true,
|
||||||
|
type: 'collection',
|
||||||
|
config: {
|
||||||
|
mode: 2,
|
||||||
|
collection: 'posts',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const response = await agent.resource('posts').move({
|
||||||
|
sourceId: p1.id,
|
||||||
|
targetId: p2.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
await sleep(500);
|
||||||
|
|
||||||
|
const e1s = await workflow.getExecutions();
|
||||||
|
expect(e1s.length).toBe(1);
|
||||||
|
expect(e1s[0].status).toBe(EXECUTION_STATUS.RESOLVED);
|
||||||
|
});
|
||||||
|
|
||||||
it('mode in "update or create" could trigger on each', async () => {
|
it('mode in "update or create" could trigger on each', async () => {
|
||||||
const workflow = await WorkflowModel.create({
|
const workflow = await WorkflowModel.create({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user