@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,834 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { registerCommand } from "@open-mercato/shared/lib/commands";
|
|
3
|
+
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
4
|
+
import { enforceCommandOptimisticLockWithGuards } from "@open-mercato/shared/lib/crud/optimistic-lock-command";
|
|
5
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
6
|
+
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
7
|
+
import { findOneWithDecryption } from "@open-mercato/shared/lib/encryption/find";
|
|
8
|
+
import { buildChanges, emitCrudSideEffects, emitCrudUndoSideEffects } from "@open-mercato/shared/lib/commands/helpers";
|
|
9
|
+
import { withAtomicFlush } from "@open-mercato/shared/lib/commands/flush";
|
|
10
|
+
import { StaffTeamMember, StaffTimeProject, StaffTimeTask, StaffTimeTaskStatus } from "../data/entities.js";
|
|
11
|
+
import {
|
|
12
|
+
staffTimeTaskCreateSchema,
|
|
13
|
+
staffTimeTaskStatusChangeSchema,
|
|
14
|
+
staffTimeTaskUpdateSchema
|
|
15
|
+
} from "../data/validators.js";
|
|
16
|
+
import { emitStaffEvent } from "../events.js";
|
|
17
|
+
import { nextStatusPosition } from "../lib/timesheets-tasks/statusPositions.js";
|
|
18
|
+
import {
|
|
19
|
+
allocateTaskReference,
|
|
20
|
+
isTaskReferenceConflict,
|
|
21
|
+
withTaskReferenceRetry
|
|
22
|
+
} from "../lib/timesheets-tasks/taskReference.js";
|
|
23
|
+
import {
|
|
24
|
+
SUBTASK_DEPTH_EXCEEDED_CODE,
|
|
25
|
+
planTaskSoftDelete,
|
|
26
|
+
rejectTaskParent
|
|
27
|
+
} from "../lib/timesheets-tasks/taskHierarchy.js";
|
|
28
|
+
import {
|
|
29
|
+
applyScopeToWhere,
|
|
30
|
+
commandActorScope,
|
|
31
|
+
commandInputScope,
|
|
32
|
+
ensureOrganizationScope,
|
|
33
|
+
ensureTenantScope,
|
|
34
|
+
extractUndoPayload,
|
|
35
|
+
scopeForDecryption,
|
|
36
|
+
scopedStaffSnapshotWhere,
|
|
37
|
+
staffSnapshotScopeFromContext,
|
|
38
|
+
staffSnapshotScopeFromSnapshot
|
|
39
|
+
} from "./shared.js";
|
|
40
|
+
const staffTimeTaskCommandIds = {
|
|
41
|
+
create: "staff.timesheets.tasks.create",
|
|
42
|
+
update: "staff.timesheets.tasks.update",
|
|
43
|
+
delete: "staff.timesheets.tasks.delete",
|
|
44
|
+
statusChange: "staff.timesheets.tasks.status_change"
|
|
45
|
+
};
|
|
46
|
+
const STAFF_TIME_TASK_RESOURCE_KIND = "staff.timesheets.time_task";
|
|
47
|
+
const TASK_DEPTH_EXCEEDED_CODE = SUBTASK_DEPTH_EXCEEDED_CODE;
|
|
48
|
+
const TASK_PARENT_SELF_CODE = "task_parent_self";
|
|
49
|
+
const TASK_PARENT_PROJECT_MISMATCH_CODE = "task_parent_project_mismatch";
|
|
50
|
+
const TASK_PROJECT_MOVE_UNSUPPORTED_CODE = "task_project_move_unsupported";
|
|
51
|
+
const TASK_STATUS_MISSING_CODE = "task_status_missing";
|
|
52
|
+
const TASK_REFERENCE_CONFLICT_CODE = "task_reference_conflict";
|
|
53
|
+
const logger = createLogger("staff").child({ component: "commands/timesheets-tasks" });
|
|
54
|
+
const taskCrudIndexer = {
|
|
55
|
+
entityType: "staff:staff_time_task"
|
|
56
|
+
};
|
|
57
|
+
const taskCrudEvents = {
|
|
58
|
+
module: "staff",
|
|
59
|
+
entity: "timesheets.time_task",
|
|
60
|
+
persistent: true,
|
|
61
|
+
buildPayload: (ctx) => ({
|
|
62
|
+
id: ctx.identifiers.id,
|
|
63
|
+
organizationId: ctx.identifiers.organizationId,
|
|
64
|
+
tenantId: ctx.identifiers.tenantId
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
const TASK_LIST_CACHE_RESOURCE = `${taskCrudEvents.module}.${taskCrudEvents.entity}`;
|
|
68
|
+
const DIFFED_FIELDS = [
|
|
69
|
+
"parentTaskId",
|
|
70
|
+
"taskStatusId",
|
|
71
|
+
"title",
|
|
72
|
+
"description",
|
|
73
|
+
"assigneeStaffMemberId",
|
|
74
|
+
"position",
|
|
75
|
+
"closedAt"
|
|
76
|
+
];
|
|
77
|
+
function toSnapshot(task) {
|
|
78
|
+
return {
|
|
79
|
+
id: task.id,
|
|
80
|
+
tenantId: task.tenantId,
|
|
81
|
+
organizationId: task.organizationId,
|
|
82
|
+
timeProjectId: task.timeProjectId,
|
|
83
|
+
parentTaskId: task.parentTaskId ?? null,
|
|
84
|
+
taskStatusId: task.taskStatusId,
|
|
85
|
+
sequenceNumber: task.sequenceNumber,
|
|
86
|
+
reference: task.reference,
|
|
87
|
+
title: task.title,
|
|
88
|
+
description: task.description ?? null,
|
|
89
|
+
assigneeStaffMemberId: task.assigneeStaffMemberId ?? null,
|
|
90
|
+
position: task.position,
|
|
91
|
+
createdByUserId: task.createdByUserId ?? null,
|
|
92
|
+
closedAt: task.closedAt ? task.closedAt.toISOString() : null,
|
|
93
|
+
deletedAt: task.deletedAt ? task.deletedAt.toISOString() : null
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function snapshotScopeWhere(scope) {
|
|
97
|
+
const where = {};
|
|
98
|
+
if (scope?.tenantId) where.tenantId = scope.tenantId;
|
|
99
|
+
if (scope?.organizationId) where.organizationId = scope.organizationId;
|
|
100
|
+
return where;
|
|
101
|
+
}
|
|
102
|
+
async function loadTaskSnapshot(em, id, scope) {
|
|
103
|
+
const task = await em.findOne(StaffTimeTask, scopedStaffSnapshotWhere(id, scope));
|
|
104
|
+
return task ? toSnapshot(task) : null;
|
|
105
|
+
}
|
|
106
|
+
async function loadChildSnapshots(em, parentTaskId, scope) {
|
|
107
|
+
const children = await em.find(StaffTimeTask, {
|
|
108
|
+
parentTaskId,
|
|
109
|
+
deletedAt: null,
|
|
110
|
+
...snapshotScopeWhere(scope)
|
|
111
|
+
});
|
|
112
|
+
return children.map(toSnapshot);
|
|
113
|
+
}
|
|
114
|
+
function notFoundError(translate) {
|
|
115
|
+
return new CrudHttpError(404, {
|
|
116
|
+
error: translate("staff.time_tracking.tasks.errors.notFound", "Task not found or not accessible.")
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function projectNotFoundError(translate) {
|
|
120
|
+
const message = translate("staff.timesheets.errors.projectNotFound", "Time project not found or not accessible.");
|
|
121
|
+
return new CrudHttpError(422, { error: message, fieldErrors: { timeProjectId: message } });
|
|
122
|
+
}
|
|
123
|
+
function statusNotFoundError(translate) {
|
|
124
|
+
const message = translate(
|
|
125
|
+
"staff.time_tracking.tasks.errors.statusNotFound",
|
|
126
|
+
"That column does not belong to this project."
|
|
127
|
+
);
|
|
128
|
+
return new CrudHttpError(422, { error: message, fieldErrors: { taskStatusId: message } });
|
|
129
|
+
}
|
|
130
|
+
function statusMissingError(translate) {
|
|
131
|
+
return new CrudHttpError(422, {
|
|
132
|
+
code: TASK_STATUS_MISSING_CODE,
|
|
133
|
+
error: translate(
|
|
134
|
+
"staff.time_tracking.tasks.errors.statusMissing",
|
|
135
|
+
"This project has no columns yet, so a task cannot be placed on its board."
|
|
136
|
+
)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function parentNotFoundError(translate) {
|
|
140
|
+
const message = translate(
|
|
141
|
+
"staff.time_tracking.tasks.errors.parentNotFound",
|
|
142
|
+
"Parent task not found or not accessible."
|
|
143
|
+
);
|
|
144
|
+
return new CrudHttpError(422, { error: message, fieldErrors: { parentTaskId: message } });
|
|
145
|
+
}
|
|
146
|
+
function assigneeNotFoundError(translate) {
|
|
147
|
+
const message = translate(
|
|
148
|
+
"staff.timesheets.errors.staffMemberNotFound",
|
|
149
|
+
"Staff member not found or not accessible."
|
|
150
|
+
);
|
|
151
|
+
return new CrudHttpError(422, { error: message, fieldErrors: { assigneeStaffMemberId: message } });
|
|
152
|
+
}
|
|
153
|
+
function parentRejectionError(translate, rejection) {
|
|
154
|
+
if (rejection === "self_parent") {
|
|
155
|
+
const message2 = translate(
|
|
156
|
+
"staff.time_tracking.tasks.errors.parentSelf",
|
|
157
|
+
"A task cannot be its own subtask."
|
|
158
|
+
);
|
|
159
|
+
return new CrudHttpError(400, {
|
|
160
|
+
code: TASK_PARENT_SELF_CODE,
|
|
161
|
+
error: message2,
|
|
162
|
+
fieldErrors: { parentTaskId: message2 }
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (rejection === "parent_project_mismatch") {
|
|
166
|
+
const message2 = translate(
|
|
167
|
+
"staff.time_tracking.tasks.errors.parentProjectMismatch",
|
|
168
|
+
"A subtask must stay in the same project as its parent."
|
|
169
|
+
);
|
|
170
|
+
return new CrudHttpError(422, {
|
|
171
|
+
code: TASK_PARENT_PROJECT_MISMATCH_CODE,
|
|
172
|
+
error: message2,
|
|
173
|
+
fieldErrors: { parentTaskId: message2 }
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const message = translate(
|
|
177
|
+
"staff.time_tracking.tasks.errors.subtaskDepthExceeded",
|
|
178
|
+
"Subtasks are one level deep. A subtask cannot have subtasks of its own."
|
|
179
|
+
);
|
|
180
|
+
return new CrudHttpError(400, {
|
|
181
|
+
code: TASK_DEPTH_EXCEEDED_CODE,
|
|
182
|
+
error: message,
|
|
183
|
+
fieldErrors: { parentTaskId: message }
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function referenceConflictError(translate) {
|
|
187
|
+
return new CrudHttpError(409, {
|
|
188
|
+
code: TASK_REFERENCE_CONFLICT_CODE,
|
|
189
|
+
error: translate(
|
|
190
|
+
"staff.time_tracking.tasks.errors.referenceConflict",
|
|
191
|
+
"Could not allocate a task number right now. Try again."
|
|
192
|
+
)
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async function requireProject(em, timeProjectId, scope, translate) {
|
|
196
|
+
const project = await em.findOne(
|
|
197
|
+
StaffTimeProject,
|
|
198
|
+
applyScopeToWhere({ id: timeProjectId, deletedAt: null }, scope)
|
|
199
|
+
);
|
|
200
|
+
if (!project) throw projectNotFoundError(translate);
|
|
201
|
+
return project;
|
|
202
|
+
}
|
|
203
|
+
async function resolveTaskStatus(em, timeProjectId, requestedStatusId, scope, translate) {
|
|
204
|
+
if (requestedStatusId) {
|
|
205
|
+
const status = await em.findOne(
|
|
206
|
+
StaffTimeTaskStatus,
|
|
207
|
+
applyScopeToWhere({ id: requestedStatusId, timeProjectId, deletedAt: null }, scope)
|
|
208
|
+
);
|
|
209
|
+
if (!status) throw statusNotFoundError(translate);
|
|
210
|
+
return status;
|
|
211
|
+
}
|
|
212
|
+
const board = await em.find(
|
|
213
|
+
StaffTimeTaskStatus,
|
|
214
|
+
applyScopeToWhere({ timeProjectId, deletedAt: null }, scope)
|
|
215
|
+
);
|
|
216
|
+
if (board.length === 0) throw statusMissingError(translate);
|
|
217
|
+
const ordered = [...board].sort((left, right) => left.position - right.position);
|
|
218
|
+
return ordered.find((status) => status.isDefault) ?? ordered[0];
|
|
219
|
+
}
|
|
220
|
+
async function requireParentTask(em, parentTaskId, scope, translate) {
|
|
221
|
+
const parent = await em.findOne(
|
|
222
|
+
StaffTimeTask,
|
|
223
|
+
applyScopeToWhere({ id: parentTaskId, deletedAt: null }, scope)
|
|
224
|
+
);
|
|
225
|
+
if (!parent) throw parentNotFoundError(translate);
|
|
226
|
+
return parent;
|
|
227
|
+
}
|
|
228
|
+
async function resolveStaffMemberIdForUser(em, userId, scope) {
|
|
229
|
+
if (!userId) return null;
|
|
230
|
+
const member = await findOneWithDecryption(
|
|
231
|
+
em,
|
|
232
|
+
StaffTeamMember,
|
|
233
|
+
applyScopeToWhere({ userId, deletedAt: null }, scope),
|
|
234
|
+
void 0,
|
|
235
|
+
scopeForDecryption(scope)
|
|
236
|
+
);
|
|
237
|
+
return member?.id ?? null;
|
|
238
|
+
}
|
|
239
|
+
async function requireStaffMember(em, staffMemberId, scope, translate) {
|
|
240
|
+
const member = await em.findOne(
|
|
241
|
+
StaffTeamMember,
|
|
242
|
+
applyScopeToWhere({ id: staffMemberId, deletedAt: null }, scope)
|
|
243
|
+
);
|
|
244
|
+
if (!member) throw assigneeNotFoundError(translate);
|
|
245
|
+
return member.id;
|
|
246
|
+
}
|
|
247
|
+
async function nextTaskPosition(em, timeProjectId, taskStatusId, scope) {
|
|
248
|
+
const siblings = await em.find(
|
|
249
|
+
StaffTimeTask,
|
|
250
|
+
applyScopeToWhere({ timeProjectId, taskStatusId, deletedAt: null }, scope)
|
|
251
|
+
);
|
|
252
|
+
return nextStatusPosition(siblings.map((task) => task.position));
|
|
253
|
+
}
|
|
254
|
+
async function readHighestSequenceNumber(em, timeProjectId, scope) {
|
|
255
|
+
const tasks = await em.find(StaffTimeTask, applyScopeToWhere({ timeProjectId }, scope));
|
|
256
|
+
return tasks.reduce((highest, task) => Math.max(highest, task.sequenceNumber ?? 0), 0);
|
|
257
|
+
}
|
|
258
|
+
function assertNoProjectMove(rawInput, task, translate) {
|
|
259
|
+
if (!rawInput || typeof rawInput !== "object") return;
|
|
260
|
+
const requested = rawInput.timeProjectId;
|
|
261
|
+
if (requested === void 0 || requested === null) return;
|
|
262
|
+
if (typeof requested === "string" && requested === task.timeProjectId) return;
|
|
263
|
+
const message = translate(
|
|
264
|
+
"staff.time_tracking.tasks.errors.projectMoveUnsupported",
|
|
265
|
+
"A task cannot be moved to another project. Create it in the target project instead."
|
|
266
|
+
);
|
|
267
|
+
throw new CrudHttpError(400, {
|
|
268
|
+
code: TASK_PROJECT_MOVE_UNSUPPORTED_CODE,
|
|
269
|
+
error: message,
|
|
270
|
+
fieldErrors: { timeProjectId: message }
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function applyStatusToTask(task, status, now) {
|
|
274
|
+
task.taskStatusId = status.id;
|
|
275
|
+
if (status.isDone) {
|
|
276
|
+
if (!task.closedAt) task.closedAt = now;
|
|
277
|
+
} else {
|
|
278
|
+
task.closedAt = null;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function actorUserId(ctx) {
|
|
282
|
+
return typeof ctx.auth?.sub === "string" ? ctx.auth.sub : null;
|
|
283
|
+
}
|
|
284
|
+
const createTaskCommand = {
|
|
285
|
+
id: staffTimeTaskCommandIds.create,
|
|
286
|
+
async execute(rawInput, ctx) {
|
|
287
|
+
const parsed = staffTimeTaskCreateSchema.parse(rawInput);
|
|
288
|
+
ensureTenantScope(ctx, parsed.tenantId);
|
|
289
|
+
ensureOrganizationScope(ctx, parsed.organizationId);
|
|
290
|
+
const scope = commandInputScope(ctx, parsed.tenantId, parsed.organizationId);
|
|
291
|
+
const { translate } = await resolveTranslations();
|
|
292
|
+
const baseEm = ctx.container.resolve("em");
|
|
293
|
+
const createdByUserId = actorUserId(ctx);
|
|
294
|
+
let record;
|
|
295
|
+
try {
|
|
296
|
+
record = await withTaskReferenceRetry(async () => {
|
|
297
|
+
const em = baseEm.fork();
|
|
298
|
+
let created = null;
|
|
299
|
+
let plan = null;
|
|
300
|
+
await withAtomicFlush(
|
|
301
|
+
em,
|
|
302
|
+
[
|
|
303
|
+
async () => {
|
|
304
|
+
const project = await requireProject(em, parsed.timeProjectId, scope, translate);
|
|
305
|
+
const status = await resolveTaskStatus(em, parsed.timeProjectId, parsed.taskStatusId, scope, translate);
|
|
306
|
+
let parentTaskId = null;
|
|
307
|
+
if (parsed.parentTaskId) {
|
|
308
|
+
const parent = await requireParentTask(em, parsed.parentTaskId, scope, translate);
|
|
309
|
+
const rejection = rejectTaskParent(parent, { timeProjectId: parsed.timeProjectId });
|
|
310
|
+
if (rejection) throw parentRejectionError(translate, rejection);
|
|
311
|
+
parentTaskId = parent.id;
|
|
312
|
+
}
|
|
313
|
+
const assigneeStaffMemberId = parsed.assigneeStaffMemberId ? await requireStaffMember(em, parsed.assigneeStaffMemberId, scope, translate) : await resolveStaffMemberIdForUser(em, createdByUserId, scope);
|
|
314
|
+
plan = {
|
|
315
|
+
project,
|
|
316
|
+
status,
|
|
317
|
+
parentTaskId,
|
|
318
|
+
assigneeStaffMemberId,
|
|
319
|
+
position: parsed.position ?? await nextTaskPosition(em, parsed.timeProjectId, status.id, scope),
|
|
320
|
+
highestSequenceNumber: await readHighestSequenceNumber(em, parsed.timeProjectId, scope)
|
|
321
|
+
};
|
|
322
|
+
},
|
|
323
|
+
() => {
|
|
324
|
+
if (!plan) throw notFoundError(translate);
|
|
325
|
+
const now = /* @__PURE__ */ new Date();
|
|
326
|
+
const allocation = allocateTaskReference(plan.project.code, plan.highestSequenceNumber);
|
|
327
|
+
created = em.create(StaffTimeTask, {
|
|
328
|
+
tenantId: parsed.tenantId,
|
|
329
|
+
organizationId: parsed.organizationId,
|
|
330
|
+
timeProjectId: parsed.timeProjectId,
|
|
331
|
+
parentTaskId: plan.parentTaskId,
|
|
332
|
+
taskStatusId: plan.status.id,
|
|
333
|
+
sequenceNumber: allocation.sequenceNumber,
|
|
334
|
+
reference: allocation.reference,
|
|
335
|
+
title: parsed.title,
|
|
336
|
+
description: parsed.description ?? null,
|
|
337
|
+
assigneeStaffMemberId: plan.assigneeStaffMemberId,
|
|
338
|
+
position: plan.position,
|
|
339
|
+
createdByUserId,
|
|
340
|
+
closedAt: plan.status.isDone ? now : null,
|
|
341
|
+
createdAt: now,
|
|
342
|
+
updatedAt: now,
|
|
343
|
+
deletedAt: null
|
|
344
|
+
});
|
|
345
|
+
em.persist(created);
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
{ transaction: true, label: staffTimeTaskCommandIds.create }
|
|
349
|
+
);
|
|
350
|
+
if (!created) throw notFoundError(translate);
|
|
351
|
+
return created;
|
|
352
|
+
});
|
|
353
|
+
} catch (err) {
|
|
354
|
+
if (isTaskReferenceConflict(err)) throw referenceConflictError(translate);
|
|
355
|
+
throw err;
|
|
356
|
+
}
|
|
357
|
+
await emitCrudSideEffects({
|
|
358
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
359
|
+
action: "created",
|
|
360
|
+
entity: record,
|
|
361
|
+
identifiers: { id: record.id, organizationId: record.organizationId, tenantId: record.tenantId },
|
|
362
|
+
events: taskCrudEvents,
|
|
363
|
+
indexer: taskCrudIndexer
|
|
364
|
+
});
|
|
365
|
+
return { taskId: record.id };
|
|
366
|
+
},
|
|
367
|
+
captureAfter: async (_input, result, ctx) => {
|
|
368
|
+
const em = ctx.container.resolve("em").fork();
|
|
369
|
+
const snapshot = await loadTaskSnapshot(em, result.taskId, staffSnapshotScopeFromContext(ctx));
|
|
370
|
+
if (!snapshot) return null;
|
|
371
|
+
return { snapshot };
|
|
372
|
+
},
|
|
373
|
+
buildLog: async ({ result, ctx }) => {
|
|
374
|
+
const em = ctx.container.resolve("em").fork();
|
|
375
|
+
const snapshot = await loadTaskSnapshot(em, result.taskId, staffSnapshotScopeFromContext(ctx));
|
|
376
|
+
if (!snapshot) return null;
|
|
377
|
+
const { translate } = await resolveTranslations();
|
|
378
|
+
return {
|
|
379
|
+
actionLabel: translate("staff.audit.timesheets.tasks.create", "Create task"),
|
|
380
|
+
resourceKind: "staff.timesheets.task",
|
|
381
|
+
resourceId: snapshot.id,
|
|
382
|
+
tenantId: snapshot.tenantId,
|
|
383
|
+
organizationId: snapshot.organizationId,
|
|
384
|
+
snapshotAfter: snapshot,
|
|
385
|
+
payload: {
|
|
386
|
+
undo: { after: snapshot }
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
undo: async ({ logEntry, ctx }) => {
|
|
391
|
+
const payload = extractUndoPayload(logEntry);
|
|
392
|
+
const after = payload?.after;
|
|
393
|
+
if (!after) return;
|
|
394
|
+
const em = ctx.container.resolve("em").fork();
|
|
395
|
+
const task = await em.findOne(StaffTimeTask, scopedStaffSnapshotWhere(after.id, staffSnapshotScopeFromSnapshot(after)));
|
|
396
|
+
if (!task) return;
|
|
397
|
+
task.deletedAt = /* @__PURE__ */ new Date();
|
|
398
|
+
task.updatedAt = /* @__PURE__ */ new Date();
|
|
399
|
+
await em.flush();
|
|
400
|
+
await emitCrudUndoSideEffects({
|
|
401
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
402
|
+
action: "deleted",
|
|
403
|
+
entity: task,
|
|
404
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
405
|
+
events: taskCrudEvents,
|
|
406
|
+
indexer: taskCrudIndexer
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
const updateTaskCommand = {
|
|
411
|
+
id: staffTimeTaskCommandIds.update,
|
|
412
|
+
async prepare(rawInput, ctx) {
|
|
413
|
+
const parsed = staffTimeTaskUpdateSchema.safeParse(rawInput);
|
|
414
|
+
if (!parsed.success) return {};
|
|
415
|
+
const em = ctx.container.resolve("em");
|
|
416
|
+
const before = await loadTaskSnapshot(em, parsed.data.id, staffSnapshotScopeFromContext(ctx));
|
|
417
|
+
if (!before) return {};
|
|
418
|
+
return { before: { snapshot: before } };
|
|
419
|
+
},
|
|
420
|
+
async execute(rawInput, ctx) {
|
|
421
|
+
const parsed = staffTimeTaskUpdateSchema.parse(rawInput);
|
|
422
|
+
const { translate } = await resolveTranslations();
|
|
423
|
+
const em = ctx.container.resolve("em").fork();
|
|
424
|
+
const scope = commandActorScope(ctx);
|
|
425
|
+
const task = await em.findOne(
|
|
426
|
+
StaffTimeTask,
|
|
427
|
+
applyScopeToWhere({ id: parsed.id, deletedAt: null }, scope)
|
|
428
|
+
);
|
|
429
|
+
if (!task) throw notFoundError(translate);
|
|
430
|
+
ensureTenantScope(ctx, task.tenantId);
|
|
431
|
+
ensureOrganizationScope(ctx, task.organizationId);
|
|
432
|
+
assertNoProjectMove(rawInput, task, translate);
|
|
433
|
+
let targetStatus = null;
|
|
434
|
+
let targetParentTaskId;
|
|
435
|
+
let targetAssigneeStaffMemberId;
|
|
436
|
+
await withAtomicFlush(
|
|
437
|
+
em,
|
|
438
|
+
[
|
|
439
|
+
async () => {
|
|
440
|
+
if (parsed.taskStatusId !== void 0) {
|
|
441
|
+
targetStatus = await resolveTaskStatus(em, task.timeProjectId, parsed.taskStatusId, scope, translate);
|
|
442
|
+
}
|
|
443
|
+
if (parsed.parentTaskId !== void 0) {
|
|
444
|
+
if (parsed.parentTaskId === null) {
|
|
445
|
+
targetParentTaskId = null;
|
|
446
|
+
} else {
|
|
447
|
+
const parent = await requireParentTask(em, parsed.parentTaskId, scope, translate);
|
|
448
|
+
const childCount = await em.count(
|
|
449
|
+
StaffTimeTask,
|
|
450
|
+
applyScopeToWhere({ parentTaskId: task.id, deletedAt: null }, scope)
|
|
451
|
+
);
|
|
452
|
+
const rejection = rejectTaskParent(parent, {
|
|
453
|
+
id: task.id,
|
|
454
|
+
timeProjectId: task.timeProjectId,
|
|
455
|
+
childCount
|
|
456
|
+
});
|
|
457
|
+
if (rejection) throw parentRejectionError(translate, rejection);
|
|
458
|
+
targetParentTaskId = parent.id;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (parsed.assigneeStaffMemberId !== void 0) {
|
|
462
|
+
targetAssigneeStaffMemberId = parsed.assigneeStaffMemberId ? await requireStaffMember(em, parsed.assigneeStaffMemberId, scope, translate) : null;
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
() => {
|
|
466
|
+
const now = /* @__PURE__ */ new Date();
|
|
467
|
+
if (parsed.title !== void 0) task.title = parsed.title;
|
|
468
|
+
if (parsed.description !== void 0) task.description = parsed.description ?? null;
|
|
469
|
+
if (parsed.position !== void 0) task.position = parsed.position;
|
|
470
|
+
if (targetParentTaskId !== void 0) task.parentTaskId = targetParentTaskId;
|
|
471
|
+
if (targetAssigneeStaffMemberId !== void 0) task.assigneeStaffMemberId = targetAssigneeStaffMemberId;
|
|
472
|
+
if (targetStatus) applyStatusToTask(task, targetStatus, now);
|
|
473
|
+
task.updatedAt = now;
|
|
474
|
+
}
|
|
475
|
+
],
|
|
476
|
+
{ transaction: true, label: staffTimeTaskCommandIds.update }
|
|
477
|
+
);
|
|
478
|
+
await emitCrudSideEffects({
|
|
479
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
480
|
+
action: "updated",
|
|
481
|
+
entity: task,
|
|
482
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
483
|
+
events: taskCrudEvents,
|
|
484
|
+
indexer: taskCrudIndexer
|
|
485
|
+
});
|
|
486
|
+
return { taskId: task.id };
|
|
487
|
+
},
|
|
488
|
+
buildLog: async ({ snapshots, ctx }) => {
|
|
489
|
+
const before = snapshots.before?.snapshot;
|
|
490
|
+
if (!before) return null;
|
|
491
|
+
const em = ctx.container.resolve("em").fork();
|
|
492
|
+
const after = await loadTaskSnapshot(em, before.id, staffSnapshotScopeFromSnapshot(before));
|
|
493
|
+
if (!after) return null;
|
|
494
|
+
const { translate } = await resolveTranslations();
|
|
495
|
+
return {
|
|
496
|
+
actionLabel: translate("staff.audit.timesheets.tasks.update", "Update task"),
|
|
497
|
+
resourceKind: "staff.timesheets.task",
|
|
498
|
+
resourceId: before.id,
|
|
499
|
+
tenantId: before.tenantId,
|
|
500
|
+
organizationId: before.organizationId,
|
|
501
|
+
snapshotBefore: before,
|
|
502
|
+
snapshotAfter: after,
|
|
503
|
+
changes: buildChanges(
|
|
504
|
+
before,
|
|
505
|
+
after,
|
|
506
|
+
[...DIFFED_FIELDS]
|
|
507
|
+
),
|
|
508
|
+
payload: {
|
|
509
|
+
undo: { before, after }
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
},
|
|
513
|
+
undo: async ({ logEntry, ctx }) => {
|
|
514
|
+
const payload = extractUndoPayload(logEntry);
|
|
515
|
+
const before = payload?.before;
|
|
516
|
+
if (!before) return;
|
|
517
|
+
const em = ctx.container.resolve("em").fork();
|
|
518
|
+
const task = await em.findOne(
|
|
519
|
+
StaffTimeTask,
|
|
520
|
+
scopedStaffSnapshotWhere(before.id, staffSnapshotScopeFromSnapshot(before))
|
|
521
|
+
);
|
|
522
|
+
if (!task) return;
|
|
523
|
+
task.parentTaskId = before.parentTaskId;
|
|
524
|
+
task.taskStatusId = before.taskStatusId;
|
|
525
|
+
task.title = before.title;
|
|
526
|
+
task.description = before.description;
|
|
527
|
+
task.assigneeStaffMemberId = before.assigneeStaffMemberId;
|
|
528
|
+
task.position = before.position;
|
|
529
|
+
task.closedAt = before.closedAt ? new Date(before.closedAt) : null;
|
|
530
|
+
task.updatedAt = /* @__PURE__ */ new Date();
|
|
531
|
+
await em.flush();
|
|
532
|
+
await emitCrudUndoSideEffects({
|
|
533
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
534
|
+
action: "updated",
|
|
535
|
+
entity: task,
|
|
536
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
537
|
+
events: taskCrudEvents,
|
|
538
|
+
indexer: taskCrudIndexer
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
const deleteTaskCommand = {
|
|
543
|
+
id: staffTimeTaskCommandIds.delete,
|
|
544
|
+
async prepare(input, ctx) {
|
|
545
|
+
const id = input?.id;
|
|
546
|
+
if (!id) return {};
|
|
547
|
+
const em = ctx.container.resolve("em");
|
|
548
|
+
const scope = staffSnapshotScopeFromContext(ctx);
|
|
549
|
+
const before = await loadTaskSnapshot(em, id, scope);
|
|
550
|
+
if (!before) return {};
|
|
551
|
+
const cascadedChildren = before.parentTaskId ? [] : await loadChildSnapshots(em, before.id, scope);
|
|
552
|
+
return { before: { snapshot: before, cascadedChildren } };
|
|
553
|
+
},
|
|
554
|
+
async execute(input, ctx) {
|
|
555
|
+
const { translate } = await resolveTranslations();
|
|
556
|
+
const id = input?.id;
|
|
557
|
+
if (!id) {
|
|
558
|
+
throw new CrudHttpError(400, {
|
|
559
|
+
error: translate("staff.time_tracking.tasks.errors.idRequired", "Task id is required.")
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
const em = ctx.container.resolve("em").fork();
|
|
563
|
+
const scope = commandActorScope(ctx);
|
|
564
|
+
const task = await em.findOne(
|
|
565
|
+
StaffTimeTask,
|
|
566
|
+
applyScopeToWhere({ id, deletedAt: null }, scope)
|
|
567
|
+
);
|
|
568
|
+
if (!task) throw notFoundError(translate);
|
|
569
|
+
ensureTenantScope(ctx, task.tenantId);
|
|
570
|
+
ensureOrganizationScope(ctx, task.organizationId);
|
|
571
|
+
let children = [];
|
|
572
|
+
let childIds = [];
|
|
573
|
+
await withAtomicFlush(
|
|
574
|
+
em,
|
|
575
|
+
[
|
|
576
|
+
async () => {
|
|
577
|
+
children = task.parentTaskId ? [] : await em.find(
|
|
578
|
+
StaffTimeTask,
|
|
579
|
+
applyScopeToWhere({ parentTaskId: task.id, deletedAt: null }, scope)
|
|
580
|
+
);
|
|
581
|
+
},
|
|
582
|
+
() => {
|
|
583
|
+
const plan = planTaskSoftDelete(task, children);
|
|
584
|
+
childIds = plan.childIds;
|
|
585
|
+
const now = /* @__PURE__ */ new Date();
|
|
586
|
+
const byId = new Map(children.map((child) => [child.id, child]));
|
|
587
|
+
task.deletedAt = now;
|
|
588
|
+
task.updatedAt = now;
|
|
589
|
+
for (const childId of childIds) {
|
|
590
|
+
const child = byId.get(childId);
|
|
591
|
+
if (!child) continue;
|
|
592
|
+
child.deletedAt = now;
|
|
593
|
+
child.updatedAt = now;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
],
|
|
597
|
+
{ transaction: true, label: staffTimeTaskCommandIds.delete }
|
|
598
|
+
);
|
|
599
|
+
const dataEngine = ctx.container.resolve("dataEngine");
|
|
600
|
+
for (const removed of [task, ...children.filter((child) => childIds.includes(child.id))]) {
|
|
601
|
+
await emitCrudSideEffects({
|
|
602
|
+
dataEngine,
|
|
603
|
+
action: "deleted",
|
|
604
|
+
entity: removed,
|
|
605
|
+
identifiers: { id: removed.id, organizationId: removed.organizationId, tenantId: removed.tenantId },
|
|
606
|
+
events: taskCrudEvents,
|
|
607
|
+
indexer: taskCrudIndexer
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
return { taskId: task.id, childIds };
|
|
611
|
+
},
|
|
612
|
+
buildLog: async ({ snapshots }) => {
|
|
613
|
+
const prepared = snapshots.before;
|
|
614
|
+
const before = prepared?.snapshot;
|
|
615
|
+
if (!before) return null;
|
|
616
|
+
const { translate } = await resolveTranslations();
|
|
617
|
+
return {
|
|
618
|
+
actionLabel: translate("staff.audit.timesheets.tasks.delete", "Delete task"),
|
|
619
|
+
resourceKind: "staff.timesheets.task",
|
|
620
|
+
resourceId: before.id,
|
|
621
|
+
tenantId: before.tenantId,
|
|
622
|
+
organizationId: before.organizationId,
|
|
623
|
+
snapshotBefore: before,
|
|
624
|
+
payload: {
|
|
625
|
+
undo: {
|
|
626
|
+
before,
|
|
627
|
+
cascadedChildren: prepared?.cascadedChildren ?? null
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
},
|
|
632
|
+
undo: async ({ logEntry, ctx }) => {
|
|
633
|
+
const payload = extractUndoPayload(logEntry);
|
|
634
|
+
const before = payload?.before;
|
|
635
|
+
if (!before) return;
|
|
636
|
+
const snapshotScope = staffSnapshotScopeFromSnapshot(before);
|
|
637
|
+
const em = ctx.container.resolve("em").fork();
|
|
638
|
+
const ids = [before.id, ...(payload?.cascadedChildren ?? []).map((child) => child.id)];
|
|
639
|
+
const restored = [];
|
|
640
|
+
await withAtomicFlush(
|
|
641
|
+
em,
|
|
642
|
+
[
|
|
643
|
+
async () => {
|
|
644
|
+
const tasks = await em.find(StaffTimeTask, {
|
|
645
|
+
id: { $in: ids },
|
|
646
|
+
...snapshotScopeWhere(snapshotScope)
|
|
647
|
+
});
|
|
648
|
+
restored.push(...tasks);
|
|
649
|
+
},
|
|
650
|
+
() => {
|
|
651
|
+
for (const task of restored) {
|
|
652
|
+
task.deletedAt = null;
|
|
653
|
+
task.updatedAt = /* @__PURE__ */ new Date();
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
],
|
|
657
|
+
{ transaction: true, label: `${staffTimeTaskCommandIds.delete}.undo` }
|
|
658
|
+
);
|
|
659
|
+
const dataEngine = ctx.container.resolve("dataEngine");
|
|
660
|
+
for (const task of restored) {
|
|
661
|
+
await emitCrudUndoSideEffects({
|
|
662
|
+
dataEngine,
|
|
663
|
+
action: "created",
|
|
664
|
+
entity: task,
|
|
665
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
666
|
+
events: taskCrudEvents,
|
|
667
|
+
indexer: taskCrudIndexer
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
const statusChangeInputSchema = staffTimeTaskStatusChangeSchema.extend({
|
|
673
|
+
id: z.string().uuid()
|
|
674
|
+
});
|
|
675
|
+
const STATUS_CHANGE_DIFFED_FIELDS = ["taskStatusId", "position", "closedAt"];
|
|
676
|
+
const statusChangeTaskCommand = {
|
|
677
|
+
id: staffTimeTaskCommandIds.statusChange,
|
|
678
|
+
async prepare(rawInput, ctx) {
|
|
679
|
+
const parsed = statusChangeInputSchema.safeParse(rawInput);
|
|
680
|
+
if (!parsed.success) return {};
|
|
681
|
+
const em = ctx.container.resolve("em");
|
|
682
|
+
const before = await loadTaskSnapshot(em, parsed.data.id, staffSnapshotScopeFromContext(ctx));
|
|
683
|
+
if (!before) return {};
|
|
684
|
+
return { before: { snapshot: before } };
|
|
685
|
+
},
|
|
686
|
+
async execute(rawInput, ctx) {
|
|
687
|
+
const parsed = statusChangeInputSchema.parse(rawInput);
|
|
688
|
+
const { translate } = await resolveTranslations();
|
|
689
|
+
const em = ctx.container.resolve("em").fork();
|
|
690
|
+
const scope = commandActorScope(ctx);
|
|
691
|
+
const task = await em.findOne(
|
|
692
|
+
StaffTimeTask,
|
|
693
|
+
applyScopeToWhere({ id: parsed.id, deletedAt: null }, scope)
|
|
694
|
+
);
|
|
695
|
+
if (!task) throw notFoundError(translate);
|
|
696
|
+
ensureTenantScope(ctx, task.tenantId);
|
|
697
|
+
ensureOrganizationScope(ctx, task.organizationId);
|
|
698
|
+
await enforceCommandOptimisticLockWithGuards(ctx.container, {
|
|
699
|
+
resourceKind: STAFF_TIME_TASK_RESOURCE_KIND,
|
|
700
|
+
resourceId: task.id,
|
|
701
|
+
current: task.updatedAt,
|
|
702
|
+
request: ctx.request
|
|
703
|
+
});
|
|
704
|
+
const previousTaskStatusId = task.taskStatusId;
|
|
705
|
+
let targetStatus = null;
|
|
706
|
+
let targetPosition = task.position;
|
|
707
|
+
await withAtomicFlush(
|
|
708
|
+
em,
|
|
709
|
+
[
|
|
710
|
+
async () => {
|
|
711
|
+
targetStatus = await resolveTaskStatus(em, task.timeProjectId, parsed.taskStatusId, scope, translate);
|
|
712
|
+
targetPosition = parsed.position ?? await nextTaskPosition(em, task.timeProjectId, targetStatus.id, scope);
|
|
713
|
+
},
|
|
714
|
+
() => {
|
|
715
|
+
if (!targetStatus) throw notFoundError(translate);
|
|
716
|
+
const now = /* @__PURE__ */ new Date();
|
|
717
|
+
task.position = targetPosition;
|
|
718
|
+
applyStatusToTask(task, targetStatus, now);
|
|
719
|
+
task.updatedAt = now;
|
|
720
|
+
}
|
|
721
|
+
],
|
|
722
|
+
{ transaction: true, label: staffTimeTaskCommandIds.statusChange }
|
|
723
|
+
);
|
|
724
|
+
await emitCrudSideEffects({
|
|
725
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
726
|
+
action: "updated",
|
|
727
|
+
entity: task,
|
|
728
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
729
|
+
events: taskCrudEvents,
|
|
730
|
+
indexer: taskCrudIndexer
|
|
731
|
+
});
|
|
732
|
+
const result = {
|
|
733
|
+
taskId: task.id,
|
|
734
|
+
timeProjectId: task.timeProjectId,
|
|
735
|
+
previousTaskStatusId,
|
|
736
|
+
taskStatusId: task.taskStatusId,
|
|
737
|
+
position: task.position,
|
|
738
|
+
closedAt: task.closedAt ? task.closedAt.toISOString() : null,
|
|
739
|
+
updatedAt: task.updatedAt ? task.updatedAt.toISOString() : null
|
|
740
|
+
};
|
|
741
|
+
void emitStaffEvent("staff.timesheets.time_task.status_changed", {
|
|
742
|
+
id: task.id,
|
|
743
|
+
tenantId: task.tenantId,
|
|
744
|
+
organizationId: task.organizationId,
|
|
745
|
+
...result
|
|
746
|
+
}).catch((err) => {
|
|
747
|
+
logger.error("staff.timesheets emit time_task.status_changed failed", { err });
|
|
748
|
+
});
|
|
749
|
+
return result;
|
|
750
|
+
},
|
|
751
|
+
buildLog: async ({ snapshots, ctx }) => {
|
|
752
|
+
const before = snapshots.before?.snapshot;
|
|
753
|
+
if (!before) return null;
|
|
754
|
+
const em = ctx.container.resolve("em").fork();
|
|
755
|
+
const after = await loadTaskSnapshot(em, before.id, staffSnapshotScopeFromSnapshot(before));
|
|
756
|
+
if (!after) return null;
|
|
757
|
+
const { translate } = await resolveTranslations();
|
|
758
|
+
return {
|
|
759
|
+
actionLabel: translate("staff.audit.timesheets.tasks.statusChange", "Move task"),
|
|
760
|
+
resourceKind: "staff.timesheets.task",
|
|
761
|
+
resourceId: before.id,
|
|
762
|
+
tenantId: before.tenantId,
|
|
763
|
+
organizationId: before.organizationId,
|
|
764
|
+
// Flushes the cached tasks list the board refetches right after the move,
|
|
765
|
+
// and again after an undo — the audit resourceKind above names a different
|
|
766
|
+
// tag. See TASK_LIST_CACHE_RESOURCE.
|
|
767
|
+
context: { cacheAliases: [TASK_LIST_CACHE_RESOURCE] },
|
|
768
|
+
snapshotBefore: before,
|
|
769
|
+
snapshotAfter: after,
|
|
770
|
+
changes: buildChanges(
|
|
771
|
+
before,
|
|
772
|
+
after,
|
|
773
|
+
[...STATUS_CHANGE_DIFFED_FIELDS]
|
|
774
|
+
),
|
|
775
|
+
payload: {
|
|
776
|
+
undo: { before, after }
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
},
|
|
780
|
+
undo: async ({ logEntry, ctx }) => {
|
|
781
|
+
const payload = extractUndoPayload(logEntry);
|
|
782
|
+
const before = payload?.before;
|
|
783
|
+
if (!before) return;
|
|
784
|
+
const em = ctx.container.resolve("em").fork();
|
|
785
|
+
const task = await em.findOne(
|
|
786
|
+
StaffTimeTask,
|
|
787
|
+
scopedStaffSnapshotWhere(before.id, staffSnapshotScopeFromSnapshot(before))
|
|
788
|
+
);
|
|
789
|
+
if (!task) return;
|
|
790
|
+
const previousTaskStatusId = task.taskStatusId;
|
|
791
|
+
task.taskStatusId = before.taskStatusId;
|
|
792
|
+
task.position = before.position;
|
|
793
|
+
task.closedAt = before.closedAt ? new Date(before.closedAt) : null;
|
|
794
|
+
task.updatedAt = /* @__PURE__ */ new Date();
|
|
795
|
+
await em.flush();
|
|
796
|
+
await emitCrudUndoSideEffects({
|
|
797
|
+
dataEngine: ctx.container.resolve("dataEngine"),
|
|
798
|
+
action: "updated",
|
|
799
|
+
entity: task,
|
|
800
|
+
identifiers: { id: task.id, organizationId: task.organizationId, tenantId: task.tenantId },
|
|
801
|
+
events: taskCrudEvents,
|
|
802
|
+
indexer: taskCrudIndexer
|
|
803
|
+
});
|
|
804
|
+
void emitStaffEvent("staff.timesheets.time_task.status_changed", {
|
|
805
|
+
id: task.id,
|
|
806
|
+
tenantId: task.tenantId,
|
|
807
|
+
organizationId: task.organizationId,
|
|
808
|
+
taskId: task.id,
|
|
809
|
+
timeProjectId: task.timeProjectId,
|
|
810
|
+
previousTaskStatusId,
|
|
811
|
+
taskStatusId: task.taskStatusId,
|
|
812
|
+
position: task.position,
|
|
813
|
+
closedAt: task.closedAt ? task.closedAt.toISOString() : null,
|
|
814
|
+
updatedAt: task.updatedAt ? task.updatedAt.toISOString() : null
|
|
815
|
+
}).catch((err) => {
|
|
816
|
+
logger.error("staff.timesheets emit time_task.status_changed failed", { err });
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
registerCommand(createTaskCommand);
|
|
821
|
+
registerCommand(updateTaskCommand);
|
|
822
|
+
registerCommand(deleteTaskCommand);
|
|
823
|
+
registerCommand(statusChangeTaskCommand);
|
|
824
|
+
export {
|
|
825
|
+
STAFF_TIME_TASK_RESOURCE_KIND,
|
|
826
|
+
TASK_DEPTH_EXCEEDED_CODE,
|
|
827
|
+
TASK_PARENT_PROJECT_MISMATCH_CODE,
|
|
828
|
+
TASK_PARENT_SELF_CODE,
|
|
829
|
+
TASK_PROJECT_MOVE_UNSUPPORTED_CODE,
|
|
830
|
+
TASK_REFERENCE_CONFLICT_CODE,
|
|
831
|
+
TASK_STATUS_MISSING_CODE,
|
|
832
|
+
staffTimeTaskCommandIds
|
|
833
|
+
};
|
|
834
|
+
//# sourceMappingURL=timesheets-tasks.js.map
|