Skip to main content

CRM refactor changelog

A high-level history of the F0–F10 sweep on tenant-backend-crm + the CRM modules in tenant-frontend. Granular per-batch close logs live in tenant/tenant-backend-crm/AUDIT_FINDINGS.md.

The sweep ran during a single sprint window starting 2026-05-11. All dates below are in that timeline.

High-level deliverables

PhaseThemeStatus
F0Security KRITIKUS (41 findings)Done
F1Frontend cleanupPartial — Vuexy bloat audit deferred; hardcoded strings cleaned in CRM modules
F2Mock + test environmentPartial — DevOps API mock landed, OpenAPI workflow wired
F3Controller split (15 controllers extracted)Done
F4Menu + i18n completeness (hu/en/de)Mostly done — de.json CRM namespace filled, ~200 new keys
F5OpenAPI + SDKDone — Scramble + @hey-api/openapi-ts + npm run api:check drift gate
F6Backend security & qualityDone — 30+ MAGAS findings closed
F7Missing functions (RabbitMQ consumers, audit trail)Done — IdentityEventConsumer + ActivityLog publish events
F8TestsDone — vitest scaffold + 58 backend + 41 frontend tests
F9DocumentationDone — 21 sidebar docs (incl. permissions, webhook-events, tenant-clone added in F9 polish pass) + composables README
F10UI/UX deep reviewDone — composables, deep-link, empty states

F3 controller split inventory

Refactored 1 monolith into 6 (Chat), then continued through Task, Project, Document, ending up with 15 extracted controllers + 3 trait helpers.

OriginExtractLines moved
ChatControllerChatReactionController~60
ChatControllerChatFileController~110
ChatControllerChatParticipantController~140
ChatControllerChatBotMembershipController~110
ChatControllerChatMessageController~280
TaskControllerTaskBoardController~150
TaskControllerTaskAssignmentController~190
TaskControllerTaskHistoryController~30
ProjectControllerProjectMemberController~135
ProjectControllerProjectStatsController~55
DocumentControllerDocumentVersionController~115
DocumentFolderControllerDocumentFolderMemberController~110

Traits (shared guards):

  • App\Http\Concerns\EnsuresProjectMembership — used by Task* + parent controllers.
  • App\Http\Concerns\EnsuresFolderAccess — used by Document + DocumentVersion.

Before/after sizes:

ControllerBeforeAfter
ChatController~800 lines~140 lines
TaskController~660 lines~360 lines
ProjectController~280 lines~130 lines
DocumentController~410 lines~280 lines
DocumentFolderController~360 lines~260 lines

F10 composables

Five composables landed:

ComposableAdopted byTests
useApiError13+ stores12
useDeleteDialog11 list pages8
usePaginationDeepLink7 list pages12
useTypeAhead(not yet adopted in a picker)7
useRequestHandlerlegacy

The list-page adoption tally as of batch 20: companies, contacts, projects, kb-articles, blog-posts, pages, sms-templates, leave-requests, shifts, webhooks, sms-settings.

Audit-trail (ActivityLog) coverage

CRM writes ActivityLog rows for compliance-relevant events. As of the F0 sweep:

  • blog_post.published / blog_post.unpublished (MAGAS #51)
  • page.published / page.unpublished (MAGAS #51)
  • chat_bot.token_regenerated (batch 14)
  • project.deleted (batch 19)

All entries carry the auditActor block (actor_user_id + impersonator_id when applicable, cross-repo #36).

Migrations landed in the sweep

DateMigrationPurpose
2026-05-12drop_tenant_id_from_crm_tables46 tables — moved to per-deployment isolation
2026-05-12add_soft_deletes_to_project_membersMAGAS #58 — audit-trail preservation
2026-05-12enable_unaccent_extensionMAGAS #61 — diacritic-insensitive search
2026-05-12add_unique_unresolved_sla_breach_indexMAGAS #65 — concurrent breach race
2026-05-12widen_project_member_roleMAGAS #63 — ENUM → varchar

Frontend i18n

Three locale files (hu/en/de). Coverage:

  • hu: ~3990 keys
  • en: ~3990 keys (1:1 with hu)
  • de: ~2500 keys (CRM namespace + notification keys; broader filling deferred)

200+ keys added during the sweep in the *.notifications.* and *.emptySearch namespaces.

Tests

  • Backend Unit: 58 tests across model contracts, traits, state-machines, controller extracts.
  • Frontend Unit: 41 tests across composables (useApiError, useDeleteDialog, usePaginationDeepLink, useTypeAhead).
  • Feature TestCase work (DB-touching) deferred to follow-up.

Where to learn more