Skip to content

Commit

Permalink
feat(core): Add method (getMany) to folder repository to filter, so…
Browse files Browse the repository at this point in the history
…rt, and paginate folders (no-changelog) (#13290)
  • Loading branch information
RicardoE105 authored Feb 17, 2025
1 parent 5b82f34 commit 82d2fa6
Show file tree
Hide file tree
Showing 8 changed files with 851 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/src/databases/entities/folder-tag-mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Entity, JoinColumn, ManyToOne, PrimaryColumn } from '@n8n/typeorm';

import type { Folder } from './folder';
import type { TagEntity } from './tag-entity';

@Entity({ name: 'folder_tag' })
export class FolderTagMapping {
@PrimaryColumn()
folderId: string;

@ManyToOne('Folder', 'tagMappings')
@JoinColumn({ name: 'folderId' })
folders: Folder[];

@PrimaryColumn()
tagId: string;

@ManyToOne('TagEntity', 'folderMappings')
@JoinColumn({ name: 'tagId' })
tags: TagEntity[];
}
2 changes: 2 additions & 0 deletions packages/cli/src/databases/entities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ExecutionData } from './execution-data';
import { ExecutionEntity } from './execution-entity';
import { ExecutionMetadata } from './execution-metadata';
import { Folder } from './folder';
import { FolderTagMapping } from './folder-tag-mapping';
import { InstalledNodes } from './installed-nodes';
import { InstalledPackages } from './installed-packages';
import { InvalidAuthToken } from './invalid-auth-token';
Expand Down Expand Up @@ -68,4 +69,5 @@ export const entities = {
TestRun,
TestCaseExecution,
Folder,
FolderTagMapping,
};
4 changes: 4 additions & 0 deletions packages/cli/src/databases/entities/tag-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Column, Entity, Index, ManyToMany, OneToMany } from '@n8n/typeorm';
import { IsString, Length } from 'class-validator';

import { WithTimestampsAndStringId } from './abstract-entity';
import type { FolderTagMapping } from './folder-tag-mapping';
import type { WorkflowEntity } from './workflow-entity';
import type { WorkflowTagMapping } from './workflow-tag-mapping';

Expand All @@ -18,4 +19,7 @@ export class TagEntity extends WithTimestampsAndStringId {

@OneToMany('WorkflowTagMapping', 'tags')
workflowMappings: WorkflowTagMapping[];

@OneToMany('FolderTagMapping', 'tags')
folderMappings: FolderTagMapping[];
}
Loading

0 comments on commit 82d2fa6

Please # to comment.