mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 10:42:19 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
6b16257104
@ -43,7 +43,7 @@ export default class extends Instruction {
|
|||||||
const result = await repo.aggregate({
|
const result = await repo.aggregate({
|
||||||
...options,
|
...options,
|
||||||
method: aggregators[aggregator],
|
method: aggregators[aggregator],
|
||||||
// transaction: processor.transaction,
|
transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction),
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -333,5 +333,38 @@ describe('workflow > instructions > aggregate', () => {
|
|||||||
const [job] = await execution.getJobs();
|
const [job] = await execution.getJobs();
|
||||||
expect(job.result).toBe(1);
|
expect(job.result).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('transaction in sync workflow', async () => {
|
||||||
|
PostRepo = app.dataSourceManager.dataSources.get('another').collectionManager.getRepository('posts');
|
||||||
|
|
||||||
|
const w1 = await WorkflowModel.create({
|
||||||
|
enabled: true,
|
||||||
|
type: 'collection',
|
||||||
|
sync: true,
|
||||||
|
config: {
|
||||||
|
mode: 1,
|
||||||
|
collection: 'another:posts',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const n1 = await w1.createNode({
|
||||||
|
type: 'aggregate',
|
||||||
|
config: {
|
||||||
|
collection: 'another:posts',
|
||||||
|
aggregator: 'count',
|
||||||
|
params: {
|
||||||
|
field: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const p1 = await PostRepo.create({ values: { title: 't1' } });
|
||||||
|
|
||||||
|
const e1s = await w1.getExecutions();
|
||||||
|
expect(e1s.length).toBe(1);
|
||||||
|
expect(e1s[0].status).toBe(EXECUTION_STATUS.RESOLVED);
|
||||||
|
const [job] = await e1s[0].getJobs();
|
||||||
|
expect(job.result).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user