mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: Issue listing executions with Postgres (#4856)
This commit is contained in:
parent
1c36c37a12
commit
5156328c34
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue