@hed-hog/operations 0.0.332 → 0.0.338

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.
Files changed (109) hide show
  1. package/dist/controllers/operations-collaborators.controller.d.ts +0 -54
  2. package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
  3. package/dist/controllers/operations-collaborators.controller.js +0 -100
  4. package/dist/controllers/operations-collaborators.controller.js.map +1 -1
  5. package/dist/controllers/operations-contracts.controller.d.ts +12 -12
  6. package/dist/operations.service.d.ts +0 -76
  7. package/dist/operations.service.d.ts.map +1 -1
  8. package/dist/operations.service.js +7 -230
  9. package/dist/operations.service.js.map +1 -1
  10. package/dist/operations.service.spec.js +6 -0
  11. package/dist/operations.service.spec.js.map +1 -1
  12. package/hedhog/data/menu.yaml +8 -27
  13. package/hedhog/data/route.yaml +0 -72
  14. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +476 -0
  15. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +3 -39
  16. package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +261 -0
  17. package/hedhog/frontend/app/_components/collaborator-tasks-tab.tsx.ejs +358 -358
  18. package/hedhog/frontend/app/_components/collaborator-timesheets-tab.tsx.ejs +6 -6
  19. package/hedhog/frontend/app/_components/contract-content-editor.tsx.ejs +258 -0
  20. package/hedhog/frontend/app/_components/my-project-summary-screen.tsx.ejs +5 -4
  21. package/hedhog/frontend/app/_components/person-select-with-create.tsx.ejs +1 -0
  22. package/hedhog/frontend/app/_components/project-assignments-tab.tsx.ejs +10 -218
  23. package/hedhog/frontend/app/_components/project-cost-report-screen.tsx.ejs +23 -23
  24. package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +24 -708
  25. package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +38 -158
  26. package/hedhog/frontend/app/_components/task-detail-sheet.tsx.ejs +1 -5
  27. package/hedhog/frontend/app/_components/task-form-sheet.tsx.ejs +629 -629
  28. package/hedhog/frontend/app/_lib/api.ts.ejs +0 -151
  29. package/hedhog/frontend/app/_lib/types.ts.ejs +0 -1
  30. package/hedhog/frontend/app/_lib/utils/task-ui.ts.ejs +0 -18
  31. package/hedhog/frontend/app/my-projects/page.tsx.ejs +2 -16
  32. package/hedhog/frontend/app/my-tasks/page.tsx.ejs +86 -24
  33. package/hedhog/frontend/app/projects/page.tsx.ejs +6 -42
  34. package/hedhog/frontend/messages/en.json +2 -96
  35. package/hedhog/frontend/messages/operations/operations/en.json +2100 -0
  36. package/hedhog/frontend/messages/operations/operations/pt.json +2111 -0
  37. package/hedhog/frontend/messages/pt.json +2 -96
  38. package/hedhog/frontend/widgets/capacity-distribution.tsx.ejs +16 -16
  39. package/hedhog/frontend/widgets/effort-by-project.tsx.ejs +16 -16
  40. package/hedhog/frontend/widgets/headcount-by-area.tsx.ejs +16 -16
  41. package/hedhog/frontend/widgets/index.ts.ejs +25 -25
  42. package/hedhog/frontend/widgets/managed-projects-status.tsx.ejs +16 -16
  43. package/hedhog/frontend/widgets/my-hours-period-kpi.tsx.ejs +16 -16
  44. package/hedhog/frontend/widgets/my-open-requests-kpi.tsx.ejs +16 -16
  45. package/hedhog/frontend/widgets/my-pending-requests-list.tsx.ejs +16 -16
  46. package/hedhog/frontend/widgets/my-project-allocations-kpi.tsx.ejs +16 -16
  47. package/hedhog/frontend/widgets/my-quick-actions.tsx.ejs +16 -16
  48. package/hedhog/frontend/widgets/my-relevant-deadlines.tsx.ejs +16 -16
  49. package/hedhog/frontend/widgets/my-timesheet-status-kpi.tsx.ejs +16 -16
  50. package/hedhog/frontend/widgets/my-weekly-journey.tsx.ejs +16 -16
  51. package/hedhog/frontend/widgets/portfolio-costs-kpi.tsx.ejs +16 -16
  52. package/hedhog/frontend/widgets/portfolio-effort-kpi.tsx.ejs +16 -16
  53. package/hedhog/frontend/widgets/portfolio-projects-kpi.tsx.ejs +16 -16
  54. package/hedhog/frontend/widgets/portfolio-risk-kpi.tsx.ejs +16 -16
  55. package/hedhog/frontend/widgets/project-status-overview.tsx.ejs +16 -16
  56. package/hedhog/frontend/widgets/shared-operations-widget.tsx.ejs +169 -169
  57. package/hedhog/frontend/widgets/strategic-deadlines.tsx.ejs +16 -16
  58. package/hedhog/frontend/widgets/team-approval-queue.tsx.ejs +16 -16
  59. package/hedhog/frontend/widgets/team-capacity-kpi.tsx.ejs +16 -16
  60. package/hedhog/frontend/widgets/team-headcount-kpi.tsx.ejs +16 -16
  61. package/hedhog/frontend/widgets/team-hours-kpi.tsx.ejs +16 -16
  62. package/hedhog/frontend/widgets/team-pending-approvals-kpi.tsx.ejs +16 -16
  63. package/hedhog/frontend/widgets/team-utilization-overview.tsx.ejs +16 -16
  64. package/hedhog/frontend/widgets/team-workload-alerts.tsx.ejs +16 -16
  65. package/hedhog/table/operations_collaborator.yaml +8 -8
  66. package/hedhog/table/operations_task.yaml +76 -76
  67. package/hedhog/table/operations_task_activity.yaml +51 -51
  68. package/package.json +6 -6
  69. package/src/controllers/operations-collaborators.controller.ts +8 -117
  70. package/src/controllers/operations-tasks.controller.ts +156 -156
  71. package/src/dashboard/widgets/MyQuickActions.tsx +22 -22
  72. package/src/dto/create-collaborator.dto.ts +4 -4
  73. package/src/operations.service.spec.ts +1006 -988
  74. package/src/operations.service.ts +7 -323
  75. package/dist/dto/create-collaborator-invoice.dto.d.ts +0 -11
  76. package/dist/dto/create-collaborator-invoice.dto.d.ts.map +0 -1
  77. package/dist/dto/create-collaborator-invoice.dto.js +0 -55
  78. package/dist/dto/create-collaborator-invoice.dto.js.map +0 -1
  79. package/dist/dto/create-collaborator-payment.dto.d.ts +0 -10
  80. package/dist/dto/create-collaborator-payment.dto.d.ts.map +0 -1
  81. package/dist/dto/create-collaborator-payment.dto.js +0 -50
  82. package/dist/dto/create-collaborator-payment.dto.js.map +0 -1
  83. package/dist/dto/list-collaborator-invoice.dto.d.ts +0 -4
  84. package/dist/dto/list-collaborator-invoice.dto.d.ts.map +0 -1
  85. package/dist/dto/list-collaborator-invoice.dto.js +0 -8
  86. package/dist/dto/list-collaborator-invoice.dto.js.map +0 -1
  87. package/dist/dto/list-collaborator-payment.dto.d.ts +0 -4
  88. package/dist/dto/list-collaborator-payment.dto.d.ts.map +0 -1
  89. package/dist/dto/list-collaborator-payment.dto.js +0 -8
  90. package/dist/dto/list-collaborator-payment.dto.js.map +0 -1
  91. package/dist/dto/update-collaborator-invoice.dto.d.ts +0 -6
  92. package/dist/dto/update-collaborator-invoice.dto.d.ts.map +0 -1
  93. package/dist/dto/update-collaborator-invoice.dto.js +0 -9
  94. package/dist/dto/update-collaborator-invoice.dto.js.map +0 -1
  95. package/dist/dto/update-collaborator-payment.dto.d.ts +0 -6
  96. package/dist/dto/update-collaborator-payment.dto.d.ts.map +0 -1
  97. package/dist/dto/update-collaborator-payment.dto.js +0 -9
  98. package/dist/dto/update-collaborator-payment.dto.js.map +0 -1
  99. package/hedhog/frontend/app/_components/collaborator-invoices-tab.tsx.ejs +0 -443
  100. package/hedhog/frontend/app/_components/collaborator-payment-history-tab.tsx.ejs +0 -429
  101. package/hedhog/frontend/app/tasks-gantt/page.tsx.ejs +0 -953
  102. package/hedhog/table/operations_collaborator_invoice.yaml +0 -35
  103. package/hedhog/table/operations_collaborator_payment.yaml +0 -32
  104. package/src/dto/create-collaborator-invoice.dto.ts +0 -39
  105. package/src/dto/create-collaborator-payment.dto.ts +0 -35
  106. package/src/dto/list-collaborator-invoice.dto.ts +0 -3
  107. package/src/dto/list-collaborator-payment.dto.ts +0 -3
  108. package/src/dto/update-collaborator-invoice.dto.ts +0 -6
  109. package/src/dto/update-collaborator-payment.dto.ts +0 -6
