feat: Implement isOwner flag only for get flow API endpoint

This commit is contained in:
Ali BARIN
2025-04-23 12:35:32 +00:00
parent e95ffb44e4
commit f32303154a
15 changed files with 54 additions and 143 deletions

View File

@@ -537,8 +537,6 @@ class User extends Base {
.withGraphFetched({
steps: true,
})
.select('flows.*')
.select(Flow.raw('flows.user_id = ? as "isOwner"', [this.id]))
.where((builder) => {
if (name) {
builder.where('flows.name', 'ilike', `%${name}%`);

View File

@@ -1333,23 +1333,6 @@ describe('User model', () => {
);
});
it('should return isOwner false if the flow is owned by another user', async () => {
const anotherUser = await createUser();
await createFlow({
userId: anotherUser.id,
folderId: folder.id,
active: true,
name: 'Another User Flow One',
});
const flows = await currentUser.getFlows({ onlyOwnedFlows: false }, [
folder.id,
]);
expect(flows[0].isOwner).toBe(false);
});
it('should return specified flows with all filters together', async () => {
const flows = await currentUser.getFlows(
{