64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.vaccumOper = vaccumOper;
|
|
const Entity_1 = require("../types/Entity");
|
|
const vaccum_1 = require("./vaccum");
|
|
const filter_1 = require("../store/filter");
|
|
/**
|
|
* 将一定日期之前的oper对象清空
|
|
* @param option
|
|
* @param context
|
|
* @returns
|
|
*/
|
|
async function vaccumOper(option, context) {
|
|
const { aliveLine, excludeOpers, ...rest } = option;
|
|
const notFilters = [
|
|
{
|
|
[Entity_1.TriggerUuidAttribute]: {
|
|
$exists: false,
|
|
}
|
|
},
|
|
];
|
|
if (excludeOpers) {
|
|
for (const key in excludeOpers) {
|
|
if (excludeOpers[key].length > 0) {
|
|
notFilters.push({
|
|
targetEntity: key,
|
|
action: {
|
|
$in: excludeOpers[key],
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
notFilters.push({
|
|
targetEntity: key,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return (0, vaccum_1.vaccumEntities)({
|
|
entities: [{
|
|
entity: 'operEntity',
|
|
aliveLine: aliveLine + 10000,
|
|
filter: {
|
|
oper: {
|
|
$$createAt$$: {
|
|
$lt: aliveLine,
|
|
},
|
|
$not: (0, filter_1.combineFilters)('oper', context.getSchema(), notFilters),
|
|
},
|
|
},
|
|
}, {
|
|
entity: 'oper',
|
|
aliveLine,
|
|
filter: {
|
|
$$createAt$$: {
|
|
$lt: aliveLine,
|
|
},
|
|
$not: (0, filter_1.combineFilters)('oper', context.getSchema(), notFilters),
|
|
},
|
|
}],
|
|
...rest,
|
|
}, context);
|
|
}
|