oper的vaccum中加上了txnUuid不能为空的条件
This commit is contained in:
parent
4e8613fb8a
commit
06536a6434
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '../types/Entity';
|
||||
import { EntityDict, TriggerUuidAttribute } from '../types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
||||
import { AsyncContext } from '../store/AsyncRowStore';
|
||||
import { vaccumEntities } from './vaccum';
|
||||
|
|
@ -22,9 +22,14 @@ export type VaccumOperOption<ED extends EntityDict & BaseEntityDict> = {
|
|||
export async function vaccumOper<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>>(option: VaccumOperOption<ED>, context: Cxt) {
|
||||
const { aliveLine, excludeOpers, ...rest } = option;
|
||||
|
||||
const operFilter: ED['oper']['Selection']['filter'] = {};
|
||||
const notFilters: ED['oper']['Selection']['filter'][] = [
|
||||
{
|
||||
[TriggerUuidAttribute]: {
|
||||
$exists: false,
|
||||
}
|
||||
} as any,
|
||||
];
|
||||
if (excludeOpers) {
|
||||
const notFilters: ED['oper']['Selection']['filter'][] = [];
|
||||
for (const key in excludeOpers) {
|
||||
if (excludeOpers[key]!.length > 0) {
|
||||
notFilters.push({
|
||||
|
|
@ -40,27 +45,28 @@ export async function vaccumOper<ED extends EntityDict & BaseEntityDict, Cxt ext
|
|||
});
|
||||
}
|
||||
}
|
||||
if (notFilters.length > 0) {
|
||||
operFilter.$not = {
|
||||
$or: notFilters as NonNullable<ED['oper']['Selection']['filter']>[],
|
||||
};
|
||||
}
|
||||
}
|
||||
return vaccumEntities({
|
||||
return vaccumEntities<ED, Cxt>({
|
||||
entities: [{
|
||||
entity: 'operEntity',
|
||||
aliveLine: aliveLine + 10000,
|
||||
filter: {
|
||||
oper: combineFilters('operEntity', context.getSchema(), [operFilter, {
|
||||
oper: {
|
||||
$$createAt$$: {
|
||||
$lt: aliveLine,
|
||||
}
|
||||
}]),
|
||||
},
|
||||
$not: combineFilters('oper', context.getSchema(), notFilters),
|
||||
},
|
||||
},
|
||||
}, {
|
||||
entity: 'oper',
|
||||
aliveLine,
|
||||
filter: operFilter,
|
||||
filter: {
|
||||
$$createAt$$: {
|
||||
$lt: aliveLine,
|
||||
},
|
||||
$not: combineFilters('oper', context.getSchema(), notFilters),
|
||||
},
|
||||
}],
|
||||
...rest,
|
||||
}, context);
|
||||
|
|
|
|||
Loading…
Reference in New Issue