fix: Issue listing executions with Postgres (#4856)

This commit is contained in:
Omar Ajoue 2022-12-08 10:49:48 +01:00 committed by GitHub
parent 1c36c37a12
commit 5156328c34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,6 +110,19 @@ export class ExecutionsService {
return { count, estimated: false };
}
static massageFilters(filter: IDataObject): void {
if (filter) {
if (filter.waitTill === true) {
filter.waitTill = Not(IsNull());
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
} else if (filter.finished === false) {
filter.waitTill = IsNull();
} else {
delete filter.waitTill;
}
}
}
static async getExecutionsList(req: ExecutionRequest.GetAll): Promise<IExecutionsListResponse> {
const sharedWorkflowIds = await this.getWorkflowIdsForUser(req.user);
if (sharedWorkflowIds.length === 0) {
@ -215,19 +228,14 @@ export class ExecutionsService {
.take(limit)
.where(findWhere);
const countFilter = deepCopy(filter ?? {});
if (filter) {
if (filter.waitTill === true) {
filter.waitTill = Not(IsNull());
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
} else if (filter.finished === false) {
filter.waitTill = IsNull();
} else {
delete filter.waitTill;
}
this.massageFilters(filter as IDataObject);
query = query.andWhere(filter);
}
const countFilter = deepCopy(filter ?? {});
this.massageFilters(countFilter as IDataObject);
countFilter.id = Not(In(executingWorkflowIds));
const executions = await query.getMany();