@@ -2695,265 +2695,6 @@ export class OperationsService {
2695
2695
  );
2696
2696
  }
2697
2697
 
2698
- async getCollaboratorPaymentHistory(
2699
- userId: number,
2700
- collaboratorId: number,
2701
- ) {
2702
- const actor = await this.getActorContext(userId);
2703
- this.ensureDirector(actor);
2704
- await this.getCollaboratorById(collaboratorId);
2705
-
2706
- const rows = await this.prisma.operations_collaborator_payment.findMany({
2707
- where: { collaborator_id: collaboratorId },
2708
- orderBy: { payment_date: 'desc' },
2709
- });
2710
-
2711
- return rows.map((r) => ({
2712
- id: r.id,
2713
- collaboratorId: r.collaborator_id,
2714
- amount: r.amount.toString(),
2715
- paymentDate: r.payment_date,
2716
- referenceMonth: r.reference_month,
2717
- paymentMethod: r.payment_method,
2718
- notes: r.notes,
2719
- createdAt: r.created_at,
2720
- }));
2721
- }
2722
-
2723
- async getCollaboratorInvoices(
2724
- userId: number,
2725
- collaboratorId: number,
2726
- ) {
2727
- const actor = await this.getActorContext(userId);
2728
- this.ensureDirector(actor);
2729
- await this.getCollaboratorById(collaboratorId);
2730
-
2731
- const rows = await this.prisma.operations_collaborator_invoice.findMany({
2732
- where: { collaborator_id: collaboratorId },
2733
- orderBy: { issue_date: 'desc' },
2734
- });
2735
-
2736
- return rows.map((r) => ({
2737
- id: r.id,
2738
- collaboratorId: r.collaborator_id,
2739
- invoiceNumber: r.invoice_number,
2740
- amount: r.amount.toString(),
2741
- issueDate: r.issue_date,
2742
- dueDate: r.due_date,
2743
- status: r.status,
2744
- description: r.description,
2745
- createdAt: r.created_at,
2746
- }));
2747
- }
2748
-
2749
- async createCollaboratorPayment(
2750
- userId: number,
2751
- collaboratorId: number,
2752
- data: {
2753
- amount: number;
2754
- paymentDate: string;
2755
- referenceMonth?: string | null;
2756
- paymentMethod?: string;
2757
- notes?: string | null;
2758
- },
2759
- ) {
2760
- const actor = await this.getActorContext(userId);
2761
- this.ensureDirector(actor);
2762
- await this.getCollaboratorById(collaboratorId);
2763
-
2764
- const created = await this.prisma.operations_collaborator_payment.create({
2765
- data: {
2766
- collaborator_id: collaboratorId,
2767
- amount: data.amount,
2768
- payment_date: new Date(data.paymentDate),
2769
- reference_month: data.referenceMonth ?? null,
2770
- payment_method: (data.paymentMethod ?? 'pix') as any,
2771
- notes: data.notes ?? null,
2772
- },
2773
- });
2774
-
2775
- return {
2776
- id: created.id,
2777
- collaboratorId: created.collaborator_id,
2778
- amount: created.amount.toString(),
2779
- paymentDate: created.payment_date,
2780
- referenceMonth: created.reference_month,
2781
- paymentMethod: created.payment_method,
2782
- notes: created.notes,
2783
- createdAt: created.created_at,
2784
- };
2785
- }
2786
-
2787
- async updateCollaboratorPayment(
2788
- userId: number,
2789
- collaboratorId: number,
2790
- paymentId: number,
2791
- data: Partial<{
2792
- amount: number;
2793
- paymentDate: string;
2794
- referenceMonth: string | null;
2795
- paymentMethod: string;
2796
- notes: string | null;
2797
- }>,
2798
- ) {
2799
- const actor = await this.getActorContext(userId);
2800
- this.ensureDirector(actor);
2801
-
2802
- const payment = await this.prisma.operations_collaborator_payment.findFirst({
2803
- where: { id: paymentId, collaborator_id: collaboratorId },
2804
- });
2805
- if (!payment) throw new NotFoundException('Payment record not found.');
2806
-
2807
- const updated = await this.prisma.operations_collaborator_payment.update({
2808
- where: { id: paymentId },
2809
- data: {
2810
- ...(data.amount !== undefined && { amount: data.amount }),
2811
- ...(data.paymentDate !== undefined && { payment_date: new Date(data.paymentDate) }),
2812
- ...('referenceMonth' in data && { reference_month: data.referenceMonth }),
2813
- ...(data.paymentMethod !== undefined && { payment_method: data.paymentMethod as any }),
2814
- ...('notes' in data && { notes: data.notes }),
2815
- },
2816
- });
2817
-
2818
- return {
2819
- id: updated.id,
2820
- collaboratorId: updated.collaborator_id,
2821
- amount: updated.amount.toString(),
2822
- paymentDate: updated.payment_date,
2823
- referenceMonth: updated.reference_month,
2824
- paymentMethod: updated.payment_method,
2825
- notes: updated.notes,
2826
- createdAt: updated.created_at,
2827
- };
2828
- }
2829
-
2830
- async deleteCollaboratorPayment(
2831
- userId: number,
2832
- collaboratorId: number,
2833
- paymentId: number,
2834
- ) {
2835
- const actor = await this.getActorContext(userId);
2836
- this.ensureDirector(actor);
2837
-
2838
- const payment = await this.prisma.operations_collaborator_payment.findFirst({
2839
- where: { id: paymentId, collaborator_id: collaboratorId },
2840
- });
2841
- if (!payment) throw new NotFoundException('Payment record not found.');
2842
-
2843
- await this.prisma.operations_collaborator_payment.delete({
2844
- where: { id: paymentId },
2845
- });
2846
-
2847
- return { success: true };
2848
- }
2849
-
2850
- async createCollaboratorInvoice(
2851
- userId: number,
2852
- collaboratorId: number,
2853
- data: {
2854
- invoiceNumber?: string | null;
2855
- amount: number;
2856
- issueDate: string;
2857
- dueDate?: string | null;
2858
- status?: string;
2859
- description?: string | null;
2860
- },
2861
- ) {
2862
- const actor = await this.getActorContext(userId);
2863
- this.ensureDirector(actor);
2864
- await this.getCollaboratorById(collaboratorId);
2865
-
2866
- const created = await this.prisma.operations_collaborator_invoice.create({
2867
- data: {
2868
- collaborator_id: collaboratorId,
2869
- invoice_number: data.invoiceNumber ?? null,
2870
- amount: data.amount,
2871
- issue_date: new Date(data.issueDate),
2872
- due_date: data.dueDate ? new Date(data.dueDate) : null,
2873
- status: (data.status ?? 'pending') as any,
2874
- description: data.description ?? null,
2875
- },
2876
- });
2877
-
2878
- return {
2879
- id: created.id,
2880
- collaboratorId: created.collaborator_id,
2881
- invoiceNumber: created.invoice_number,
2882
- amount: created.amount.toString(),
2883
- issueDate: created.issue_date,
2884
- dueDate: created.due_date,
2885
- status: created.status,
2886
- description: created.description,
2887
- createdAt: created.created_at,
2888
- };
2889
- }
2890
-
2891
- async updateCollaboratorInvoice(
2892
- userId: number,
2893
- collaboratorId: number,
2894
- invoiceId: number,
2895
- data: Partial<{
2896
- invoiceNumber: string | null;
2897
- amount: number;
2898
- issueDate: string;
2899
- dueDate: string | null;
2900
- status: string;
2901
- description: string | null;
2902
- }>,
2903
- ) {
2904
- const actor = await this.getActorContext(userId);
2905
- this.ensureDirector(actor);
2906
-
2907
- const invoice = await this.prisma.operations_collaborator_invoice.findFirst({
2908
- where: { id: invoiceId, collaborator_id: collaboratorId },
2909
- });
2910
- if (!invoice) throw new NotFoundException('Invoice not found.');
2911
-
2912
- const updated = await this.prisma.operations_collaborator_invoice.update({
2913
- where: { id: invoiceId },
2914
- data: {
2915
- ...('invoiceNumber' in data && { invoice_number: data.invoiceNumber }),
2916
- ...(data.amount !== undefined && { amount: data.amount }),
2917
- ...(data.issueDate !== undefined && { issue_date: new Date(data.issueDate) }),
2918
- ...('dueDate' in data && { due_date: data.dueDate ? new Date(data.dueDate) : null }),
2919
- ...(data.status !== undefined && { status: data.status as any }),
2920
- ...('description' in data && { description: data.description }),
2921
- },
2922
- });
2923
-
2924
- return {
2925
- id: updated.id,
2926
- collaboratorId: updated.collaborator_id,
2927
- invoiceNumber: updated.invoice_number,
2928
- amount: updated.amount.toString(),
2929
- issueDate: updated.issue_date,
2930
- dueDate: updated.due_date,
2931
- status: updated.status,
2932
- description: updated.description,
2933
- createdAt: updated.created_at,
2934
- };
2935
- }
2936
-
2937
- async deleteCollaboratorInvoice(
2938
- userId: number,
2939
- collaboratorId: number,
2940
- invoiceId: number,
2941
- ) {
2942
- const actor = await this.getActorContext(userId);
2943
- this.ensureDirector(actor);
2944
-
2945
- const invoice = await this.prisma.operations_collaborator_invoice.findFirst({
2946
- where: { id: invoiceId, collaborator_id: collaboratorId },
2947
- });
2948
- if (!invoice) throw new NotFoundException('Invoice not found.');
2949
-
2950
- await this.prisma.operations_collaborator_invoice.delete({
2951
- where: { id: invoiceId },
2952
- });
2953
-
2954
- return { success: true };
2955
- }
2956
-
2957
2698
  async listDepartments(
2958
2699
  userId: number,
2959
2700
  filters: {
@@ -3377,17 +3118,6 @@ export class OperationsService {
3377
3118
  AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
3378
3119
  LIMIT 1)
3379
3120
  ) AS "clientAvatarId",
3380
- COALESCE(
3381
- client_user.photo_id,
3382
- (SELECT u2.photo_id
3383
- FROM person p2
3384
- JOIN person_user pu2 ON pu2.person_id = p2.id
3385
- JOIN "user" u2 ON u2.id = pu2.user_id
3386
- WHERE p.client_person_id IS NULL
3387
- AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
3388
- ORDER BY pu2.id ASC
3389
- LIMIT 1)
3390
- ) AS "clientUserPhotoId",
3391
3121
  p.summary,
3392
3122
  p.status,
3393
3123
  p.progress_percent AS "progressPercent",
@@ -3405,21 +3135,13 @@ export class OperationsService {
3405
3135
  LEFT JOIN operations_contract c ON c.id = p.contract_id
3406
3136
  LEFT JOIN operations_collaborator m ON m.id = p.manager_collaborator_id
3407
3137
  LEFT JOIN person cp ON cp.id = p.client_person_id
3408
- LEFT JOIN LATERAL (
3409
- SELECT u.photo_id
3410
- FROM person_user pu
3411
- JOIN "user" u ON u.id = pu.user_id
3412
- WHERE pu.person_id = p.client_person_id
3413
- ORDER BY pu.id ASC
3414
- LIMIT 1
3415
- ) client_user ON TRUE
3416
3138
  LEFT JOIN person mp ON mp.id = m.person_id
3417
3139
  LEFT JOIN operations_project_assignment pa
3418
3140
  ON pa.project_id = p.id
3419
3141
  AND pa.deleted_at IS NULL
3420
3142
  AND pa.status IN ('planned', 'active')
3421
3143
  WHERE ${whereClause}
3422
- GROUP BY p.id, c.id, m.id, cp.id, mp.id, client_user.photo_id`;
3144
+ GROUP BY p.id, c.id, m.id, cp.id, mp.id`;
3423
3145
 
3424
3146
  if (!pagination) {
3425
3147
  return this.queryRows(`${baseQuery} ORDER BY p.name ASC`, params);
@@ -8915,17 +8637,6 @@ export class OperationsService {
8915
8637
  AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
8916
8638
  LIMIT 1)
8917
8639
  ) AS "clientAvatarId",
8918
- COALESCE(
8919
- client_user.photo_id,
8920
- (SELECT u2.photo_id
8921
- FROM person p2
8922
- JOIN person_user pu2 ON pu2.person_id = p2.id
8923
- JOIN "user" u2 ON u2.id = pu2.user_id
8924
- WHERE p.client_person_id IS NULL
8925
- AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
8926
- ORDER BY pu2.id ASC
8927
- LIMIT 1)
8928
- ) AS "clientUserPhotoId",
8929
8640
  p.code,
8930
8641
  p.name,
8931
8642
  p.client_name AS "clientName",
@@ -8947,14 +8658,6 @@ export class OperationsService {
8947
8658
  LEFT JOIN operations_contract c ON c.id = p.contract_id
8948
8659
  LEFT JOIN operations_collaborator m ON m.id = p.manager_collaborator_id
8949
8660
  LEFT JOIN person client_person ON client_person.id = p.client_person_id
8950
- LEFT JOIN LATERAL (
8951
- SELECT u.photo_id
8952
- FROM person_user pu
8953
- JOIN "user" u ON u.id = pu.user_id
8954
- WHERE pu.person_id = p.client_person_id
8955
- ORDER BY pu.id ASC
8956
- LIMIT 1
8957
- ) client_user ON TRUE
8958
8661
  LEFT JOIN operations_project_assignment pa
8959
8662
  ON pa.project_id = p.id
8960
8663
  AND pa.deleted_at IS NULL
@@ -8970,7 +8673,7 @@ export class OperationsService {
8970
8673
  ) project_role_locale ON TRUE
8971
8674
  WHERE p.id = $1
8972
8675
  AND p.deleted_at IS NULL
8973
- GROUP BY p.id, c.id, m.id, client_person.id, client_user.photo_id`,
8676
+ GROUP BY p.id, c.id, m.id, client_person.id`,
8974
8677
  [projectId, actorCollaboratorId ?? null],
8975
8678
  );
8976
8679
 
@@ -9740,9 +9443,9 @@ export class OperationsService {
9740
9443
  ) VALUES (
9741
9444
  $1,
9742
9445
  $2,
9743
- $3::operations_task_activity_action_bd50457330_enum,
9744
- $4::operations_task_activity_from_status_3a69262de6_enum,
9745
- $5::operations_task_activity_to_status_1fd99321c8_enum,
9446
+ $3::"operations_task_activity_action_bd50457330_enum",
9447
+ $4::"operations_task_activity_from_status_3a69262de6_enum",
9448
+ $5::"operations_task_activity_to_status_1fd99321c8_enum",
9746
9449
  NOW()
9747
9450
  )`,
9748
9451
  params.taskId,
@@ -10753,7 +10456,7 @@ export class OperationsService {
10753
10456
  created_at,
10754
10457
  updated_at
10755
10458
  ) VALUES (
10756
- $1, $2, $3, $4, $5::numeric, $6::numeric, $7::date, $8::date,
10459
+ $1, $2, $3, $4, $5, $6, $7::date, $8::date,
10757
10460
  $9::operations_project_assignment_status_155b459bbf_enum,
10758
10461
  NOW(), NOW()
10759
10462
  )`,
@@ -12853,17 +12556,6 @@ export class OperationsService {
12853
12556
  AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
12854
12557
  LIMIT 1)
12855
12558
  ) AS "clientAvatarId",
12856
- COALESCE(
12857
- client_user.photo_id,
12858
- (SELECT u2.photo_id
12859
- FROM person p2
12860
- JOIN person_user pu2 ON pu2.person_id = p2.id
12861
- JOIN "user" u2 ON u2.id = pu2.user_id
12862
- WHERE p.client_person_id IS NULL
12863
- AND LOWER(TRIM(p2.name)) = LOWER(TRIM(p.client_name))
12864
- ORDER BY pu2.id ASC
12865
- LIMIT 1)
12866
- ) AS "clientUserPhotoId",
12867
12559
  p.summary,
12868
12560
  p.status,
12869
12561
  p.progress_percent AS "progressPercent",
@@ -12877,20 +12569,12 @@ export class OperationsService {
12877
12569
  LEFT JOIN operations_contract c ON c.id = p.contract_id
12878
12570
  LEFT JOIN operations_collaborator m ON m.id = p.manager_collaborator_id
12879
12571
  LEFT JOIN person cp ON cp.id = p.client_person_id
12880
- LEFT JOIN LATERAL (
12881
- SELECT u.photo_id
12882
- FROM person_user pu
12883
- JOIN "user" u ON u.id = pu.user_id
12884
- WHERE pu.person_id = p.client_person_id
12885
- ORDER BY pu.id ASC
12886
- LIMIT 1
12887
- ) client_user ON TRUE
12888
12572
  LEFT JOIN operations_project_assignment pa
12889
12573
  ON pa.project_id = p.id
12890
12574
  AND pa.deleted_at IS NULL
12891
12575
  AND pa.status IN ('planned', 'active')
12892
12576
  WHERE ${whereClause}
12893
- GROUP BY p.id, c.id, m.id, cp.id, client_user.photo_id`;
12577
+ GROUP BY p.id, c.id, m.id, cp.id`;
12894
12578
 
12895
12579
  if (!pagination) {
12896
12580
  return this.queryRows(`${baseQuery} ORDER BY p.name ASC`, params);
@@ -1,11 +0,0 @@
1
- export declare const INVOICE_STATUS_VALUES: readonly ["pending", "paid", "cancelled", "overdue"];
2
- export type InvoiceStatus = (typeof INVOICE_STATUS_VALUES)[number];
3
- export declare class CreateCollaboratorInvoiceDto {
4
- invoiceNumber?: string | null;
5
- amount: number;
6
- issueDate: string;
7
- dueDate?: string | null;
8
- status?: InvoiceStatus;
9
- description?: string | null;
10
- }
11
- //# sourceMappingURL=create-collaborator-invoice.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-collaborator-invoice.dto.d.ts","sourceRoot":"","sources":["../../src/dto/create-collaborator-invoice.dto.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,sDAKxB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,qBAAa,4BAA4B;IAIvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAO9B,MAAM,EAAG,MAAM,CAAC;IAGhB,SAAS,EAAG,MAAM,CAAC;IAInB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAIxB,MAAM,CAAC,EAAE,aAAa,CAAC;IAIvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateCollaboratorInvoiceDto = exports.INVOICE_STATUS_VALUES = void 0;
13
- const class_transformer_1 = require("class-transformer");
14
- const class_validator_1 = require("class-validator");
15
- exports.INVOICE_STATUS_VALUES = [
16
- 'pending',
17
- 'paid',
18
- 'cancelled',
19
- 'overdue',
20
- ];
21
- class CreateCollaboratorInvoiceDto {
22
- }
23
- exports.CreateCollaboratorInvoiceDto = CreateCollaboratorInvoiceDto;
24
- __decorate([
25
- (0, class_validator_1.IsOptional)(),
26
- (0, class_validator_1.IsString)(),
27
- (0, class_validator_1.MaxLength)(50),
28
- __metadata("design:type", String)
29
- ], CreateCollaboratorInvoiceDto.prototype, "invoiceNumber", void 0);
30
- __decorate([
31
- (0, class_transformer_1.Transform)(({ value }) => value === '' || value === undefined || value === null ? undefined : Number(value)),
32
- (0, class_validator_1.IsNumber)(),
33
- (0, class_validator_1.Min)(0),
34
- __metadata("design:type", Number)
35
- ], CreateCollaboratorInvoiceDto.prototype, "amount", void 0);
36
- __decorate([
37
- (0, class_validator_1.IsString)(),
38
- __metadata("design:type", String)
39
- ], CreateCollaboratorInvoiceDto.prototype, "issueDate", void 0);
40
- __decorate([
41
- (0, class_validator_1.IsOptional)(),
42
- (0, class_validator_1.IsString)(),
43
- __metadata("design:type", String)
44
- ], CreateCollaboratorInvoiceDto.prototype, "dueDate", void 0);
45
- __decorate([
46
- (0, class_validator_1.IsOptional)(),
47
- (0, class_validator_1.IsIn)(exports.INVOICE_STATUS_VALUES),
48
- __metadata("design:type", String)
49
- ], CreateCollaboratorInvoiceDto.prototype, "status", void 0);
50
- __decorate([
51
- (0, class_validator_1.IsOptional)(),
52
- (0, class_validator_1.IsString)(),
53
- __metadata("design:type", String)
54
- ], CreateCollaboratorInvoiceDto.prototype, "description", void 0);
55
- //# sourceMappingURL=create-collaborator-invoice.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-collaborator-invoice.dto.js","sourceRoot":"","sources":["../../src/dto/create-collaborator-invoice.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,qDAAuF;AAE1E,QAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;CACD,CAAC;AAGX,MAAa,4BAA4B;CA2BxC;AA3BD,oEA2BC;AAvBC;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,EAAE,CAAC;;mEACgB;AAO9B;IALC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAClF;IACA,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAG,EAAC,CAAC,CAAC;;4DACS;AAGhB;IADC,IAAA,0BAAQ,GAAE;;+DACQ;AAInB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;6DACa;AAIxB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,6BAAqB,CAAC;;4DACL;AAIvB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iEACiB"}
@@ -1,10 +0,0 @@
1
- export declare const PAYMENT_METHOD_VALUES: readonly ["bank_transfer", "pix", "check", "other"];
2
- export type PaymentMethod = (typeof PAYMENT_METHOD_VALUES)[number];
3
- export declare class CreateCollaboratorPaymentDto {
4
- amount: number;
5
- paymentDate: string;
6
- referenceMonth?: string | null;
7
- paymentMethod?: PaymentMethod;
8
- notes?: string | null;
9
- }
10
- //# sourceMappingURL=create-collaborator-payment.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-collaborator-payment.dto.d.ts","sourceRoot":"","sources":["../../src/dto/create-collaborator-payment.dto.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,qDAKxB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,qBAAa,4BAA4B;IAMvC,MAAM,EAAG,MAAM,CAAC;IAGhB,WAAW,EAAG,MAAM,CAAC;IAKrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAI9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateCollaboratorPaymentDto = exports.PAYMENT_METHOD_VALUES = void 0;
13
- const class_transformer_1 = require("class-transformer");
14
- const class_validator_1 = require("class-validator");
15
- exports.PAYMENT_METHOD_VALUES = [
16
- 'bank_transfer',
17
- 'pix',
18
- 'check',
19
- 'other',
20
- ];
21
- class CreateCollaboratorPaymentDto {
22
- }
23
- exports.CreateCollaboratorPaymentDto = CreateCollaboratorPaymentDto;
24
- __decorate([
25
- (0, class_transformer_1.Transform)(({ value }) => value === '' || value === undefined || value === null ? undefined : Number(value)),
26
- (0, class_validator_1.IsNumber)(),
27
- (0, class_validator_1.Min)(0),
28
- __metadata("design:type", Number)
29
- ], CreateCollaboratorPaymentDto.prototype, "amount", void 0);
30
- __decorate([
31
- (0, class_validator_1.IsString)(),
32
- __metadata("design:type", String)
33
- ], CreateCollaboratorPaymentDto.prototype, "paymentDate", void 0);
34
- __decorate([
35
- (0, class_validator_1.IsOptional)(),
36
- (0, class_validator_1.IsString)(),
37
- (0, class_validator_1.MaxLength)(7),
38
- __metadata("design:type", String)
39
- ], CreateCollaboratorPaymentDto.prototype, "referenceMonth", void 0);
40
- __decorate([
41
- (0, class_validator_1.IsOptional)(),
42
- (0, class_validator_1.IsIn)(exports.PAYMENT_METHOD_VALUES),
43
- __metadata("design:type", String)
44
- ], CreateCollaboratorPaymentDto.prototype, "paymentMethod", void 0);
45
- __decorate([
46
- (0, class_validator_1.IsOptional)(),
47
- (0, class_validator_1.IsString)(),
48
- __metadata("design:type", String)
49
- ], CreateCollaboratorPaymentDto.prototype, "notes", void 0);
50
- //# sourceMappingURL=create-collaborator-payment.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-collaborator-payment.dto.js","sourceRoot":"","sources":["../../src/dto/create-collaborator-payment.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,qDAAuF;AAE1E,QAAA,qBAAqB,GAAG;IACnC,eAAe;IACf,KAAK;IACL,OAAO;IACP,OAAO;CACC,CAAC;AAGX,MAAa,4BAA4B;CAuBxC;AAvBD,oEAuBC;AAjBC;IALC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAClF;IACA,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAG,EAAC,CAAC,CAAC;;4DACS;AAGhB;IADC,IAAA,0BAAQ,GAAE;;iEACU;AAKrB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;oEACkB;AAI/B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,6BAAqB,CAAC;;mEACE;AAI9B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2DACW"}
@@ -1,4 +0,0 @@
1
- import { PaginationDTO } from '@hed-hog/api-pagination';
2
- export declare class ListCollaboratorInvoiceDto extends PaginationDTO {
3
- }
4
- //# sourceMappingURL=list-collaborator-invoice.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-collaborator-invoice.dto.d.ts","sourceRoot":"","sources":["../../src/dto/list-collaborator-invoice.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,qBAAa,0BAA2B,SAAQ,aAAa;CAAG"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListCollaboratorInvoiceDto = void 0;
4
- const api_pagination_1 = require("@hed-hog/api-pagination");
5
- class ListCollaboratorInvoiceDto extends api_pagination_1.PaginationDTO {
6
- }
7
- exports.ListCollaboratorInvoiceDto = ListCollaboratorInvoiceDto;
8
- //# sourceMappingURL=list-collaborator-invoice.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-collaborator-invoice.dto.js","sourceRoot":"","sources":["../../src/dto/list-collaborator-invoice.dto.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,MAAa,0BAA2B,SAAQ,8BAAa;CAAG;AAAhE,gEAAgE"}
@@ -1,4 +0,0 @@
1
- import { PaginationDTO } from '@hed-hog/api-pagination';
2
- export declare class ListCollaboratorPaymentDto extends PaginationDTO {
3
- }
4
- //# sourceMappingURL=list-collaborator-payment.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-collaborator-payment.dto.d.ts","sourceRoot":"","sources":["../../src/dto/list-collaborator-payment.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,qBAAa,0BAA2B,SAAQ,aAAa;CAAG"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListCollaboratorPaymentDto = void 0;
4
- const api_pagination_1 = require("@hed-hog/api-pagination");
5
- class ListCollaboratorPaymentDto extends api_pagination_1.PaginationDTO {
6
- }
7
- exports.ListCollaboratorPaymentDto = ListCollaboratorPaymentDto;
8
- //# sourceMappingURL=list-collaborator-payment.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-collaborator-payment.dto.js","sourceRoot":"","sources":["../../src/dto/list-collaborator-payment.dto.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,MAAa,0BAA2B,SAAQ,8BAAa;CAAG;AAAhE,gEAAgE"}
@@ -1,6 +0,0 @@
1
- import { CreateCollaboratorInvoiceDto } from './create-collaborator-invoice.dto';
2
- declare const UpdateCollaboratorInvoiceDto_base: import("@nestjs/mapped-types").MappedType<Partial<CreateCollaboratorInvoiceDto>>;
3
- export declare class UpdateCollaboratorInvoiceDto extends UpdateCollaboratorInvoiceDto_base {
4
- }
5
- export {};
6
- //# sourceMappingURL=update-collaborator-invoice.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-collaborator-invoice.dto.d.ts","sourceRoot":"","sources":["../../src/dto/update-collaborator-invoice.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;;AAEjF,qBAAa,4BAA6B,SAAQ,iCAEjD;CAAG"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateCollaboratorInvoiceDto = void 0;
4
- const mapped_types_1 = require("@nestjs/mapped-types");
5
- const create_collaborator_invoice_dto_1 = require("./create-collaborator-invoice.dto");
6
- class UpdateCollaboratorInvoiceDto extends (0, mapped_types_1.PartialType)(create_collaborator_invoice_dto_1.CreateCollaboratorInvoiceDto) {
7
- }
8
- exports.UpdateCollaboratorInvoiceDto = UpdateCollaboratorInvoiceDto;
9
- //# sourceMappingURL=update-collaborator-invoice.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-collaborator-invoice.dto.js","sourceRoot":"","sources":["../../src/dto/update-collaborator-invoice.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,uFAAiF;AAEjF,MAAa,4BAA6B,SAAQ,IAAA,0BAAW,EAC3D,8DAA4B,CAC7B;CAAG;AAFJ,oEAEI"}
@@ -1,6 +0,0 @@
1
- import { CreateCollaboratorPaymentDto } from './create-collaborator-payment.dto';
2
- declare const UpdateCollaboratorPaymentDto_base: import("@nestjs/mapped-types").MappedType<Partial<CreateCollaboratorPaymentDto>>;
3
- export declare class UpdateCollaboratorPaymentDto extends UpdateCollaboratorPaymentDto_base {
4
- }
5
- export {};
6
- //# sourceMappingURL=update-collaborator-payment.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-collaborator-payment.dto.d.ts","sourceRoot":"","sources":["../../src/dto/update-collaborator-payment.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;;AAEjF,qBAAa,4BAA6B,SAAQ,iCAEjD;CAAG"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateCollaboratorPaymentDto = void 0;
4
- const mapped_types_1 = require("@nestjs/mapped-types");
5
- const create_collaborator_payment_dto_1 = require("./create-collaborator-payment.dto");
6
- class UpdateCollaboratorPaymentDto extends (0, mapped_types_1.PartialType)(create_collaborator_payment_dto_1.CreateCollaboratorPaymentDto) {
7
- }
8
- exports.UpdateCollaboratorPaymentDto = UpdateCollaboratorPaymentDto;
9
- //# sourceMappingURL=update-collaborator-payment.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-collaborator-payment.dto.js","sourceRoot":"","sources":["../../src/dto/update-collaborator-payment.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,uFAAiF;AAEjF,MAAa,4BAA6B,SAAQ,IAAA,0BAAW,EAC3D,8DAA4B,CAC7B;CAAG;AAFJ,oEAEI"}