Skip to content

Conversation

@apsantiso
Copy link
Contributor

@apsantiso apsantiso commented Dec 18, 2025

Introduces per-member empty file limit checks when creating files in a workspace. The limit is enforced inside fileUseCases.createFile using the same workspaceOptions pattern already used by replaceFile, ensuring the check runs against the individual workspace member rather than the shared network user.

  • file.usecase.ts: Added optional workspaceOptions parameter to createFile. When provided, calls checkWorkspaceEmptyFilesLimit (per-member count) instead of checkEmptyFilesLimit (per-user count).
  • workspaces.usecase.ts: Passes { workspace, memberId } to fileUseCases.createFile so the limit check is handled in a single place.

@apsantiso apsantiso requested a review from jzunigax2 as a code owner December 18, 2025 11:57
@apsantiso apsantiso self-assigned this Dec 18, 2025
@apsantiso apsantiso added the enhancement New feature or request label Dec 18, 2025
@sonarqubecloud
Copy link

@apsantiso apsantiso requested a review from sg-gs December 18, 2025 13:15
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

This PR is stale because it has been open for more than 15 days with no activity.

@sonarqubecloud
Copy link

include: [
{
model: WorkspaceItemUserModel,
where: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does an index exist for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the following explain result yes

QUERY PLAN
Aggregate (cost=5.05..5.06 rows=1 width=8)
-> Nested Loop (cost=1.00..5.05 rows=1 width=4)
-> Index Scan using workspace_items_users_workspace_creator_index on workspace_items_users "workspaceUser" (cost=0.42..2.45 rows=1 width=16)
Index Cond: ((workspace_id = '<worksapce uuid>'::uuid) AND ((created_by)::text = '<workspace user uuid>'::text))
Filter: ((item_type)::text = 'file'::text)
-> Index Scan using files_uuid_key on files "FileModel" (cost=0.57..2.60 rows=1 width=20)
Index Cond: (uuid = "workspaceUser".item_id)
Filter: ((status <> 'DELETED'::enum_files_status) AND (size = 0))

jzunigax2 and others added 29 commits February 3, 2026 14:46
@jzunigax2 jzunigax2 force-pushed the feat/allow-empty-files-workspaces branch from 93ad14e to fe03a53 Compare February 3, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants