mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
1e5450c86b
@ -43,7 +43,7 @@ export default class extends Instruction {
|
||||
const result = await repo.aggregate({
|
||||
...options,
|
||||
method: aggregators[aggregator],
|
||||
// transaction: processor.transaction,
|
||||
transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction),
|
||||
});
|
||||
|
||||
return {
|
||||
|
@ -333,5 +333,38 @@ describe('workflow > instructions > aggregate', () => {
|
||||
const [job] = await execution.getJobs();
|
||||
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