@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,82 @@
|
|
|
1
|
+
import type { AwilixContainer } from 'awilix'
|
|
2
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
3
|
+
import type { AiToolExecutionContext } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/ai-api-operation-runner'
|
|
4
|
+
import { getStaffMemberByUserId } from '../lib/staffMemberResolver'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* EP-49. Shared context helpers for the time-tracking AI tool pack.
|
|
8
|
+
*
|
|
9
|
+
* Every tool in the pack is API-backed: it re-uses a documented
|
|
10
|
+
* `/api/staff/timesheets/*` route through `createAiApiOperationRunner`, which
|
|
11
|
+
* resolves the route from the generated manifest, refuses a mutation route whose
|
|
12
|
+
* `requiredFeatures` are not covered by the tool's own, and invokes the handler
|
|
13
|
+
* in process with the caller's identity. So the tools inherit — rather than
|
|
14
|
+
* restate — the project-access intersection, the money gate, the mutation guards,
|
|
15
|
+
* the interceptors and the commands' audit and undo. Nothing here writes a time
|
|
16
|
+
* entry itself.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export type StaffToolScope = {
|
|
20
|
+
tenantId: string
|
|
21
|
+
organizationId: string
|
|
22
|
+
staffMemberId: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function assertTenantScope(ctx: AiToolExecutionContext): {
|
|
26
|
+
tenantId: string
|
|
27
|
+
organizationId: string
|
|
28
|
+
} {
|
|
29
|
+
if (!ctx.tenantId) throw new Error('[internal] Tenant context is required for staff.* tools')
|
|
30
|
+
if (!ctx.organizationId) {
|
|
31
|
+
throw new Error('[internal] Organization context is required for staff.* tools')
|
|
32
|
+
}
|
|
33
|
+
return { tenantId: ctx.tenantId, organizationId: ctx.organizationId }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The pack is written for "log MY time": every tool acts as the caller's own
|
|
38
|
+
* staff member and none of them accepts a `staffMemberId` from the model. A user
|
|
39
|
+
* with no staff profile is refused rather than defaulted to somebody else.
|
|
40
|
+
*/
|
|
41
|
+
export async function resolveStaffToolScope(ctx: AiToolExecutionContext): Promise<StaffToolScope> {
|
|
42
|
+
const { tenantId, organizationId } = assertTenantScope(ctx)
|
|
43
|
+
if (!ctx.userId) throw new Error('[internal] User context is required for staff.* tools')
|
|
44
|
+
const container = ctx.container as AwilixContainer
|
|
45
|
+
const em = (container.resolve('em') as EntityManager).fork()
|
|
46
|
+
const member = await getStaffMemberByUserId(em, ctx.userId, tenantId, organizationId)
|
|
47
|
+
if (!member) {
|
|
48
|
+
throw new Error('The signed-in user has no staff profile, so time cannot be logged for them.')
|
|
49
|
+
}
|
|
50
|
+
return { tenantId, organizationId, staffMemberId: member.id }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function toIsoDate(value: unknown): string | null {
|
|
54
|
+
if (value instanceof Date) {
|
|
55
|
+
if (Number.isNaN(value.getTime())) return null
|
|
56
|
+
return value.toISOString().slice(0, 10)
|
|
57
|
+
}
|
|
58
|
+
if (typeof value === 'string' && value.trim().length > 0) return value.trim().slice(0, 10)
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function toMinutes(value: unknown): number {
|
|
63
|
+
const parsed = typeof value === 'number' ? value : Number(value ?? 0)
|
|
64
|
+
return Number.isFinite(parsed) ? Math.trunc(parsed) : 0
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Inclusive `yyyy-mm-dd` walk; caps at a year so a bad range cannot build an unbounded array. */
|
|
68
|
+
export function enumerateDates(from: string, to: string): string[] {
|
|
69
|
+
const start = Date.parse(`${from}T00:00:00Z`)
|
|
70
|
+
const end = Date.parse(`${to}T00:00:00Z`)
|
|
71
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return []
|
|
72
|
+
const dates: string[] = []
|
|
73
|
+
for (let cursor = start; cursor <= end && dates.length < 366; cursor += 86_400_000) {
|
|
74
|
+
dates.push(new Date(cursor).toISOString().slice(0, 10))
|
|
75
|
+
}
|
|
76
|
+
return dates
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function isWeekend(date: string): boolean {
|
|
80
|
+
const day = new Date(`${date}T00:00:00Z`).getUTCDay()
|
|
81
|
+
return day === 0 || day === 6
|
|
82
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AiToolDefinition } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/types'
|
|
2
|
+
import timeTrackingAiTools from './ai-tools/time-tracking-pack'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* EP-49. The module's AI tool registry.
|
|
6
|
+
*
|
|
7
|
+
* The generator discovers `ai-tools.ts` at the module root only, so a pack living
|
|
8
|
+
* in `ai-tools/` reaches the runtime through this aggregator — the customers
|
|
9
|
+
* idiom.
|
|
10
|
+
*/
|
|
11
|
+
export const aiTools: AiToolDefinition[] = [...timeTrackingAiTools]
|
|
12
|
+
|
|
13
|
+
export default aiTools
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import type { AnalyticsModuleConfig } from '@open-mercato/shared/modules/analytics'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* EP-47. Four time-tracking entities are aggregatable from a dashboard widget.
|
|
5
|
+
*
|
|
6
|
+
* Two rules shape every mapping below.
|
|
7
|
+
*
|
|
8
|
+
* **Money is absent, never blanked.** `staff_time_entries.rate_override_amount`,
|
|
9
|
+
* `staff_time_projects.hourly_rate` / `budget_value` and
|
|
10
|
+
* `staff_time_reports.total_amount` are deliberately NOT mapped. An
|
|
11
|
+
* `AnalyticsEntityConfig` carries a single `requiredFeatures` list for the whole
|
|
12
|
+
* entity, so there is no shape in which a money column is gated on
|
|
13
|
+
* `staff.timesheets.rates.view` while the rest of the entity stays readable by a
|
|
14
|
+
* plain viewer — and mapping it under the weaker gate would hand every dashboard
|
|
15
|
+
* author the customer's rates. The minute columns carry the same analysis
|
|
16
|
+
* without the disclosure.
|
|
17
|
+
*
|
|
18
|
+
* **Custom fields are not dimensions and cannot be.** `AnalyticsFieldMapping` is
|
|
19
|
+
* `{ dbColumn, type }` and the aggregation builder emits `dbColumn` as a bare
|
|
20
|
+
* identifier against `entityConfig.tableName` (`dashboards/lib/aggregations.ts`),
|
|
21
|
+
* so a mapping can only ever name a real column on that one table. The custom
|
|
22
|
+
* fields EP-43 declared are EAV rows in the `entities` module's tables, reachable
|
|
23
|
+
* by neither a join nor the jsonb-path form (which needs the values to live in a
|
|
24
|
+
* jsonb column on the row itself). The point is moot in any case while the
|
|
25
|
+
* command-backed write path drops `cf_*` on the way in — see the module
|
|
26
|
+
* `AGENTS.md` § Time-tracking custom fields.
|
|
27
|
+
*
|
|
28
|
+
* `is_billable` and `billable_by_default` are declared `text` because
|
|
29
|
+
* `AnalyticsFieldType` has no boolean member; the type is read for exactly one
|
|
30
|
+
* decision — whether a group-by column gets a `date_trunc` — so a boolean column
|
|
31
|
+
* grouped as `text` is emitted verbatim and labelled by its own value.
|
|
32
|
+
*/
|
|
3
33
|
export const analyticsConfig: AnalyticsModuleConfig = {
|
|
4
34
|
entities: [
|
|
5
35
|
{
|
|
@@ -13,14 +43,97 @@ export const analyticsConfig: AnalyticsModuleConfig = {
|
|
|
13
43
|
fieldMappings: {
|
|
14
44
|
id: { dbColumn: 'id', type: 'uuid' },
|
|
15
45
|
durationMinutes: { dbColumn: 'duration_minutes', type: 'numeric' },
|
|
46
|
+
roundedMinutes: { dbColumn: 'rounded_minutes', type: 'numeric' },
|
|
16
47
|
date: { dbColumn: 'date', type: 'timestamp' },
|
|
17
48
|
timeProjectId: { dbColumn: 'time_project_id', type: 'uuid' },
|
|
18
49
|
staffMemberId: { dbColumn: 'staff_member_id', type: 'uuid' },
|
|
50
|
+
taskId: { dbColumn: 'task_id', type: 'uuid' },
|
|
51
|
+
customerId: { dbColumn: 'customer_id', type: 'uuid' },
|
|
52
|
+
isBillable: { dbColumn: 'is_billable', type: 'text' },
|
|
53
|
+
lockedReportId: { dbColumn: 'locked_report_id', type: 'uuid' },
|
|
19
54
|
source: { dbColumn: 'source', type: 'text' },
|
|
20
55
|
},
|
|
21
56
|
labelResolvers: {
|
|
22
57
|
timeProjectId: { table: 'staff_time_projects', idColumn: 'id', labelColumn: 'name' },
|
|
23
58
|
staffMemberId: { table: 'staff_team_members', idColumn: 'id', labelColumn: 'display_name' },
|
|
59
|
+
taskId: { table: 'staff_time_tasks', idColumn: 'id', labelColumn: 'title' },
|
|
60
|
+
customerId: { table: 'customer_entities', idColumn: 'id', labelColumn: 'display_name' },
|
|
61
|
+
lockedReportId: { table: 'staff_time_reports', idColumn: 'id', labelColumn: 'reference' },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
entityId: 'staff:staff_time_tasks',
|
|
66
|
+
requiredFeatures: ['staff.timesheets.tasks.view'],
|
|
67
|
+
entityConfig: {
|
|
68
|
+
tableName: 'staff_time_tasks',
|
|
69
|
+
dateField: 'created_at',
|
|
70
|
+
defaultScopeFields: ['tenant_id', 'organization_id'],
|
|
71
|
+
},
|
|
72
|
+
fieldMappings: {
|
|
73
|
+
id: { dbColumn: 'id', type: 'uuid' },
|
|
74
|
+
reference: { dbColumn: 'reference', type: 'text' },
|
|
75
|
+
timeProjectId: { dbColumn: 'time_project_id', type: 'uuid' },
|
|
76
|
+
parentTaskId: { dbColumn: 'parent_task_id', type: 'uuid' },
|
|
77
|
+
taskStatusId: { dbColumn: 'task_status_id', type: 'uuid' },
|
|
78
|
+
assigneeStaffMemberId: { dbColumn: 'assignee_staff_member_id', type: 'uuid' },
|
|
79
|
+
createdAt: { dbColumn: 'created_at', type: 'timestamp' },
|
|
80
|
+
closedAt: { dbColumn: 'closed_at', type: 'timestamp' },
|
|
81
|
+
},
|
|
82
|
+
labelResolvers: {
|
|
83
|
+
timeProjectId: { table: 'staff_time_projects', idColumn: 'id', labelColumn: 'name' },
|
|
84
|
+
taskStatusId: { table: 'staff_time_task_statuses', idColumn: 'id', labelColumn: 'name' },
|
|
85
|
+
assigneeStaffMemberId: { table: 'staff_team_members', idColumn: 'id', labelColumn: 'display_name' },
|
|
86
|
+
parentTaskId: { table: 'staff_time_tasks', idColumn: 'id', labelColumn: 'title' },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
entityId: 'staff:staff_time_projects',
|
|
91
|
+
requiredFeatures: ['staff.timesheets.projects.view'],
|
|
92
|
+
entityConfig: {
|
|
93
|
+
tableName: 'staff_time_projects',
|
|
94
|
+
dateField: 'created_at',
|
|
95
|
+
defaultScopeFields: ['tenant_id', 'organization_id'],
|
|
96
|
+
},
|
|
97
|
+
fieldMappings: {
|
|
98
|
+
id: { dbColumn: 'id', type: 'uuid' },
|
|
99
|
+
code: { dbColumn: 'code', type: 'text' },
|
|
100
|
+
customerId: { dbColumn: 'customer_id', type: 'uuid' },
|
|
101
|
+
projectType: { dbColumn: 'project_type', type: 'text' },
|
|
102
|
+
status: { dbColumn: 'status', type: 'text' },
|
|
103
|
+
ownerUserId: { dbColumn: 'owner_user_id', type: 'uuid' },
|
|
104
|
+
costCenter: { dbColumn: 'cost_center', type: 'text' },
|
|
105
|
+
budgetKind: { dbColumn: 'budget_kind', type: 'text' },
|
|
106
|
+
billableByDefault: { dbColumn: 'billable_by_default', type: 'text' },
|
|
107
|
+
startDate: { dbColumn: 'start_date', type: 'timestamp' },
|
|
108
|
+
createdAt: { dbColumn: 'created_at', type: 'timestamp' },
|
|
109
|
+
},
|
|
110
|
+
labelResolvers: {
|
|
111
|
+
customerId: { table: 'customer_entities', idColumn: 'id', labelColumn: 'display_name' },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
entityId: 'staff:staff_time_reports',
|
|
116
|
+
requiredFeatures: ['staff.timesheets.reports.view'],
|
|
117
|
+
entityConfig: {
|
|
118
|
+
tableName: 'staff_time_reports',
|
|
119
|
+
dateField: 'period_from',
|
|
120
|
+
defaultScopeFields: ['tenant_id', 'organization_id'],
|
|
121
|
+
},
|
|
122
|
+
fieldMappings: {
|
|
123
|
+
id: { dbColumn: 'id', type: 'uuid' },
|
|
124
|
+
reference: { dbColumn: 'reference', type: 'text' },
|
|
125
|
+
customerId: { dbColumn: 'customer_id', type: 'uuid' },
|
|
126
|
+
status: { dbColumn: 'status', type: 'text' },
|
|
127
|
+
periodKind: { dbColumn: 'period_kind', type: 'text' },
|
|
128
|
+
periodFrom: { dbColumn: 'period_from', type: 'timestamp' },
|
|
129
|
+
periodTo: { dbColumn: 'period_to', type: 'timestamp' },
|
|
130
|
+
grouping: { dbColumn: 'grouping', type: 'text' },
|
|
131
|
+
totalBillableMinutes: { dbColumn: 'total_billable_minutes', type: 'numeric' },
|
|
132
|
+
totalNonbillableMinutes: { dbColumn: 'total_nonbillable_minutes', type: 'numeric' },
|
|
133
|
+
closedAt: { dbColumn: 'closed_at', type: 'timestamp' },
|
|
134
|
+
},
|
|
135
|
+
labelResolvers: {
|
|
136
|
+
customerId: { table: 'customer_entities', idColumn: 'id', labelColumn: 'display_name' },
|
|
24
137
|
},
|
|
25
138
|
},
|
|
26
139
|
],
|
|
@@ -5,22 +5,96 @@ import {
|
|
|
5
5
|
type MutationGuard,
|
|
6
6
|
type MutationGuardInput,
|
|
7
7
|
} from '@open-mercato/shared/lib/crud/mutation-guard-registry'
|
|
8
|
+
import { getAllMutationGuardInstances } from '@open-mercato/shared/lib/crud/mutation-guard-store'
|
|
9
|
+
import { resolveFeatureAccess } from '../lib/time-tracking/featureAccess'
|
|
8
10
|
|
|
9
11
|
type GuardAfterCallback = {
|
|
10
12
|
guard: MutationGuard
|
|
11
13
|
metadata: Record<string, unknown> | null
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated `AuthContext` has no `features` field, so this always answered `[]` —
|
|
18
|
+
* which silently filtered out every registered guard declaring `features`, leaving
|
|
19
|
+
* feature-gated guards enforced on the `makeCrudRoute` resources (the factory
|
|
20
|
+
* resolves real grants) and skipped on every hand-rolled write route.
|
|
21
|
+
* `runStaffMutationGuards` now resolves the caller's grants itself through
|
|
22
|
+
* `resolveFeatureAccess`; pass nothing. Kept as an exported symbol for one release.
|
|
23
|
+
*/
|
|
14
24
|
export function resolveUserFeatures(auth: unknown): string[] {
|
|
15
25
|
const features = (auth as { features?: unknown })?.features
|
|
16
26
|
if (!Array.isArray(features)) return []
|
|
17
27
|
return features.filter((value): value is string => typeof value === 'string')
|
|
18
28
|
}
|
|
19
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The `resourceKind` every hand-rolled time-tracking write route passes into the
|
|
32
|
+
* mutation-guard contract, published as one map so a guard author can target a route
|
|
33
|
+
* without reading it.
|
|
34
|
+
*
|
|
35
|
+
* These strings are what `MutationGuardInput.resourceKind` carries; they are NOT the
|
|
36
|
+
* CRUD factory's cache/audit resource tag, which the factory derives on its own from
|
|
37
|
+
* each route's `events` config. A guard that filters on `resourceKind` matches against
|
|
38
|
+
* the values below on the custom routes and against the factory-derived tag on the
|
|
39
|
+
* eight `makeCrudRoute` resources.
|
|
40
|
+
*
|
|
41
|
+
* `staff.timesheets.time_task` and `staff.timesheets.time_report` are re-exported from
|
|
42
|
+
* the command modules that also feed them to `enforceCommandOptimisticLockWithGuards`
|
|
43
|
+
* (`STAFF_TIME_TASK_RESOURCE_KIND`, `STAFF_TIME_REPORT_RESOURCE_KIND`); the unit test
|
|
44
|
+
* pins both copies to the same string so they cannot drift.
|
|
45
|
+
*/
|
|
46
|
+
export const STAFF_TIME_TRACKING_RESOURCE_KINDS = {
|
|
47
|
+
/** `time-entries/{bulk,copy-day,start-timer}`, `time-entries/[id]/{duplicate,timer-start,timer-stop}` */
|
|
48
|
+
timeEntry: 'staff.timesheets.time_entry',
|
|
49
|
+
/** `time-entries/[id]/segments`, `time-entries/[id]/segments/[segmentId]` */
|
|
50
|
+
timeEntrySegment: 'staff.timesheets.time_entry_segment',
|
|
51
|
+
/** `tasks/[id]/status` */
|
|
52
|
+
timeTask: 'staff.timesheets.time_task',
|
|
53
|
+
/** `tasks/[id]/comments` */
|
|
54
|
+
timeTaskComment: 'staff.timesheets.task_comment',
|
|
55
|
+
/** `time-projects/[id]/change-currency` */
|
|
56
|
+
timeProject: 'staff.timesheets.time_project',
|
|
57
|
+
/** `my-projects/[projectId]` */
|
|
58
|
+
timeProjectMember: 'staff.timesheets.time_project_member',
|
|
59
|
+
/** `reports/[id]/close`, `reports/[id]/unlock` */
|
|
60
|
+
timeReport: 'staff.timesheets.time_report',
|
|
61
|
+
/** `tags/entry-assignments` */
|
|
62
|
+
entryTag: 'staff.timesheets.entry_tag',
|
|
63
|
+
/** `tags/task-assignments` */
|
|
64
|
+
taskTag: 'staff.timesheets.task_tag',
|
|
65
|
+
/** `settings`, `settings/reapply-rounding` */
|
|
66
|
+
settings: 'staff.timesheets.settings',
|
|
67
|
+
/** `access-requests` */
|
|
68
|
+
accessRequest: 'staff.timesheets.access_request',
|
|
69
|
+
} as const
|
|
70
|
+
|
|
71
|
+
export type StaffTimeTrackingResourceKind =
|
|
72
|
+
typeof STAFF_TIME_TRACKING_RESOURCE_KINDS[keyof typeof STAFF_TIME_TRACKING_RESOURCE_KINDS]
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Runs the same guard set as `makeCrudRoute`: every guard a module registered through
|
|
76
|
+
* `data/guards.ts` (`getAllMutationGuardInstances()`) plus the bridged legacy DI
|
|
77
|
+
* service. Mirrors `collectAndRunGuards()` in the CRUD factory; bridging only the
|
|
78
|
+
* legacy service — as this did originally — left registry guards unenforced on every
|
|
79
|
+
* hand-rolled time-tracking write route.
|
|
80
|
+
*
|
|
81
|
+
* **The grant list is resolved here, not passed in.** `runMutationGuards` drops any
|
|
82
|
+
* guard whose `features` the caller does not hold, so an empty list silently disables
|
|
83
|
+
* every feature-gated guard — a third-party `record_locks.enforce` guard fired on the
|
|
84
|
+
* `makeCrudRoute` resources (the factory asks RBAC) and was skipped on `/bulk`, the
|
|
85
|
+
* timer transitions, segments, tag assignments and report close/unlock. Callers used
|
|
86
|
+
* to supply `resolveUserFeatures(auth)`, which read a field `AuthContext` does not
|
|
87
|
+
* have and therefore always returned `[]`. The lookup now goes through
|
|
88
|
+
* `resolveFeatureAccess`, the module's one RBAC authority, which fails closed and
|
|
89
|
+
* logs rather than failing silently.
|
|
90
|
+
*
|
|
91
|
+
* `extraFeatures` is additive and exists only for a caller that already holds a
|
|
92
|
+
* resolved grant list; it is never the sole source.
|
|
93
|
+
*/
|
|
20
94
|
export async function runStaffMutationGuards(
|
|
21
95
|
container: AwilixContainer,
|
|
22
96
|
input: MutationGuardInput,
|
|
23
|
-
|
|
97
|
+
extraFeatures: readonly string[] = [],
|
|
24
98
|
): Promise<{
|
|
25
99
|
ok: boolean
|
|
26
100
|
errorBody?: Record<string, unknown>
|
|
@@ -28,12 +102,20 @@ export async function runStaffMutationGuards(
|
|
|
28
102
|
modifiedPayload?: Record<string, unknown>
|
|
29
103
|
afterSuccessCallbacks: GuardAfterCallback[]
|
|
30
104
|
}> {
|
|
105
|
+
const allGuards: MutationGuard[] = [...getAllMutationGuardInstances()]
|
|
31
106
|
const legacyGuard = bridgeLegacyGuard(container)
|
|
32
|
-
if (
|
|
107
|
+
if (legacyGuard) allGuards.push(legacyGuard)
|
|
108
|
+
if (!allGuards.length) {
|
|
33
109
|
return { ok: true, afterSuccessCallbacks: [] }
|
|
34
110
|
}
|
|
35
111
|
|
|
36
|
-
|
|
112
|
+
const { grantedFeatures } = await resolveFeatureAccess(container, input.userId ?? null, [], {
|
|
113
|
+
tenantId: input.tenantId ?? null,
|
|
114
|
+
organizationId: input.organizationId ?? null,
|
|
115
|
+
})
|
|
116
|
+
const userFeatures = Array.from(new Set([...grantedFeatures, ...extraFeatures]))
|
|
117
|
+
|
|
118
|
+
return runMutationGuards(allGuards, input, { userFeatures })
|
|
37
119
|
}
|
|
38
120
|
|
|
39
121
|
export async function runStaffMutationGuardAfterSuccess(
|
|
@@ -11,7 +11,6 @@ import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
12
12
|
import { staffLeaveRequestDecisionSchema, type StaffLeaveRequestDecisionInput } from '../../../data/validators'
|
|
13
13
|
import {
|
|
14
|
-
resolveUserFeatures,
|
|
15
14
|
runStaffMutationGuardAfterSuccess,
|
|
16
15
|
runStaffMutationGuards,
|
|
17
16
|
} from '../../guards'
|
|
@@ -65,7 +64,6 @@ export async function POST(req: Request) {
|
|
|
65
64
|
requestHeaders: req.headers,
|
|
66
65
|
mutationPayload: input,
|
|
67
66
|
},
|
|
68
|
-
resolveUserFeatures(auth),
|
|
69
67
|
)
|
|
70
68
|
if (!guardResult.ok) {
|
|
71
69
|
return NextResponse.json(
|
|
@@ -11,7 +11,6 @@ import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
12
12
|
import { staffLeaveRequestDecisionSchema, type StaffLeaveRequestDecisionInput } from '../../../data/validators'
|
|
13
13
|
import {
|
|
14
|
-
resolveUserFeatures,
|
|
15
14
|
runStaffMutationGuardAfterSuccess,
|
|
16
15
|
runStaffMutationGuards,
|
|
17
16
|
} from '../../guards'
|
|
@@ -65,7 +64,6 @@ export async function POST(req: Request) {
|
|
|
65
64
|
requestHeaders: req.headers,
|
|
66
65
|
mutationPayload: input,
|
|
67
66
|
},
|
|
68
|
-
resolveUserFeatures(auth),
|
|
69
67
|
)
|
|
70
68
|
if (!guardResult.ok) {
|
|
71
69
|
return NextResponse.json(
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GET /api/staff/portal/time-reports/{id}` — EP-50.
|
|
3
|
+
*
|
|
4
|
+
* The ownership check is the list route's, unchanged and re-applied here rather
|
|
5
|
+
* than inherited from it: the id in the path is caller-supplied, so the row it
|
|
6
|
+
* names is loaded WITH `tenant_id`, `organization_id`, `customer_id`,
|
|
7
|
+
* `status = 'closed'` and `deleted_at IS NULL` in the same WHERE clause, never
|
|
8
|
+
* loaded first and checked after. A report belonging to another customer of the
|
|
9
|
+
* same organization is a `404`, not a `403` — the portal must not confirm that
|
|
10
|
+
* somebody else's report exists.
|
|
11
|
+
*
|
|
12
|
+
* The per-project breakdown reads the FROZEN minutes on `staff_time_report_entries`,
|
|
13
|
+
* which is what the close wrote and what the client was told. It carries no
|
|
14
|
+
* `frozen_rate_amount` and no `frozen_amount`; see the list route's header for why
|
|
15
|
+
* money is structurally absent from this surface rather than conditionally hidden.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { NextResponse } from 'next/server'
|
|
19
|
+
import { z } from 'zod'
|
|
20
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
21
|
+
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
22
|
+
import { portalOwnedReportClause } from '../../../../lib/time-tracking/portalReports'
|
|
23
|
+
import { resolvePortalScope, toIsoDate, toMinutes } from '../route'
|
|
24
|
+
|
|
25
|
+
const logger = createLogger('staff').child({ component: 'api/portal/time-reports/[id]' })
|
|
26
|
+
|
|
27
|
+
export const metadata: { path?: string; requireAuth?: boolean } = { requireAuth: false }
|
|
28
|
+
|
|
29
|
+
const paramsSchema = z.object({ id: z.string().uuid() })
|
|
30
|
+
|
|
31
|
+
const errorResponseSchema = z.object({ ok: z.literal(false), error: z.string() })
|
|
32
|
+
|
|
33
|
+
const projectLineSchema = z.object({
|
|
34
|
+
timeProjectId: z.string().nullable(),
|
|
35
|
+
projectName: z.string().nullable(),
|
|
36
|
+
billableMinutes: z.number().int(),
|
|
37
|
+
nonbillableMinutes: z.number().int(),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const detailResponseSchema = z.object({
|
|
41
|
+
id: z.string().uuid(),
|
|
42
|
+
reference: z.string(),
|
|
43
|
+
title: z.string(),
|
|
44
|
+
periodFrom: z.string(),
|
|
45
|
+
periodTo: z.string(),
|
|
46
|
+
closedAt: z.string().nullable(),
|
|
47
|
+
totalBillableMinutes: z.number().int(),
|
|
48
|
+
totalNonbillableMinutes: z.number().int(),
|
|
49
|
+
projects: z.array(projectLineSchema),
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
type ReportRow = {
|
|
53
|
+
id: string
|
|
54
|
+
reference: string
|
|
55
|
+
title: string
|
|
56
|
+
period_from: Date | string
|
|
57
|
+
period_to: Date | string
|
|
58
|
+
closed_at: Date | string | null
|
|
59
|
+
total_billable_minutes: number | string | null
|
|
60
|
+
total_nonbillable_minutes: number | string | null
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type ProjectRow = {
|
|
64
|
+
time_project_id: string | null
|
|
65
|
+
project_name: string | null
|
|
66
|
+
billable_minutes: number | string | null
|
|
67
|
+
nonbillable_minutes: number | string | null
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readReportId(req: Request): string | null {
|
|
71
|
+
const segments = new URL(req.url).pathname.split('/').filter(Boolean)
|
|
72
|
+
const last = segments[segments.length - 1]
|
|
73
|
+
const parsed = paramsSchema.safeParse({ id: last })
|
|
74
|
+
return parsed.success ? parsed.data.id : null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function GET(req: Request) {
|
|
78
|
+
try {
|
|
79
|
+
const scopeOrResponse = await resolvePortalScope(req)
|
|
80
|
+
if (scopeOrResponse instanceof Response) return scopeOrResponse
|
|
81
|
+
const scope = scopeOrResponse
|
|
82
|
+
|
|
83
|
+
const reportId = readReportId(req)
|
|
84
|
+
if (!reportId) {
|
|
85
|
+
return NextResponse.json({ ok: false, error: 'staff.errors.invalidInput' }, { status: 400 })
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const connection = scope.em.getConnection()
|
|
89
|
+
const owned = portalOwnedReportClause(scope)
|
|
90
|
+
const rows = (await connection.execute(
|
|
91
|
+
`
|
|
92
|
+
SELECT id, reference, title, period_from, period_to, closed_at,
|
|
93
|
+
total_billable_minutes, total_nonbillable_minutes
|
|
94
|
+
FROM staff_time_reports
|
|
95
|
+
WHERE ${owned.sql} AND id = ?
|
|
96
|
+
LIMIT 1
|
|
97
|
+
`,
|
|
98
|
+
[...owned.params, reportId],
|
|
99
|
+
)) as ReportRow[]
|
|
100
|
+
|
|
101
|
+
const report = rows?.[0]
|
|
102
|
+
if (!report) {
|
|
103
|
+
return NextResponse.json({ ok: false, error: 'staff.errors.notFound' }, { status: 404 })
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const periodFrom = toIsoDate(report.period_from)
|
|
107
|
+
const periodTo = toIsoDate(report.period_to)
|
|
108
|
+
if (!periodFrom || !periodTo) {
|
|
109
|
+
return NextResponse.json({ ok: false, error: 'staff.errors.notFound' }, { status: 404 })
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const projectRows = (await connection.execute(
|
|
113
|
+
`
|
|
114
|
+
SELECT entry.time_project_id AS time_project_id,
|
|
115
|
+
project.name AS project_name,
|
|
116
|
+
COALESCE(SUM(CASE WHEN line.frozen_is_billable THEN line.frozen_rounded_minutes ELSE 0 END), 0) AS billable_minutes,
|
|
117
|
+
COALESCE(SUM(CASE WHEN line.frozen_is_billable THEN 0 ELSE line.frozen_rounded_minutes END), 0) AS nonbillable_minutes
|
|
118
|
+
FROM staff_time_report_entries line
|
|
119
|
+
JOIN staff_time_entries entry
|
|
120
|
+
ON entry.id = line.time_entry_id
|
|
121
|
+
AND entry.tenant_id = line.tenant_id
|
|
122
|
+
AND entry.organization_id = line.organization_id
|
|
123
|
+
LEFT JOIN staff_time_projects project
|
|
124
|
+
ON project.id = entry.time_project_id
|
|
125
|
+
AND project.tenant_id = line.tenant_id
|
|
126
|
+
AND project.organization_id = line.organization_id
|
|
127
|
+
WHERE line.report_id = ?
|
|
128
|
+
AND line.tenant_id = ?
|
|
129
|
+
AND line.organization_id = ?
|
|
130
|
+
GROUP BY entry.time_project_id, project.name
|
|
131
|
+
ORDER BY project.name ASC NULLS LAST
|
|
132
|
+
`,
|
|
133
|
+
[report.id, scope.tenantId, scope.organizationId],
|
|
134
|
+
)) as ProjectRow[]
|
|
135
|
+
|
|
136
|
+
return NextResponse.json(
|
|
137
|
+
detailResponseSchema.parse({
|
|
138
|
+
id: report.id,
|
|
139
|
+
reference: report.reference,
|
|
140
|
+
title: report.title,
|
|
141
|
+
periodFrom,
|
|
142
|
+
periodTo,
|
|
143
|
+
closedAt:
|
|
144
|
+
report.closed_at instanceof Date
|
|
145
|
+
? report.closed_at.toISOString()
|
|
146
|
+
: typeof report.closed_at === 'string' && report.closed_at.trim().length > 0
|
|
147
|
+
? report.closed_at
|
|
148
|
+
: null,
|
|
149
|
+
totalBillableMinutes: toMinutes(report.total_billable_minutes),
|
|
150
|
+
totalNonbillableMinutes: toMinutes(report.total_nonbillable_minutes),
|
|
151
|
+
projects: projectRows.map((row) => ({
|
|
152
|
+
timeProjectId: row.time_project_id ?? null,
|
|
153
|
+
projectName: row.project_name ?? null,
|
|
154
|
+
billableMinutes: toMinutes(row.billable_minutes),
|
|
155
|
+
nonbillableMinutes: toMinutes(row.nonbillable_minutes),
|
|
156
|
+
})),
|
|
157
|
+
}),
|
|
158
|
+
)
|
|
159
|
+
} catch (err) {
|
|
160
|
+
logger.error('staff portal time-report detail failed', { err })
|
|
161
|
+
return NextResponse.json({ ok: false, error: 'staff.errors.internal' }, { status: 500 })
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const openApi: OpenApiRouteDoc = {
|
|
166
|
+
tag: 'Staff Portal',
|
|
167
|
+
pathParams: paramsSchema,
|
|
168
|
+
methods: {
|
|
169
|
+
GET: {
|
|
170
|
+
summary: 'Read one closed time report belonging to the signed-in customer',
|
|
171
|
+
description:
|
|
172
|
+
'Loads the report by id **together with** the tenant, organization, customer and closed-status predicates, so a report belonging to another customer of the same organization answers 404. Returns the frozen minute totals per project; no rate, cost, amount or currency is present in the response.',
|
|
173
|
+
pathParams: paramsSchema,
|
|
174
|
+
responses: [{ status: 200, description: 'The report', schema: detailResponseSchema }],
|
|
175
|
+
errors: [
|
|
176
|
+
{ status: 401, description: 'Not signed in to the portal', schema: errorResponseSchema },
|
|
177
|
+
{ status: 403, description: 'The portal account is not linked to a customer', schema: errorResponseSchema },
|
|
178
|
+
{ status: 404, description: 'No closed report with that id belongs to this customer', schema: errorResponseSchema },
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
}
|