fix(task-status, issue-type): pin unsent scopes in MikroORM issue types and markAsDefault

Merged
CE
7d ago
+311-27

Problem

  • MikroORM IssueTypeService.fetchAll built its filter from the supplied scope columns only, while the TypeORM branch (TaskMetadataService.getFilterQuery) sets every unsupplied one to IS NULL: on MikroORM an organization-level request also returned the issue types of the organization's projects and teams.
  • markAsDefault in IssueTypeService and TaskStatusService cleared isDefault with a filter holding only the supplied scopes: marking an organization-level default cleared the defaults of all its projects and teams, and a project-level one its teams' defaults.

Fix

  • The MikroORM filter sets every unsupplied scope column to null, as the TypeORM branch does.
  • markAsDefault pins every unsupplied scope (organization, project, team) to IsNull() — the scope fetchAll reads — so only defaults of exactly the requested scope are cleared.

Tests

  • issue-type.service.spec.ts: tenant-scope expectations include the NULL columns; organization- and project-level reads pin the other scopes to null.
  • New issue-type.service.mark-as-default.spec.ts and status.service.mark-as-default.spec.ts: organization-, project- and team-level marks clear isDefault only within that scope.

Notes

Not built or run locally.


Summary by cubic

Fixes over-scoped reads and writes in issue type and task status services. The MikroORM fetchAll branch only included supplied scope columns, while the TypeORM branch pins unsupplied ones to NULL, so an organization-level request also returned issue types from its projects and teams. markAsDefault in both services cleared isDefault with a filter holding only supplied scopes: an organization-level mark wiped all its projects' and teams' defaults, and a project-level mark wiped its teams' defaults.

Both paths now pin unsupplied scope columns to NULL (reads) and IsNull() (updates), so only the exact requested scope is read or affected. markAsDefault completes its scope from the marked row, so a project-only request (which GraphQL allows) still clears within that row's organization instead of matching nothing.

Tests

  • Updated issue-type.service.spec.ts to assert unsupplied scope columns are NULL.
  • Added issue-type.service.mark-as-default.spec.ts and status.service.mark-as-default.spec.ts covering organization-, project-, and team-level marks, including the project-only request completed from the row.

The changes were not built or run locally.