@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task comment commands (T3.4b) — the "Komentarze (2)" thread of screen 7.
|
|
3
|
+
*
|
|
4
|
+
* US-C4 asks for context that lives with the work rather than in chat, so a
|
|
5
|
+
* comment is only useful if the two things rendered next to its body are true:
|
|
6
|
+
* *who* wrote it and *when*. Three decisions follow from that:
|
|
7
|
+
*
|
|
8
|
+
* 1. **`author_user_id` is stamped from the authenticated caller and is never
|
|
9
|
+
* read from input.** `staffTimeTaskCommentCreateSchema` still declares the
|
|
10
|
+
* field (it is the shared scoped-create shape), but this command discards
|
|
11
|
+
* whatever arrives there. Attribution a client can set is not attribution —
|
|
12
|
+
* it is a free-text field with an authoritative-looking name. Deliberately
|
|
13
|
+
* stricter than the shared `normalizeAuthorUserId` helper, which lets a
|
|
14
|
+
* super-admin post on someone else's behalf: on a client-facing thread that
|
|
15
|
+
* escape hatch would turn the avatar into a claim rather than a fact.
|
|
16
|
+
* 2. **Editing is the author's own comment only**, unless the caller holds
|
|
17
|
+
* `staff.timesheets.manage_all`. Deleting follows the same rule — a thread
|
|
18
|
+
* someone else can rewrite is not a record. The manager exemption exists
|
|
19
|
+
* because a client-facing thread sometimes has to have something removed,
|
|
20
|
+
* and the grant is checked through `authorizeFeatures` so a wildcard
|
|
21
|
+
* (`staff.*`, `staff.timesheets.*`) counts the way it does everywhere else.
|
|
22
|
+
* 3. **Delete is soft.** The row keeps its body, its author and its timestamps,
|
|
23
|
+
* so the audit trail (and undo) survives a comment leaving the thread.
|
|
24
|
+
*
|
|
25
|
+
* The parent task's *project* access is NOT resolved here — it is the route's
|
|
26
|
+
* job (see `api/timesheets/tasks/[id]/comments/route.ts`), because only the
|
|
27
|
+
* route knows the task id the caller addressed. What this file does enforce is
|
|
28
|
+
* that the task exists inside the caller's tenant and organization, so a direct
|
|
29
|
+
* command invocation cannot write a comment onto a foreign row.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
33
|
+
import type { CommandHandler, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
34
|
+
import { registerCommand } from '@open-mercato/shared/lib/commands'
|
|
35
|
+
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
36
|
+
import { assertOptimisticLock, readOptimisticLockExpected } from '@open-mercato/shared/lib/crud/optimistic-lock-command'
|
|
37
|
+
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
38
|
+
import { buildChanges, emitCrudSideEffects, emitCrudUndoSideEffects } from '@open-mercato/shared/lib/commands/helpers'
|
|
39
|
+
import { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'
|
|
40
|
+
import { authorizeFeatures } from '@open-mercato/shared/security/featurePolicy'
|
|
41
|
+
import type { CrudEventsConfig, CrudIndexerConfig } from '@open-mercato/shared/lib/crud/types'
|
|
42
|
+
import { StaffTimeTask, StaffTimeTaskComment } from '../data/entities'
|
|
43
|
+
import { staffTimeTaskCommentCrudEvents } from '../lib/crud'
|
|
44
|
+
import {
|
|
45
|
+
staffTimeTaskCommentCreateSchema,
|
|
46
|
+
staffTimeTaskCommentUpdateSchema,
|
|
47
|
+
type StaffTimeTaskCommentCreateInput,
|
|
48
|
+
type StaffTimeTaskCommentUpdateInput,
|
|
49
|
+
} from '../data/validators'
|
|
50
|
+
import {
|
|
51
|
+
applyScopeToWhere,
|
|
52
|
+
commandActorScope,
|
|
53
|
+
commandInputScope,
|
|
54
|
+
ensureOrganizationScope,
|
|
55
|
+
ensureTenantScope,
|
|
56
|
+
extractUndoPayload,
|
|
57
|
+
scopedStaffSnapshotWhere,
|
|
58
|
+
staffSnapshotScopeFromContext,
|
|
59
|
+
staffSnapshotScopeFromSnapshot,
|
|
60
|
+
type StaffCommandScope,
|
|
61
|
+
type StaffSnapshotScope,
|
|
62
|
+
} from './shared'
|
|
63
|
+
|
|
64
|
+
export const staffTimeTaskCommentCommandIds = {
|
|
65
|
+
create: 'staff.timesheets.task_comments.create',
|
|
66
|
+
update: 'staff.timesheets.task_comments.update',
|
|
67
|
+
delete: 'staff.timesheets.task_comments.delete',
|
|
68
|
+
} as const
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resource kind used for the audit log, the mutation-guard registry and the
|
|
72
|
+
* command-level optimistic lock, matching the `staff.timesheets.<entity>` shape
|
|
73
|
+
* the other hand-written timesheets routes present so an `OM_OPTIMISTIC_LOCK`
|
|
74
|
+
* allow-list can name it.
|
|
75
|
+
*/
|
|
76
|
+
export const STAFF_TIME_TASK_COMMENT_RESOURCE_KIND = 'staff.timesheets.task_comment'
|
|
77
|
+
|
|
78
|
+
export const TASK_COMMENT_NOT_AUTHOR_CODE = 'task_comment_not_author'
|
|
79
|
+
|
|
80
|
+
const MANAGE_ALL_FEATURE = 'staff.timesheets.manage_all'
|
|
81
|
+
|
|
82
|
+
const AUTHOR_UUID_REGEX = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
|
|
83
|
+
|
|
84
|
+
const commentCrudIndexer: CrudIndexerConfig<StaffTimeTaskComment> = {
|
|
85
|
+
entityType: 'staff:staff_time_task_comment',
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* `staff.timesheets.time_task_comment.{created,updated,deleted}` from `events.ts`.
|
|
90
|
+
*
|
|
91
|
+
* The route is hand-written (it must answer 404 rather than an empty page for a
|
|
92
|
+
* task the caller cannot see), so it takes no `events:` config the CRUD factory
|
|
93
|
+
* could read — the command emits the lifecycle events itself. It uses the shared
|
|
94
|
+
* export rather than a local copy so the ids the module publishes and the ids this
|
|
95
|
+
* command emits cannot drift apart.
|
|
96
|
+
*/
|
|
97
|
+
const commentCrudEvents: CrudEventsConfig<StaffTimeTaskComment> = staffTimeTaskCommentCrudEvents
|
|
98
|
+
|
|
99
|
+
type Translate = (key: string, fallback: string) => string
|
|
100
|
+
|
|
101
|
+
type CommentSnapshot = {
|
|
102
|
+
id: string
|
|
103
|
+
tenantId: string
|
|
104
|
+
organizationId: string
|
|
105
|
+
taskId: string
|
|
106
|
+
body: string
|
|
107
|
+
authorUserId: string | null
|
|
108
|
+
createdAt: string | null
|
|
109
|
+
deletedAt: string | null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type CommentUndoPayload = {
|
|
113
|
+
before?: CommentSnapshot | null
|
|
114
|
+
after?: CommentSnapshot | null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type RbacServiceLike = {
|
|
118
|
+
getGrantedFeatures?: (
|
|
119
|
+
userId: string,
|
|
120
|
+
options: { tenantId: string | null; organizationId: string | null },
|
|
121
|
+
) => Promise<string[]>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function toCommentSnapshot(comment: StaffTimeTaskComment): CommentSnapshot {
|
|
125
|
+
return {
|
|
126
|
+
id: comment.id,
|
|
127
|
+
tenantId: comment.tenantId,
|
|
128
|
+
organizationId: comment.organizationId,
|
|
129
|
+
taskId: comment.taskId,
|
|
130
|
+
body: comment.body,
|
|
131
|
+
authorUserId: comment.authorUserId ?? null,
|
|
132
|
+
createdAt: comment.createdAt ? comment.createdAt.toISOString() : null,
|
|
133
|
+
deletedAt: comment.deletedAt ? comment.deletedAt.toISOString() : null,
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function loadCommentSnapshot(
|
|
138
|
+
em: EntityManager,
|
|
139
|
+
id: string,
|
|
140
|
+
scope?: StaffSnapshotScope | null,
|
|
141
|
+
): Promise<CommentSnapshot | null> {
|
|
142
|
+
const comment = await em.findOne(StaffTimeTaskComment, scopedStaffSnapshotWhere(id, scope))
|
|
143
|
+
return comment ? toCommentSnapshot(comment) : null
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function commentNotFoundError(translate: Translate): CrudHttpError {
|
|
147
|
+
return new CrudHttpError(404, {
|
|
148
|
+
error: translate('staff.time_tracking.taskComments.errors.notFound', 'Comment not found or not accessible.'),
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function taskNotFoundError(translate: Translate): CrudHttpError {
|
|
153
|
+
return new CrudHttpError(404, {
|
|
154
|
+
error: translate('staff.time_tracking.tasks.errors.notFound', 'Task not found or not accessible.'),
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function notAuthorError(translate: Translate): CrudHttpError {
|
|
159
|
+
return new CrudHttpError(403, {
|
|
160
|
+
code: TASK_COMMENT_NOT_AUTHOR_CODE,
|
|
161
|
+
error: translate(
|
|
162
|
+
'staff.time_tracking.taskComments.errors.notAuthor',
|
|
163
|
+
'You can only edit or delete your own comments.',
|
|
164
|
+
),
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The comment's author is whoever the request authenticated as — never the
|
|
170
|
+
* `authorUserId` the payload carried. An API key has no human behind it, so it
|
|
171
|
+
* writes an unattributed comment rather than borrowing an identity.
|
|
172
|
+
*/
|
|
173
|
+
function stampAuthorUserId(ctx: CommandRuntimeContext): string | null {
|
|
174
|
+
const auth = ctx.auth as { isApiKey?: boolean; sub?: string | null } | null | undefined
|
|
175
|
+
if (!auth || auth.isApiKey === true) return null
|
|
176
|
+
const sub = typeof auth.sub === 'string' ? auth.sub.trim() : ''
|
|
177
|
+
if (!sub || !AUTHOR_UUID_REGEX.test(sub)) return null
|
|
178
|
+
return sub
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Wildcard-aware `staff.timesheets.manage_all` check. Reads the grants from
|
|
183
|
+
* `rbacService` rather than the token's feature array so a stale or trimmed
|
|
184
|
+
* browser payload cannot widen the exemption, and fails closed when the grants
|
|
185
|
+
* cannot be read — the caller then falls back to "author only", which is the
|
|
186
|
+
* safe half of the rule.
|
|
187
|
+
*/
|
|
188
|
+
async function callerCanManageAll(ctx: CommandRuntimeContext): Promise<boolean> {
|
|
189
|
+
if (ctx.auth?.isSuperAdmin === true || ctx.systemActor === true) return true
|
|
190
|
+
const userId = ctx.auth?.sub ?? null
|
|
191
|
+
const tenantId = ctx.auth?.tenantId ?? null
|
|
192
|
+
const organizationId = ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null
|
|
193
|
+
if (!userId || !tenantId) return false
|
|
194
|
+
let grantedFeatures: string[] = []
|
|
195
|
+
try {
|
|
196
|
+
const rbac = ctx.container.resolve('rbacService') as RbacServiceLike | undefined
|
|
197
|
+
if (rbac?.getGrantedFeatures) {
|
|
198
|
+
grantedFeatures = (await rbac.getGrantedFeatures(userId, { tenantId, organizationId })) ?? []
|
|
199
|
+
}
|
|
200
|
+
} catch {
|
|
201
|
+
return false
|
|
202
|
+
}
|
|
203
|
+
return authorizeFeatures([MANAGE_ALL_FEATURE], {
|
|
204
|
+
grantedFeatures,
|
|
205
|
+
scopeAllowed: Boolean(tenantId) && Boolean(organizationId),
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function requireEditableComment(
|
|
210
|
+
comment: StaffTimeTaskComment,
|
|
211
|
+
ctx: CommandRuntimeContext,
|
|
212
|
+
translate: Translate,
|
|
213
|
+
): Promise<void> {
|
|
214
|
+
const actorId = stampAuthorUserId(ctx)
|
|
215
|
+
if (actorId && comment.authorUserId === actorId) return
|
|
216
|
+
if (await callerCanManageAll(ctx)) return
|
|
217
|
+
throw notAuthorError(translate)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function assertCommentVersion(ctx: CommandRuntimeContext, comment: StaffTimeTaskComment): void {
|
|
221
|
+
assertOptimisticLock({
|
|
222
|
+
resourceKind: STAFF_TIME_TASK_COMMENT_RESOURCE_KIND,
|
|
223
|
+
resourceId: comment.id,
|
|
224
|
+
expected: readOptimisticLockExpected(ctx.request ?? null),
|
|
225
|
+
current: comment.updatedAt,
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async function requireTaskInScope(
|
|
230
|
+
em: EntityManager,
|
|
231
|
+
taskId: string,
|
|
232
|
+
scope: StaffCommandScope,
|
|
233
|
+
translate: Translate,
|
|
234
|
+
): Promise<StaffTimeTask> {
|
|
235
|
+
const task = await em.findOne(StaffTimeTask, applyScopeToWhere<StaffTimeTask>({ id: taskId, deletedAt: null }, scope))
|
|
236
|
+
if (!task) throw taskNotFoundError(translate)
|
|
237
|
+
return task
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const createTaskCommentCommand: CommandHandler<
|
|
241
|
+
StaffTimeTaskCommentCreateInput,
|
|
242
|
+
{ commentId: string; taskId: string; authorUserId: string | null }
|
|
243
|
+
> = {
|
|
244
|
+
id: staffTimeTaskCommentCommandIds.create,
|
|
245
|
+
async execute(rawInput, ctx) {
|
|
246
|
+
const parsed = staffTimeTaskCommentCreateSchema.parse(rawInput)
|
|
247
|
+
ensureTenantScope(ctx, parsed.tenantId)
|
|
248
|
+
ensureOrganizationScope(ctx, parsed.organizationId)
|
|
249
|
+
const scope = commandInputScope(ctx, parsed.tenantId, parsed.organizationId)
|
|
250
|
+
const { translate } = await resolveTranslations()
|
|
251
|
+
// `parsed.authorUserId` is intentionally unread — see the file header.
|
|
252
|
+
const authorUserId = stampAuthorUserId(ctx)
|
|
253
|
+
|
|
254
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
255
|
+
let created: StaffTimeTaskComment | null = null
|
|
256
|
+
|
|
257
|
+
await withAtomicFlush(
|
|
258
|
+
em,
|
|
259
|
+
[
|
|
260
|
+
() => requireTaskInScope(em, parsed.taskId, scope, translate),
|
|
261
|
+
() => {
|
|
262
|
+
created = em.create(StaffTimeTaskComment, {
|
|
263
|
+
tenantId: parsed.tenantId,
|
|
264
|
+
organizationId: parsed.organizationId,
|
|
265
|
+
taskId: parsed.taskId,
|
|
266
|
+
body: parsed.body,
|
|
267
|
+
authorUserId,
|
|
268
|
+
createdAt: new Date(),
|
|
269
|
+
updatedAt: new Date(),
|
|
270
|
+
deletedAt: null,
|
|
271
|
+
})
|
|
272
|
+
em.persist(created)
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
{ transaction: true, label: staffTimeTaskCommentCommandIds.create },
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
const record = created as StaffTimeTaskComment | null
|
|
279
|
+
if (!record) throw commentNotFoundError(translate)
|
|
280
|
+
|
|
281
|
+
await emitCrudSideEffects({
|
|
282
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
283
|
+
action: 'created',
|
|
284
|
+
entity: record,
|
|
285
|
+
identifiers: { id: record.id, organizationId: record.organizationId, tenantId: record.tenantId },
|
|
286
|
+
events: commentCrudEvents,
|
|
287
|
+
indexer: commentCrudIndexer,
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
return { commentId: record.id, taskId: record.taskId, authorUserId: record.authorUserId ?? null }
|
|
291
|
+
},
|
|
292
|
+
captureAfter: async (_input, result, ctx) => {
|
|
293
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
294
|
+
const snapshot = await loadCommentSnapshot(em, result.commentId, staffSnapshotScopeFromContext(ctx))
|
|
295
|
+
if (!snapshot) return null
|
|
296
|
+
return { snapshot }
|
|
297
|
+
},
|
|
298
|
+
buildLog: async ({ result, snapshots }) => {
|
|
299
|
+
const snapshot = (snapshots.after as { snapshot?: CommentSnapshot } | undefined)?.snapshot
|
|
300
|
+
if (!snapshot) return null
|
|
301
|
+
const { translate } = await resolveTranslations()
|
|
302
|
+
return {
|
|
303
|
+
actionLabel: translate('staff.audit.timesheets.task_comments.create', 'Create task comment'),
|
|
304
|
+
resourceKind: STAFF_TIME_TASK_COMMENT_RESOURCE_KIND,
|
|
305
|
+
resourceId: result.commentId,
|
|
306
|
+
parentResourceKind: 'staff.timesheets.task',
|
|
307
|
+
parentResourceId: snapshot.taskId,
|
|
308
|
+
tenantId: snapshot.tenantId,
|
|
309
|
+
organizationId: snapshot.organizationId,
|
|
310
|
+
snapshotAfter: snapshot,
|
|
311
|
+
payload: {
|
|
312
|
+
undo: { after: snapshot } satisfies CommentUndoPayload,
|
|
313
|
+
},
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
undo: async ({ logEntry, ctx }) => {
|
|
317
|
+
const payload = extractUndoPayload<CommentUndoPayload>(logEntry)
|
|
318
|
+
const after = payload?.after
|
|
319
|
+
if (!after) return
|
|
320
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
321
|
+
const comment = await em.findOne(
|
|
322
|
+
StaffTimeTaskComment,
|
|
323
|
+
scopedStaffSnapshotWhere(after.id, staffSnapshotScopeFromSnapshot(after)),
|
|
324
|
+
)
|
|
325
|
+
if (!comment) return
|
|
326
|
+
|
|
327
|
+
await withAtomicFlush(
|
|
328
|
+
em,
|
|
329
|
+
[
|
|
330
|
+
() => {
|
|
331
|
+
comment.deletedAt = new Date()
|
|
332
|
+
comment.updatedAt = new Date()
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
{ transaction: true, label: `${staffTimeTaskCommentCommandIds.create}.undo` },
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
await emitCrudUndoSideEffects({
|
|
339
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
340
|
+
action: 'deleted',
|
|
341
|
+
entity: comment,
|
|
342
|
+
identifiers: { id: comment.id, organizationId: comment.organizationId, tenantId: comment.tenantId },
|
|
343
|
+
events: commentCrudEvents,
|
|
344
|
+
indexer: commentCrudIndexer,
|
|
345
|
+
})
|
|
346
|
+
},
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const updateTaskCommentCommand: CommandHandler<
|
|
350
|
+
StaffTimeTaskCommentUpdateInput,
|
|
351
|
+
{ commentId: string; taskId: string }
|
|
352
|
+
> = {
|
|
353
|
+
id: staffTimeTaskCommentCommandIds.update,
|
|
354
|
+
async prepare(rawInput, ctx) {
|
|
355
|
+
const parsed = staffTimeTaskCommentUpdateSchema.safeParse(rawInput)
|
|
356
|
+
if (!parsed.success) return {}
|
|
357
|
+
const em = ctx.container.resolve('em') as EntityManager
|
|
358
|
+
const before = await loadCommentSnapshot(em, parsed.data.id, staffSnapshotScopeFromContext(ctx))
|
|
359
|
+
if (!before) return {}
|
|
360
|
+
return { before: { snapshot: before } }
|
|
361
|
+
},
|
|
362
|
+
async execute(rawInput, ctx) {
|
|
363
|
+
const parsed = staffTimeTaskCommentUpdateSchema.parse(rawInput)
|
|
364
|
+
const { translate } = await resolveTranslations()
|
|
365
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
366
|
+
const scope = commandActorScope(ctx)
|
|
367
|
+
|
|
368
|
+
const comment = await em.findOne(
|
|
369
|
+
StaffTimeTaskComment,
|
|
370
|
+
applyScopeToWhere<StaffTimeTaskComment>({ id: parsed.id, deletedAt: null }, scope),
|
|
371
|
+
)
|
|
372
|
+
if (!comment) throw commentNotFoundError(translate)
|
|
373
|
+
ensureTenantScope(ctx, comment.tenantId)
|
|
374
|
+
ensureOrganizationScope(ctx, comment.organizationId)
|
|
375
|
+
assertCommentVersion(ctx, comment)
|
|
376
|
+
await requireEditableComment(comment, ctx, translate)
|
|
377
|
+
|
|
378
|
+
await withAtomicFlush(
|
|
379
|
+
em,
|
|
380
|
+
[
|
|
381
|
+
() => {
|
|
382
|
+
comment.body = parsed.body
|
|
383
|
+
comment.updatedAt = new Date()
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
{ transaction: true, label: staffTimeTaskCommentCommandIds.update },
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
await emitCrudSideEffects({
|
|
390
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
391
|
+
action: 'updated',
|
|
392
|
+
entity: comment,
|
|
393
|
+
identifiers: { id: comment.id, organizationId: comment.organizationId, tenantId: comment.tenantId },
|
|
394
|
+
events: commentCrudEvents,
|
|
395
|
+
indexer: commentCrudIndexer,
|
|
396
|
+
})
|
|
397
|
+
|
|
398
|
+
return { commentId: comment.id, taskId: comment.taskId }
|
|
399
|
+
},
|
|
400
|
+
buildLog: async ({ snapshots, ctx }) => {
|
|
401
|
+
const before = (snapshots.before as { snapshot?: CommentSnapshot } | undefined)?.snapshot
|
|
402
|
+
if (!before) return null
|
|
403
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
404
|
+
const after = await loadCommentSnapshot(em, before.id, staffSnapshotScopeFromSnapshot(before))
|
|
405
|
+
if (!after) return null
|
|
406
|
+
const { translate } = await resolveTranslations()
|
|
407
|
+
return {
|
|
408
|
+
actionLabel: translate('staff.audit.timesheets.task_comments.update', 'Update task comment'),
|
|
409
|
+
resourceKind: STAFF_TIME_TASK_COMMENT_RESOURCE_KIND,
|
|
410
|
+
resourceId: before.id,
|
|
411
|
+
parentResourceKind: 'staff.timesheets.task',
|
|
412
|
+
parentResourceId: before.taskId,
|
|
413
|
+
tenantId: before.tenantId,
|
|
414
|
+
organizationId: before.organizationId,
|
|
415
|
+
snapshotBefore: before,
|
|
416
|
+
snapshotAfter: after,
|
|
417
|
+
changes: buildChanges(
|
|
418
|
+
before as unknown as Record<string, unknown>,
|
|
419
|
+
after as unknown as Record<string, unknown>,
|
|
420
|
+
['body'],
|
|
421
|
+
),
|
|
422
|
+
payload: {
|
|
423
|
+
undo: { before, after } satisfies CommentUndoPayload,
|
|
424
|
+
},
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
undo: async ({ logEntry, ctx }) => {
|
|
428
|
+
const payload = extractUndoPayload<CommentUndoPayload>(logEntry)
|
|
429
|
+
const before = payload?.before
|
|
430
|
+
if (!before) return
|
|
431
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
432
|
+
const comment = await em.findOne(
|
|
433
|
+
StaffTimeTaskComment,
|
|
434
|
+
scopedStaffSnapshotWhere(before.id, staffSnapshotScopeFromSnapshot(before)),
|
|
435
|
+
)
|
|
436
|
+
if (!comment) return
|
|
437
|
+
|
|
438
|
+
await withAtomicFlush(
|
|
439
|
+
em,
|
|
440
|
+
[
|
|
441
|
+
() => {
|
|
442
|
+
comment.body = before.body
|
|
443
|
+
comment.updatedAt = new Date()
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
{ transaction: true, label: `${staffTimeTaskCommentCommandIds.update}.undo` },
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
await emitCrudUndoSideEffects({
|
|
450
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
451
|
+
action: 'updated',
|
|
452
|
+
entity: comment,
|
|
453
|
+
identifiers: { id: comment.id, organizationId: comment.organizationId, tenantId: comment.tenantId },
|
|
454
|
+
events: commentCrudEvents,
|
|
455
|
+
indexer: commentCrudIndexer,
|
|
456
|
+
})
|
|
457
|
+
},
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const deleteTaskCommentCommand: CommandHandler<{ id?: string }, { commentId: string; taskId: string }> = {
|
|
461
|
+
id: staffTimeTaskCommentCommandIds.delete,
|
|
462
|
+
async prepare(input, ctx) {
|
|
463
|
+
const id = input?.id
|
|
464
|
+
if (!id) return {}
|
|
465
|
+
const em = ctx.container.resolve('em') as EntityManager
|
|
466
|
+
const before = await loadCommentSnapshot(em, id, staffSnapshotScopeFromContext(ctx))
|
|
467
|
+
if (!before) return {}
|
|
468
|
+
return { before: { snapshot: before } }
|
|
469
|
+
},
|
|
470
|
+
async execute(input, ctx) {
|
|
471
|
+
const { translate } = await resolveTranslations()
|
|
472
|
+
const id = input?.id
|
|
473
|
+
if (!id) {
|
|
474
|
+
throw new CrudHttpError(400, {
|
|
475
|
+
error: translate('staff.time_tracking.taskComments.errors.idRequired', 'Comment id is required.'),
|
|
476
|
+
})
|
|
477
|
+
}
|
|
478
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
479
|
+
const scope = commandActorScope(ctx)
|
|
480
|
+
const comment = await em.findOne(
|
|
481
|
+
StaffTimeTaskComment,
|
|
482
|
+
applyScopeToWhere<StaffTimeTaskComment>({ id, deletedAt: null }, scope),
|
|
483
|
+
)
|
|
484
|
+
if (!comment) throw commentNotFoundError(translate)
|
|
485
|
+
ensureTenantScope(ctx, comment.tenantId)
|
|
486
|
+
ensureOrganizationScope(ctx, comment.organizationId)
|
|
487
|
+
assertCommentVersion(ctx, comment)
|
|
488
|
+
await requireEditableComment(comment, ctx, translate)
|
|
489
|
+
|
|
490
|
+
// Soft delete: the body, the author and the timestamps stay on the row so
|
|
491
|
+
// the audit trail — and undo — still has something to point at.
|
|
492
|
+
await withAtomicFlush(
|
|
493
|
+
em,
|
|
494
|
+
[
|
|
495
|
+
() => {
|
|
496
|
+
comment.deletedAt = new Date()
|
|
497
|
+
comment.updatedAt = new Date()
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
{ transaction: true, label: staffTimeTaskCommentCommandIds.delete },
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
await emitCrudSideEffects({
|
|
504
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
505
|
+
action: 'deleted',
|
|
506
|
+
entity: comment,
|
|
507
|
+
identifiers: { id: comment.id, organizationId: comment.organizationId, tenantId: comment.tenantId },
|
|
508
|
+
events: commentCrudEvents,
|
|
509
|
+
indexer: commentCrudIndexer,
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
return { commentId: comment.id, taskId: comment.taskId }
|
|
513
|
+
},
|
|
514
|
+
buildLog: async ({ snapshots }) => {
|
|
515
|
+
const before = (snapshots.before as { snapshot?: CommentSnapshot } | undefined)?.snapshot
|
|
516
|
+
if (!before) return null
|
|
517
|
+
const { translate } = await resolveTranslations()
|
|
518
|
+
return {
|
|
519
|
+
actionLabel: translate('staff.audit.timesheets.task_comments.delete', 'Delete task comment'),
|
|
520
|
+
resourceKind: STAFF_TIME_TASK_COMMENT_RESOURCE_KIND,
|
|
521
|
+
resourceId: before.id,
|
|
522
|
+
parentResourceKind: 'staff.timesheets.task',
|
|
523
|
+
parentResourceId: before.taskId,
|
|
524
|
+
tenantId: before.tenantId,
|
|
525
|
+
organizationId: before.organizationId,
|
|
526
|
+
snapshotBefore: before,
|
|
527
|
+
payload: {
|
|
528
|
+
undo: { before } satisfies CommentUndoPayload,
|
|
529
|
+
},
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
undo: async ({ logEntry, ctx }) => {
|
|
533
|
+
const payload = extractUndoPayload<CommentUndoPayload>(logEntry)
|
|
534
|
+
const before = payload?.before
|
|
535
|
+
if (!before) return
|
|
536
|
+
const em = (ctx.container.resolve('em') as EntityManager).fork()
|
|
537
|
+
let comment = await em.findOne(
|
|
538
|
+
StaffTimeTaskComment,
|
|
539
|
+
scopedStaffSnapshotWhere(before.id, staffSnapshotScopeFromSnapshot(before)),
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
await withAtomicFlush(
|
|
543
|
+
em,
|
|
544
|
+
[
|
|
545
|
+
() => {
|
|
546
|
+
if (!comment) {
|
|
547
|
+
comment = em.create(StaffTimeTaskComment, {
|
|
548
|
+
id: before.id,
|
|
549
|
+
tenantId: before.tenantId,
|
|
550
|
+
organizationId: before.organizationId,
|
|
551
|
+
taskId: before.taskId,
|
|
552
|
+
body: before.body,
|
|
553
|
+
authorUserId: before.authorUserId,
|
|
554
|
+
createdAt: before.createdAt ? new Date(before.createdAt) : new Date(),
|
|
555
|
+
updatedAt: new Date(),
|
|
556
|
+
deletedAt: null,
|
|
557
|
+
})
|
|
558
|
+
em.persist(comment)
|
|
559
|
+
return
|
|
560
|
+
}
|
|
561
|
+
comment.body = before.body
|
|
562
|
+
comment.authorUserId = before.authorUserId
|
|
563
|
+
comment.deletedAt = null
|
|
564
|
+
comment.updatedAt = new Date()
|
|
565
|
+
},
|
|
566
|
+
],
|
|
567
|
+
{ transaction: true, label: `${staffTimeTaskCommentCommandIds.delete}.undo` },
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
await emitCrudUndoSideEffects({
|
|
571
|
+
dataEngine: ctx.container.resolve('dataEngine'),
|
|
572
|
+
action: 'created',
|
|
573
|
+
entity: comment,
|
|
574
|
+
identifiers: { id: before.id, organizationId: before.organizationId, tenantId: before.tenantId },
|
|
575
|
+
events: commentCrudEvents,
|
|
576
|
+
indexer: commentCrudIndexer,
|
|
577
|
+
})
|
|
578
|
+
},
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
registerCommand(createTaskCommentCommand)
|
|
582
|
+
registerCommand(updateTaskCommentCommand)
|
|
583
|
+
registerCommand(deleteTaskCommentCommand)
|