-
Notifications
You must be signed in to change notification settings - Fork 53.4k
feat(core): Update endpoint to retrieve folder to allow returning the path to root (no-changelog) #15158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Update endpoint to retrieve folder to allow returning the path to root (no-changelog) #15158
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mrge found 1 issue across 6 files. Review it in mrge.io
Cadiac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a suggestion of how we could do this instead to branch https://github.com/n8n-io/n8n/tree/ado-3546-add-path-to-folders-returned-from-endpoint-simplified, lets talk about this today when you're online?
| async getManyAndCount(options: ListQuery.Options = {}) { | ||
| const query = this.getManyQuery(options); | ||
| return await query.getManyAndCount(); | ||
| return (await query.getManyAndCount()) as unknown as [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These casts seem fishy and unnecessary 🤔
| export type FolderWithWorkflowAndSubFolderCount = Folder & { | ||
| workflowCount: boolean; | ||
| subFolderCount: number; | ||
| workflowCount?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid changing these to optional? They should still be present always if folder is of this type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting we simplify this, instead of introducing the new type can we change this type to
export type FolderWithWorkflowAndSubFolderCount = Folder & {
workflowCount: boolean;
subFolderCount: number;
path?: string[];
};
and then enrich the path only if the select option is used, otherwise just leaving it out? This allows us to keep the FolderRepository typed as
export class FolderRepository extends Repository<FolderWithWorkflowAndSubFolderCount> {
and removes the need for casts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I did not want the repository to take FolderWithWorkflowAndSubFolderCount it's because does not have those values in the entity. So if you in this repo do: this.create, it looks like you can pass the fields in FolderWithWorkflowAndSubFolderCount and that is not correct. The same with update. Those fields are only included if the getMany method and the select parameter explicitly include them. Thoughts?
Cadiac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show must go on, lets refactor the repository types later 👍
|
✅ All Cypress E2E specs passed |
|
Got released with |
… path to root (no-changelog) (n8n-io#15158)
… path to root (no-changelog) (n8n-io#15158)
… path to root (no-changelog) (n8n-io#15158)

Summary
This PR enhances the folder retrieval endpoint to return the path from a folder to the root, allowing clients to display breadcrumb navigation or full folder paths in the UI.
Technical Details
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/ADO-3546/add-path-to-folders-returned-from-endpoint
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)