@hed-hog/operations 0.0.338 → 0.0.347
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/dist/controllers/operations-collaborators.controller.d.ts +73 -0
- package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
- package/dist/controllers/operations-collaborators.controller.js +100 -0
- package/dist/controllers/operations-collaborators.controller.js.map +1 -1
- package/dist/controllers/operations-contracts.controller.d.ts +12 -12
- package/dist/controllers/operations-projects.controller.d.ts +3 -0
- package/dist/controllers/operations-projects.controller.d.ts.map +1 -1
- package/dist/dto/create-collaborator-invoice.dto.d.ts +11 -0
- package/dist/dto/create-collaborator-invoice.dto.d.ts.map +1 -0
- package/dist/dto/create-collaborator-invoice.dto.js +55 -0
- package/dist/dto/create-collaborator-invoice.dto.js.map +1 -0
- package/dist/dto/create-collaborator-payment.dto.d.ts +10 -0
- package/dist/dto/create-collaborator-payment.dto.d.ts.map +1 -0
- package/dist/dto/create-collaborator-payment.dto.js +50 -0
- package/dist/dto/create-collaborator-payment.dto.js.map +1 -0
- package/dist/dto/list-collaborator-invoice.dto.d.ts +4 -0
- package/dist/dto/list-collaborator-invoice.dto.d.ts.map +1 -0
- package/dist/dto/list-collaborator-invoice.dto.js +8 -0
- package/dist/dto/list-collaborator-invoice.dto.js.map +1 -0
- package/dist/dto/list-collaborator-payment.dto.d.ts +4 -0
- package/dist/dto/list-collaborator-payment.dto.d.ts.map +1 -0
- package/dist/dto/list-collaborator-payment.dto.js +8 -0
- package/dist/dto/list-collaborator-payment.dto.js.map +1 -0
- package/dist/dto/update-collaborator-invoice.dto.d.ts +6 -0
- package/dist/dto/update-collaborator-invoice.dto.d.ts.map +1 -0
- package/dist/dto/update-collaborator-invoice.dto.js +9 -0
- package/dist/dto/update-collaborator-invoice.dto.js.map +1 -0
- package/dist/dto/update-collaborator-payment.dto.d.ts +6 -0
- package/dist/dto/update-collaborator-payment.dto.d.ts.map +1 -0
- package/dist/dto/update-collaborator-payment.dto.js +9 -0
- package/dist/dto/update-collaborator-payment.dto.js.map +1 -0
- package/dist/operations.service.d.ts +98 -0
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +240 -17
- package/dist/operations.service.js.map +1 -1
- package/hedhog/data/menu.yaml +32 -11
- package/hedhog/data/route.yaml +72 -0
- package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +38 -0
- package/hedhog/frontend/app/_components/collaborator-invoices-tab.tsx.ejs +443 -0
- package/hedhog/frontend/app/_components/collaborator-payment-history-tab.tsx.ejs +429 -0
- package/hedhog/frontend/app/_components/project-assignments-tab.tsx.ejs +212 -10
- package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +673 -16
- package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +192 -38
- package/hedhog/frontend/app/_components/task-detail-sheet.tsx.ejs +28 -7
- package/hedhog/frontend/app/_lib/api.ts.ejs +151 -0
- package/hedhog/frontend/app/_lib/types.ts.ejs +1 -0
- package/hedhog/frontend/app/_lib/utils/task-ui.ts.ejs +18 -0
- package/hedhog/frontend/app/tasks-gantt/page.tsx.ejs +953 -0
- package/hedhog/frontend/messages/en.json +96 -2
- package/hedhog/frontend/messages/pt.json +96 -2
- package/hedhog/table/operations_collaborator_invoice.yaml +35 -0
- package/hedhog/table/operations_collaborator_payment.yaml +32 -0
- package/package.json +5 -5
- package/src/controllers/operations-collaborators.controller.ts +109 -0
- package/src/dto/create-collaborator-invoice.dto.ts +39 -0
- package/src/dto/create-collaborator-payment.dto.ts +35 -0
- package/src/dto/list-collaborator-invoice.dto.ts +3 -0
- package/src/dto/list-collaborator-payment.dto.ts +3 -0
- package/src/dto/update-collaborator-invoice.dto.ts +6 -0
- package/src/dto/update-collaborator-payment.dto.ts +6 -0
- package/src/operations.service.ts +332 -18
|
@@ -306,7 +306,11 @@
|
|
|
306
306
|
"projects": "Projects",
|
|
307
307
|
"tasks": "Tasks",
|
|
308
308
|
"timesheets": "Timesheets",
|
|
309
|
-
"salary": "Compensation"
|
|
309
|
+
"salary": "Compensation",
|
|
310
|
+
"paymentHistory": "Payment History",
|
|
311
|
+
"paymentHistoryEmpty": "No payment records found for this collaborator.",
|
|
312
|
+
"invoices": "Invoices",
|
|
313
|
+
"invoicesEmpty": "No invoices have been submitted by this collaborator yet."
|
|
310
314
|
},
|
|
311
315
|
"sections": {
|
|
312
316
|
"basicInfo": "Basic info",
|
|
@@ -341,6 +345,7 @@
|
|
|
341
345
|
"collaboratorType": "Relationship type",
|
|
342
346
|
"collaboratorTypeDescription": "Select the nature of the relationship with the company. Role and equity participation stay separate.",
|
|
343
347
|
"weeklyCapacityHours": "Weekly workload",
|
|
348
|
+
"hourlyRate": "Hourly rate",
|
|
344
349
|
"compensationAmount": "Compensation amount",
|
|
345
350
|
"contract": "Contract",
|
|
346
351
|
"contractPlaceholder": "Search or select a contract…",
|
|
@@ -417,7 +422,49 @@
|
|
|
417
422
|
"createSuccess": "Collaborator created successfully.",
|
|
418
423
|
"createError": "Unable to create the collaborator.",
|
|
419
424
|
"updateSuccess": "Collaborator updated successfully.",
|
|
420
|
-
"updateError": "Unable to update the collaborator."
|
|
425
|
+
"updateError": "Unable to update the collaborator.",
|
|
426
|
+
"saveSuccess": "Saved successfully.",
|
|
427
|
+
"saveError": "Unable to save. Please try again.",
|
|
428
|
+
"deleteSuccess": "Deleted successfully.",
|
|
429
|
+
"deleteError": "Unable to delete. Please try again."
|
|
430
|
+
},
|
|
431
|
+
"paymentHistory": {
|
|
432
|
+
"add": "Add payment",
|
|
433
|
+
"editTitle": "Edit payment",
|
|
434
|
+
"deleteConfirm": "Are you sure you want to delete this payment?",
|
|
435
|
+
"amount": "Amount",
|
|
436
|
+
"paymentDate": "Payment date",
|
|
437
|
+
"referenceMonth": "Reference month",
|
|
438
|
+
"paymentMethod": "Payment method",
|
|
439
|
+
"notes": "Notes",
|
|
440
|
+
"methodBankTransfer": "Bank transfer",
|
|
441
|
+
"methodPix": "Pix",
|
|
442
|
+
"methodCheck": "Check",
|
|
443
|
+
"methodOther": "Other"
|
|
444
|
+
},
|
|
445
|
+
"invoices": {
|
|
446
|
+
"add": "Add invoice",
|
|
447
|
+
"editTitle": "Edit invoice",
|
|
448
|
+
"deleteConfirm": "Are you sure you want to delete this invoice?",
|
|
449
|
+
"invoiceNumber": "Invoice number",
|
|
450
|
+
"amount": "Amount",
|
|
451
|
+
"issueDate": "Issue date",
|
|
452
|
+
"dueDate": "Due date",
|
|
453
|
+
"status": "Status",
|
|
454
|
+
"description": "Description",
|
|
455
|
+
"statusPending": "Pending",
|
|
456
|
+
"statusPaid": "Paid",
|
|
457
|
+
"statusCancelled": "Cancelled",
|
|
458
|
+
"statusOverdue": "Overdue"
|
|
459
|
+
},
|
|
460
|
+
"projectAllocation": {
|
|
461
|
+
"total": "Total allocation",
|
|
462
|
+
"idle": "Idle capacity",
|
|
463
|
+
"overloaded": "Overloaded",
|
|
464
|
+
"distributeEqually": "Distribute equally",
|
|
465
|
+
"autoRebalance": "Auto-rebalance",
|
|
466
|
+
"autoRebalanceDescription": "Automatically adjust other projects when editing allocation",
|
|
467
|
+
"distributing": "Distributing..."
|
|
421
468
|
},
|
|
422
469
|
"chart": {
|
|
423
470
|
"salaryHistory": "Salary history",
|
|
@@ -645,6 +692,47 @@
|
|
|
645
692
|
"done": "Done"
|
|
646
693
|
}
|
|
647
694
|
},
|
|
695
|
+
"TasksGanttPage": {
|
|
696
|
+
"title": "Tasks Gantt",
|
|
697
|
+
"description": "Track tasks from every active project on a single timeline.",
|
|
698
|
+
"breadcrumb": "Tasks Gantt",
|
|
699
|
+
"searchPlaceholder": "Search task, project, or assignee...",
|
|
700
|
+
"viewDescription": "Tasks from active projects grouped by project.",
|
|
701
|
+
"loading": "Building Gantt view...",
|
|
702
|
+
"emptyDescription": "No tasks were found for active projects with the current filters.",
|
|
703
|
+
"loadErrorDescription": "We couldn't load the schedule right now. Refresh to try again.",
|
|
704
|
+
"noAccessDescription": "The consolidated Gantt view is available only to supervisors and directors.",
|
|
705
|
+
"actions": {
|
|
706
|
+
"openProject": "Open project"
|
|
707
|
+
},
|
|
708
|
+
"filters": {
|
|
709
|
+
"allProjects": "All projects",
|
|
710
|
+
"allStatuses": "All statuses",
|
|
711
|
+
"clearDateRange": "Clear date range"
|
|
712
|
+
},
|
|
713
|
+
"cards": {
|
|
714
|
+
"activeProjects": "Active projects",
|
|
715
|
+
"activeProjectsDescription": "Active projects with tasks on the schedule.",
|
|
716
|
+
"tasks": "Scheduled tasks",
|
|
717
|
+
"tasksDescription": "Items shown with the current filters.",
|
|
718
|
+
"doing": "In progress",
|
|
719
|
+
"doingDescription": "Tasks currently being executed.",
|
|
720
|
+
"overdue": "Overdue",
|
|
721
|
+
"overdueDescription": "Open tasks with an expired due date."
|
|
722
|
+
},
|
|
723
|
+
"labels": {
|
|
724
|
+
"projectTask": "Project and task",
|
|
725
|
+
"range": "{from} through {to}",
|
|
726
|
+
"tasksCount": "{count} task(s)"
|
|
727
|
+
},
|
|
728
|
+
"legend": {
|
|
729
|
+
"todo": "To do",
|
|
730
|
+
"doing": "In progress",
|
|
731
|
+
"review": "In review",
|
|
732
|
+
"done": "Done",
|
|
733
|
+
"overdue": "Overdue"
|
|
734
|
+
}
|
|
735
|
+
},
|
|
648
736
|
"ProjectFormPage": {
|
|
649
737
|
"newTitle": "New Project",
|
|
650
738
|
"editTitle": "Edit Project",
|
|
@@ -950,6 +1038,12 @@
|
|
|
950
1038
|
"usedHours": "Used hours",
|
|
951
1039
|
"availability": "Availability",
|
|
952
1040
|
"overloadWarning": "{value}% above recommended capacity.",
|
|
1041
|
+
"addCollaborator": "Add collaborator",
|
|
1042
|
+
"addTitle": "Add collaborator",
|
|
1043
|
+
"editTitle": "Edit allocation",
|
|
1044
|
+
"formDescription": "Configure the collaborator's allocation data for this project.",
|
|
1045
|
+
"removeTitle": "Remove collaborator",
|
|
1046
|
+
"removeDescription": "Are you sure you want to remove this collaborator from the project?",
|
|
953
1047
|
"status": {
|
|
954
1048
|
"available": "Available",
|
|
955
1049
|
"high": "High load",
|
|
@@ -304,7 +304,11 @@
|
|
|
304
304
|
"projects": "Projetos",
|
|
305
305
|
"tasks": "Tarefas",
|
|
306
306
|
"timesheets": "Apontamentos",
|
|
307
|
-
"salary": "Remuneração"
|
|
307
|
+
"salary": "Remuneração",
|
|
308
|
+
"paymentHistory": "Histórico de Pagamentos",
|
|
309
|
+
"paymentHistoryEmpty": "Nenhum registro de pagamento encontrado para este colaborador.",
|
|
310
|
+
"invoices": "Notas Fiscais",
|
|
311
|
+
"invoicesEmpty": "Nenhuma nota fiscal enviada por este colaborador ainda."
|
|
308
312
|
},
|
|
309
313
|
"sections": {
|
|
310
314
|
"basicInfo": "Informações básicas",
|
|
@@ -339,6 +343,7 @@
|
|
|
339
343
|
"collaboratorType": "Tipo de colaborador",
|
|
340
344
|
"collaboratorTypeDescription": "Selecione a natureza da relação com a empresa. Função e participação societária permanecem separadas.",
|
|
341
345
|
"weeklyCapacityHours": "Carga horária semanal",
|
|
346
|
+
"hourlyRate": "Valor hora",
|
|
342
347
|
"compensationAmount": "Valor da remuneração",
|
|
343
348
|
"contract": "Contrato",
|
|
344
349
|
"contractPlaceholder": "Pesquisar ou selecionar contrato…",
|
|
@@ -415,7 +420,49 @@
|
|
|
415
420
|
"createSuccess": "Colaborador criado com sucesso.",
|
|
416
421
|
"createError": "Não foi possível criar o colaborador.",
|
|
417
422
|
"updateSuccess": "Colaborador atualizado com sucesso.",
|
|
418
|
-
"updateError": "Não foi possível atualizar o colaborador."
|
|
423
|
+
"updateError": "Não foi possível atualizar o colaborador.",
|
|
424
|
+
"saveSuccess": "Salvo com sucesso.",
|
|
425
|
+
"saveError": "Não foi possível salvar. Tente novamente.",
|
|
426
|
+
"deleteSuccess": "Excluído com sucesso.",
|
|
427
|
+
"deleteError": "Não foi possível excluir. Tente novamente."
|
|
428
|
+
},
|
|
429
|
+
"paymentHistory": {
|
|
430
|
+
"add": "Adicionar pagamento",
|
|
431
|
+
"editTitle": "Editar pagamento",
|
|
432
|
+
"deleteConfirm": "Tem certeza que deseja excluir este pagamento?",
|
|
433
|
+
"amount": "Valor",
|
|
434
|
+
"paymentDate": "Data do pagamento",
|
|
435
|
+
"referenceMonth": "Mês de referência",
|
|
436
|
+
"paymentMethod": "Forma de pagamento",
|
|
437
|
+
"notes": "Observações",
|
|
438
|
+
"methodBankTransfer": "Transferência bancária",
|
|
439
|
+
"methodPix": "Pix",
|
|
440
|
+
"methodCheck": "Cheque",
|
|
441
|
+
"methodOther": "Outro"
|
|
442
|
+
},
|
|
443
|
+
"invoices": {
|
|
444
|
+
"add": "Adicionar NF",
|
|
445
|
+
"editTitle": "Editar NF",
|
|
446
|
+
"deleteConfirm": "Tem certeza que deseja excluir esta nota fiscal?",
|
|
447
|
+
"invoiceNumber": "Número da NF",
|
|
448
|
+
"amount": "Valor",
|
|
449
|
+
"issueDate": "Data de emissão",
|
|
450
|
+
"dueDate": "Vencimento",
|
|
451
|
+
"status": "Status",
|
|
452
|
+
"description": "Descrição",
|
|
453
|
+
"statusPending": "Pendente",
|
|
454
|
+
"statusPaid": "Pago",
|
|
455
|
+
"statusCancelled": "Cancelado",
|
|
456
|
+
"statusOverdue": "Vencido"
|
|
457
|
+
},
|
|
458
|
+
"projectAllocation": {
|
|
459
|
+
"total": "Alocação total",
|
|
460
|
+
"idle": "Ociosidade",
|
|
461
|
+
"overloaded": "Sobrecarga",
|
|
462
|
+
"distributeEqually": "Distribuir igualmente",
|
|
463
|
+
"autoRebalance": "Auto-rebalancear",
|
|
464
|
+
"autoRebalanceDescription": "Ajustar automaticamente os outros projetos ao editar a alocação",
|
|
465
|
+
"distributing": "Distribuindo..."
|
|
419
466
|
},
|
|
420
467
|
"chart": {
|
|
421
468
|
"salaryHistory": "Histórico de salário",
|
|
@@ -643,6 +690,47 @@
|
|
|
643
690
|
"done": "Concluída"
|
|
644
691
|
}
|
|
645
692
|
},
|
|
693
|
+
"TasksGanttPage": {
|
|
694
|
+
"title": "Gantt de Tarefas",
|
|
695
|
+
"description": "Acompanhe tarefas de todos os projetos em execução em uma linha do tempo única.",
|
|
696
|
+
"breadcrumb": "Gantt de Tarefas",
|
|
697
|
+
"searchPlaceholder": "Buscar tarefa, projeto ou responsável...",
|
|
698
|
+
"viewDescription": "Tarefas dos projetos ativos agrupadas por projeto.",
|
|
699
|
+
"loading": "Montando visão de Gantt...",
|
|
700
|
+
"emptyDescription": "Nenhuma tarefa encontrada para os projetos em execução com os filtros atuais.",
|
|
701
|
+
"loadErrorDescription": "Não foi possível carregar o cronograma agora. Atualize para tentar novamente.",
|
|
702
|
+
"noAccessDescription": "A visão consolidada de Gantt está disponível apenas para supervisores e diretores.",
|
|
703
|
+
"actions": {
|
|
704
|
+
"openProject": "Abrir projeto"
|
|
705
|
+
},
|
|
706
|
+
"filters": {
|
|
707
|
+
"allProjects": "Todos os projetos",
|
|
708
|
+
"allStatuses": "Todos os status",
|
|
709
|
+
"clearDateRange": "Limpar período"
|
|
710
|
+
},
|
|
711
|
+
"cards": {
|
|
712
|
+
"activeProjects": "Projetos em execução",
|
|
713
|
+
"activeProjectsDescription": "Projetos ativos com tarefas no cronograma.",
|
|
714
|
+
"tasks": "Tarefas no cronograma",
|
|
715
|
+
"tasksDescription": "Itens exibidos conforme os filtros atuais.",
|
|
716
|
+
"doing": "Em andamento",
|
|
717
|
+
"doingDescription": "Tarefas sendo executadas agora.",
|
|
718
|
+
"overdue": "Atrasadas",
|
|
719
|
+
"overdueDescription": "Tarefas com prazo vencido e ainda abertas."
|
|
720
|
+
},
|
|
721
|
+
"labels": {
|
|
722
|
+
"projectTask": "Projeto e tarefa",
|
|
723
|
+
"range": "{from} até {to}",
|
|
724
|
+
"tasksCount": "{count} tarefa(s)"
|
|
725
|
+
},
|
|
726
|
+
"legend": {
|
|
727
|
+
"todo": "A fazer",
|
|
728
|
+
"doing": "Em andamento",
|
|
729
|
+
"review": "Em revisão",
|
|
730
|
+
"done": "Concluída",
|
|
731
|
+
"overdue": "Atrasada"
|
|
732
|
+
}
|
|
733
|
+
},
|
|
646
734
|
"ProjectFormPage": {
|
|
647
735
|
"newTitle": "Novo Projeto",
|
|
648
736
|
"editTitle": "Editar Projeto",
|
|
@@ -948,6 +1036,12 @@
|
|
|
948
1036
|
"usedHours": "Horas utilizadas",
|
|
949
1037
|
"availability": "Disponibilidade",
|
|
950
1038
|
"overloadWarning": "{value}% acima da capacidade recomendada.",
|
|
1039
|
+
"addCollaborator": "Adicionar colaborador",
|
|
1040
|
+
"addTitle": "Adicionar colaborador",
|
|
1041
|
+
"editTitle": "Editar alocação",
|
|
1042
|
+
"formDescription": "Configure os dados de alocação do colaborador neste projeto.",
|
|
1043
|
+
"removeTitle": "Remover colaborador",
|
|
1044
|
+
"removeDescription": "Tem certeza que deseja remover este colaborador do projeto?",
|
|
951
1045
|
"status": {
|
|
952
1046
|
"available": "Disponível",
|
|
953
1047
|
"high": "Alta carga",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: collaborator_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: operations_collaborator
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: invoice_number
|
|
11
|
+
type: varchar
|
|
12
|
+
length: 50
|
|
13
|
+
isNullable: true
|
|
14
|
+
- name: amount
|
|
15
|
+
type: decimal
|
|
16
|
+
precision: 14
|
|
17
|
+
scale: 2
|
|
18
|
+
- name: issue_date
|
|
19
|
+
type: date
|
|
20
|
+
- name: due_date
|
|
21
|
+
type: date
|
|
22
|
+
isNullable: true
|
|
23
|
+
- name: status
|
|
24
|
+
type: enum
|
|
25
|
+
values: [pending, paid, cancelled, overdue]
|
|
26
|
+
default: pending
|
|
27
|
+
- name: description
|
|
28
|
+
type: text
|
|
29
|
+
isNullable: true
|
|
30
|
+
- type: created_at
|
|
31
|
+
|
|
32
|
+
indices:
|
|
33
|
+
- columns: [collaborator_id]
|
|
34
|
+
- columns: [issue_date]
|
|
35
|
+
- columns: [status]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: collaborator_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: operations_collaborator
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: amount
|
|
11
|
+
type: decimal
|
|
12
|
+
precision: 14
|
|
13
|
+
scale: 2
|
|
14
|
+
- name: payment_date
|
|
15
|
+
type: date
|
|
16
|
+
- name: reference_month
|
|
17
|
+
type: varchar
|
|
18
|
+
length: 7
|
|
19
|
+
isNullable: true
|
|
20
|
+
- name: payment_method
|
|
21
|
+
type: enum
|
|
22
|
+
values: [bank_transfer, pix, check, other]
|
|
23
|
+
default: pix
|
|
24
|
+
- name: notes
|
|
25
|
+
type: text
|
|
26
|
+
isNullable: true
|
|
27
|
+
- type: created_at
|
|
28
|
+
|
|
29
|
+
indices:
|
|
30
|
+
- columns: [collaborator_id]
|
|
31
|
+
- columns: [payment_date]
|
|
32
|
+
- columns: [reference_month]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hed-hog/operations",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.347",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"@nestjs/mapped-types": "*",
|
|
12
12
|
"lucide-react": "^0.562.0",
|
|
13
13
|
"@hed-hog/api-types": "0.0.1",
|
|
14
|
-
"@hed-hog/api": "0.0.8",
|
|
15
14
|
"@hed-hog/api-locale": "0.0.14",
|
|
16
|
-
"@hed-hog/
|
|
15
|
+
"@hed-hog/api": "0.0.8",
|
|
16
|
+
"@hed-hog/core": "0.0.347",
|
|
17
|
+
"@hed-hog/contact": "0.0.347",
|
|
17
18
|
"@hed-hog/api-pagination": "0.0.7",
|
|
18
|
-
"@hed-hog/api-prisma": "0.0.6"
|
|
19
|
-
"@hed-hog/contact": "0.0.338"
|
|
19
|
+
"@hed-hog/api-prisma": "0.0.6"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
@@ -2,6 +2,7 @@ import { Role, User } from '@hed-hog/api';
|
|
|
2
2
|
import {
|
|
3
3
|
Body,
|
|
4
4
|
Controller,
|
|
5
|
+
Delete,
|
|
5
6
|
Get,
|
|
6
7
|
Param,
|
|
7
8
|
ParseIntPipe,
|
|
@@ -9,9 +10,13 @@ import {
|
|
|
9
10
|
Post,
|
|
10
11
|
Query,
|
|
11
12
|
} from '@nestjs/common';
|
|
13
|
+
import { CreateCollaboratorInvoiceDto } from '../dto/create-collaborator-invoice.dto';
|
|
14
|
+
import { CreateCollaboratorPaymentDto } from '../dto/create-collaborator-payment.dto';
|
|
12
15
|
import { CreateCollaboratorProjectAssignmentDto } from '../dto/create-collaborator-project-assignment.dto';
|
|
13
16
|
import { CreateCollaboratorDto } from '../dto/create-collaborator.dto';
|
|
14
17
|
import { ListCollaboratorsDto } from '../dto/list-collaborators.dto';
|
|
18
|
+
import { UpdateCollaboratorInvoiceDto } from '../dto/update-collaborator-invoice.dto';
|
|
19
|
+
import { UpdateCollaboratorPaymentDto } from '../dto/update-collaborator-payment.dto';
|
|
15
20
|
import { UpdateCollaboratorProjectAssignmentDto } from '../dto/update-collaborator-project-assignment.dto';
|
|
16
21
|
import { UpdateCollaboratorDto } from '../dto/update-collaborator.dto';
|
|
17
22
|
import { OperationsService } from '../operations.service';
|
|
@@ -58,6 +63,110 @@ export class OperationsCollaboratorsController {
|
|
|
58
63
|
);
|
|
59
64
|
}
|
|
60
65
|
|
|
66
|
+
@Get('collaborators/:id/payment-history')
|
|
67
|
+
getCollaboratorPaymentHistory(
|
|
68
|
+
@User() user,
|
|
69
|
+
@Param('id', ParseIntPipe) id: number,
|
|
70
|
+
) {
|
|
71
|
+
return this.operationsService.getCollaboratorPaymentHistory(
|
|
72
|
+
Number(user?.id || 0),
|
|
73
|
+
id,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Get('collaborators/:id/invoices')
|
|
78
|
+
getCollaboratorInvoices(
|
|
79
|
+
@User() user,
|
|
80
|
+
@Param('id', ParseIntPipe) id: number,
|
|
81
|
+
) {
|
|
82
|
+
return this.operationsService.getCollaboratorInvoices(
|
|
83
|
+
Number(user?.id || 0),
|
|
84
|
+
id,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Post('collaborators/:id/payment-history')
|
|
89
|
+
createCollaboratorPayment(
|
|
90
|
+
@User() user,
|
|
91
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
92
|
+
@Body() data: CreateCollaboratorPaymentDto,
|
|
93
|
+
) {
|
|
94
|
+
return this.operationsService.createCollaboratorPayment(
|
|
95
|
+
Number(user?.id || 0),
|
|
96
|
+
collaboratorId,
|
|
97
|
+
data,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Patch('collaborators/:id/payment-history/:paymentId')
|
|
102
|
+
updateCollaboratorPayment(
|
|
103
|
+
@User() user,
|
|
104
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
105
|
+
@Param('paymentId', ParseIntPipe) paymentId: number,
|
|
106
|
+
@Body() data: UpdateCollaboratorPaymentDto,
|
|
107
|
+
) {
|
|
108
|
+
return this.operationsService.updateCollaboratorPayment(
|
|
109
|
+
Number(user?.id || 0),
|
|
110
|
+
collaboratorId,
|
|
111
|
+
paymentId,
|
|
112
|
+
data,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@Delete('collaborators/:id/payment-history/:paymentId')
|
|
117
|
+
deleteCollaboratorPayment(
|
|
118
|
+
@User() user,
|
|
119
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
120
|
+
@Param('paymentId', ParseIntPipe) paymentId: number,
|
|
121
|
+
) {
|
|
122
|
+
return this.operationsService.deleteCollaboratorPayment(
|
|
123
|
+
Number(user?.id || 0),
|
|
124
|
+
collaboratorId,
|
|
125
|
+
paymentId,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@Post('collaborators/:id/invoices')
|
|
130
|
+
createCollaboratorInvoice(
|
|
131
|
+
@User() user,
|
|
132
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
133
|
+
@Body() data: CreateCollaboratorInvoiceDto,
|
|
134
|
+
) {
|
|
135
|
+
return this.operationsService.createCollaboratorInvoice(
|
|
136
|
+
Number(user?.id || 0),
|
|
137
|
+
collaboratorId,
|
|
138
|
+
data,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@Patch('collaborators/:id/invoices/:invoiceId')
|
|
143
|
+
updateCollaboratorInvoice(
|
|
144
|
+
@User() user,
|
|
145
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
146
|
+
@Param('invoiceId', ParseIntPipe) invoiceId: number,
|
|
147
|
+
@Body() data: UpdateCollaboratorInvoiceDto,
|
|
148
|
+
) {
|
|
149
|
+
return this.operationsService.updateCollaboratorInvoice(
|
|
150
|
+
Number(user?.id || 0),
|
|
151
|
+
collaboratorId,
|
|
152
|
+
invoiceId,
|
|
153
|
+
data,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Delete('collaborators/:id/invoices/:invoiceId')
|
|
158
|
+
deleteCollaboratorInvoice(
|
|
159
|
+
@User() user,
|
|
160
|
+
@Param('id', ParseIntPipe) collaboratorId: number,
|
|
161
|
+
@Param('invoiceId', ParseIntPipe) invoiceId: number,
|
|
162
|
+
) {
|
|
163
|
+
return this.operationsService.deleteCollaboratorInvoice(
|
|
164
|
+
Number(user?.id || 0),
|
|
165
|
+
collaboratorId,
|
|
166
|
+
invoiceId,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
61
170
|
@Get('collaborators/:id')
|
|
62
171
|
getCollaborator(@User() user, @Param('id', ParseIntPipe) id: number) {
|
|
63
172
|
return this.operationsService.getCollaboratorByIdForUser(
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Transform } from 'class-transformer';
|
|
2
|
+
import { IsIn, IsNumber, IsOptional, IsString, MaxLength, Min } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export const INVOICE_STATUS_VALUES = [
|
|
5
|
+
'pending',
|
|
6
|
+
'paid',
|
|
7
|
+
'cancelled',
|
|
8
|
+
'overdue',
|
|
9
|
+
] as const;
|
|
10
|
+
export type InvoiceStatus = (typeof INVOICE_STATUS_VALUES)[number];
|
|
11
|
+
|
|
12
|
+
export class CreateCollaboratorInvoiceDto {
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsString()
|
|
15
|
+
@MaxLength(50)
|
|
16
|
+
invoiceNumber?: string | null;
|
|
17
|
+
|
|
18
|
+
@Transform(({ value }) =>
|
|
19
|
+
value === '' || value === undefined || value === null ? undefined : Number(value),
|
|
20
|
+
)
|
|
21
|
+
@IsNumber()
|
|
22
|
+
@Min(0)
|
|
23
|
+
amount!: number;
|
|
24
|
+
|
|
25
|
+
@IsString()
|
|
26
|
+
issueDate!: string;
|
|
27
|
+
|
|
28
|
+
@IsOptional()
|
|
29
|
+
@IsString()
|
|
30
|
+
dueDate?: string | null;
|
|
31
|
+
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@IsIn(INVOICE_STATUS_VALUES)
|
|
34
|
+
status?: InvoiceStatus;
|
|
35
|
+
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsString()
|
|
38
|
+
description?: string | null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Transform } from 'class-transformer';
|
|
2
|
+
import { IsIn, IsNumber, IsOptional, IsString, MaxLength, Min } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export const PAYMENT_METHOD_VALUES = [
|
|
5
|
+
'bank_transfer',
|
|
6
|
+
'pix',
|
|
7
|
+
'check',
|
|
8
|
+
'other',
|
|
9
|
+
] as const;
|
|
10
|
+
export type PaymentMethod = (typeof PAYMENT_METHOD_VALUES)[number];
|
|
11
|
+
|
|
12
|
+
export class CreateCollaboratorPaymentDto {
|
|
13
|
+
@Transform(({ value }) =>
|
|
14
|
+
value === '' || value === undefined || value === null ? undefined : Number(value),
|
|
15
|
+
)
|
|
16
|
+
@IsNumber()
|
|
17
|
+
@Min(0)
|
|
18
|
+
amount!: number;
|
|
19
|
+
|
|
20
|
+
@IsString()
|
|
21
|
+
paymentDate!: string;
|
|
22
|
+
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsString()
|
|
25
|
+
@MaxLength(7)
|
|
26
|
+
referenceMonth?: string | null;
|
|
27
|
+
|
|
28
|
+
@IsOptional()
|
|
29
|
+
@IsIn(PAYMENT_METHOD_VALUES)
|
|
30
|
+
paymentMethod?: PaymentMethod;
|
|
31
|
+
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@IsString()
|
|
34
|
+
notes?: string | null;
|
|
35
|
+
}
|