fix(plugin-workflow): fix collection trigger transaction (#474)
This commit is contained in:
parent
c129abfeb6
commit
4e19571c08
@ -39,13 +39,15 @@ async function handler(this: WorkflowModel, data: Model, options) {
|
|||||||
// TODO: change to map filter format to calculation format
|
// TODO: change to map filter format to calculation format
|
||||||
// const calculation = toCalculation(condition);
|
// const calculation = toCalculation(condition);
|
||||||
const { repository, model } = (<typeof WorkflowModel>this.constructor).database.getCollection(collection);
|
const { repository, model } = (<typeof WorkflowModel>this.constructor).database.getCollection(collection);
|
||||||
|
const { transaction } = options;
|
||||||
const count = await repository.count({
|
const count = await repository.count({
|
||||||
filter: {
|
filter: {
|
||||||
$and: [
|
$and: [
|
||||||
condition,
|
condition,
|
||||||
{ [model.primaryKeyAttribute]: data[model.primaryKeyAttribute] }
|
{ [model.primaryKeyAttribute]: data[model.primaryKeyAttribute] }
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
transaction
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!count) {
|
if (!count) {
|
||||||
|
Loading…
Reference in New Issue
Block a user