@hed-hog/contact 0.0.295 → 0.0.297

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 (46) hide show
  1. package/dist/contact-type/contact-type.controller.d.ts +1 -1
  2. package/dist/contact-type/contact-type.service.d.ts +1 -1
  3. package/dist/document-type/document-type.controller.d.ts +1 -1
  4. package/dist/document-type/document-type.service.d.ts +1 -1
  5. package/dist/person/dto/reports-query.dto.d.ts +8 -0
  6. package/dist/person/dto/reports-query.dto.d.ts.map +1 -0
  7. package/dist/person/dto/reports-query.dto.js +33 -0
  8. package/dist/person/dto/reports-query.dto.js.map +1 -0
  9. package/dist/person/person.controller.d.ts +67 -10
  10. package/dist/person/person.controller.d.ts.map +1 -1
  11. package/dist/person/person.controller.js +26 -6
  12. package/dist/person/person.controller.js.map +1 -1
  13. package/dist/person/person.service.d.ts +61 -5
  14. package/dist/person/person.service.d.ts.map +1 -1
  15. package/dist/person/person.service.js +656 -298
  16. package/dist/person/person.service.js.map +1 -1
  17. package/dist/person-relation-type/person-relation-type.controller.d.ts +2 -2
  18. package/dist/person-relation-type/person-relation-type.service.d.ts +2 -2
  19. package/hedhog/data/menu.yaml +163 -163
  20. package/hedhog/data/route.yaml +68 -60
  21. package/hedhog/frontend/app/_lib/crm-sections.tsx.ejs +9 -9
  22. package/hedhog/frontend/app/accounts/_components/account-form-sheet.tsx.ejs +573 -573
  23. package/hedhog/frontend/app/accounts/_components/account-types.ts.ejs +9 -9
  24. package/hedhog/frontend/app/accounts/page.tsx.ejs +970 -970
  25. package/hedhog/frontend/app/activities/_components/activity-detail-sheet.tsx.ejs +240 -240
  26. package/hedhog/frontend/app/activities/_components/activity-types.ts.ejs +66 -66
  27. package/hedhog/frontend/app/activities/page.tsx.ejs +460 -460
  28. package/hedhog/frontend/app/dashboard/_components/dashboard-types.ts.ejs +70 -70
  29. package/hedhog/frontend/app/dashboard/page.tsx.ejs +639 -639
  30. package/hedhog/frontend/app/follow-ups/page.tsx.ejs +785 -785
  31. package/hedhog/frontend/app/person/_components/person-interaction-dialog.tsx.ejs +10 -12
  32. package/hedhog/frontend/app/reports/_components/report-types.ts.ejs +84 -0
  33. package/hedhog/frontend/app/reports/page.tsx.ejs +1196 -15
  34. package/hedhog/frontend/messages/en.json +242 -123
  35. package/hedhog/frontend/messages/pt.json +242 -123
  36. package/hedhog/table/crm_activity.yaml +68 -68
  37. package/hedhog/table/crm_stage_history.yaml +34 -0
  38. package/hedhog/table/person_company.yaml +27 -27
  39. package/package.json +9 -9
  40. package/src/person/dto/account.dto.ts +100 -100
  41. package/src/person/dto/activity.dto.ts +54 -54
  42. package/src/person/dto/dashboard-query.dto.ts +25 -25
  43. package/src/person/dto/followup-query.dto.ts +25 -25
  44. package/src/person/dto/reports-query.dto.ts +25 -0
  45. package/src/person/person.controller.ts +176 -159
  46. package/src/person/person.service.ts +4825 -4288
@@ -15,26 +15,27 @@ import {
15
15
  Res,
16
16
  forwardRef
17
17
  } from '@nestjs/common';
18
- import { Response } from 'express';
19
- import {
20
- AccountListQueryDTO,
21
- CreateAccountDTO,
22
- UpdateAccountDTO,
23
- } from './dto/account.dto';
24
- import { ActivityListQueryDTO } from './dto/activity.dto';
25
- import { CreateFollowupDTO } from './dto/create-followup.dto';
26
- import { CreateInteractionDTO } from './dto/create-interaction.dto';
27
- import { CreateDTO } from './dto/create.dto';
28
- import { DashboardQueryDTO } from './dto/dashboard-query.dto';
29
- import { CheckPersonDuplicatesQueryDTO } from './dto/duplicates-query.dto';
30
- import {
31
- FollowupListQueryDTO,
32
- FollowupStatsQueryDTO,
33
- } from './dto/followup-query.dto';
34
- import { MergePersonDTO } from './dto/merge.dto';
35
- import { UpdateLifecycleStageDTO } from './dto/update-lifecycle-stage.dto';
36
- import { UpdateAllPersonDTO } from './dto/update.dto';
37
- import { PersonService } from './person.service';
18
+ import { Response } from 'express';
19
+ import {
20
+ AccountListQueryDTO,
21
+ CreateAccountDTO,
22
+ UpdateAccountDTO,
23
+ } from './dto/account.dto';
24
+ import { ActivityListQueryDTO } from './dto/activity.dto';
25
+ import { CreateFollowupDTO } from './dto/create-followup.dto';
26
+ import { CreateInteractionDTO } from './dto/create-interaction.dto';
27
+ import { CreateDTO } from './dto/create.dto';
28
+ import { DashboardQueryDTO } from './dto/dashboard-query.dto';
29
+ import { CheckPersonDuplicatesQueryDTO } from './dto/duplicates-query.dto';
30
+ import {
31
+ FollowupListQueryDTO,
32
+ FollowupStatsQueryDTO,
33
+ } from './dto/followup-query.dto';
34
+ import { MergePersonDTO } from './dto/merge.dto';
35
+ import { ReportsQueryDTO } from './dto/reports-query.dto';
36
+ import { UpdateLifecycleStageDTO } from './dto/update-lifecycle-stage.dto';
37
+ import { UpdateAllPersonDTO } from './dto/update.dto';
38
+ import { PersonService } from './person.service';
38
39
 
39
40
  @Role()
40
41
  @Controller('person')
@@ -44,21 +45,29 @@ export class PersonController {
44
45
  private readonly personService: PersonService
45
46
  ) {}
46
47
 
47
- @Get('stats')
48
- async getStats() {
49
- return this.personService.getStats();
50
- }
51
-
52
- @Get('dashboard')
53
- async getDashboard(
54
- @Query() query: DashboardQueryDTO,
55
- @Locale() locale: string,
56
- ) {
57
- return this.personService.getDashboard(query, locale);
58
- }
59
-
60
- @Get('owner-options')
61
- async getOwnerOptions(@User() user) {
48
+ @Get('stats')
49
+ async getStats() {
50
+ return this.personService.getStats();
51
+ }
52
+
53
+ @Get('dashboard')
54
+ async getDashboard(
55
+ @Query() query: DashboardQueryDTO,
56
+ @Locale() locale: string,
57
+ ) {
58
+ return this.personService.getDashboard(query, locale);
59
+ }
60
+
61
+ @Get('reports')
62
+ async getReports(
63
+ @Query() query: ReportsQueryDTO,
64
+ @Locale() locale: string,
65
+ ) {
66
+ return this.personService.getReports(query, locale);
67
+ }
68
+
69
+ @Get('owner-options')
70
+ async getOwnerOptions(@User() user) {
62
71
  return this.personService.getOwnerOptions(Number(user?.id || 0));
63
72
  }
64
73
 
@@ -67,114 +76,114 @@ export class PersonController {
67
76
  return this.personService.checkDuplicates(query);
68
77
  }
69
78
 
70
- @Get()
71
- async list(@Pagination() paginationParams, @Query() filters, @User() user) {
72
- return this.personService.list(
73
- { ...paginationParams, ...filters },
74
- Number(user?.id || 0),
75
- );
76
- }
77
-
78
- @Get('accounts')
79
- async listAccounts(
80
- @Pagination() paginationParams,
81
- @Query() query: AccountListQueryDTO,
82
- ) {
83
- return this.personService.listAccounts({
84
- ...paginationParams,
85
- ...query,
86
- });
87
- }
88
-
89
- @Get('accounts/stats')
90
- async getAccountStats() {
91
- return this.personService.getAccountStats();
92
- }
93
-
94
- @Post('accounts')
95
- async createAccount(
96
- @Body() data: CreateAccountDTO,
97
- @Locale() locale: string,
98
- ) {
99
- return this.personService.createAccount(data, locale);
100
- }
101
-
102
- @Patch('accounts/:id')
103
- async updateAccount(
104
- @Param('id', ParseIntPipe) id: number,
105
- @Body() data: UpdateAccountDTO,
106
- @Locale() locale: string,
107
- ) {
108
- return this.personService.updateAccount(id, data, locale);
109
- }
110
-
111
- @Delete('accounts')
112
- async deleteAccounts(@Body() data: DeleteDTO, @Locale() locale: string) {
113
- return this.personService.deleteAccounts(data, locale);
114
- }
115
-
116
- @Get('followups')
117
- async listFollowups(
118
- @Pagination() paginationParams,
119
- @Query() query: FollowupListQueryDTO,
120
- @User() user,
121
- ) {
122
- return this.personService.listFollowups(
123
- { ...paginationParams, ...query },
124
- Number(user?.id || 0),
125
- );
126
- }
127
-
128
- @Get('followups/stats')
129
- async getFollowupStats(
130
- @Query() query: FollowupStatsQueryDTO,
131
- @User() user,
132
- ) {
133
- return this.personService.getFollowupStats(
134
- query,
135
- Number(user?.id || 0),
136
- );
137
- }
138
-
139
- @Get('activities')
140
- async listActivities(
141
- @Pagination() paginationParams,
142
- @Query() query: ActivityListQueryDTO,
143
- ) {
144
- return this.personService.listActivities({
145
- ...paginationParams,
146
- ...query,
147
- });
148
- }
149
-
150
- @Get('activities/stats')
151
- async getActivityStats() {
152
- return this.personService.getActivityStats();
153
- }
154
-
155
- @Get('activities/:id')
156
- async getActivity(
157
- @Param('id', ParseIntPipe) id: number,
158
- @Locale() locale: string,
159
- ) {
160
- return this.personService.getActivity(id, locale);
161
- }
162
-
163
- @Post('activities/:id/complete')
164
- async completeActivity(
165
- @Param('id', ParseIntPipe) id: number,
166
- @Locale() locale: string,
167
- @User() user,
168
- ) {
169
- return this.personService.completeActivity(id, locale, {
170
- id: Number(user?.id || 0),
171
- name: user?.name,
172
- });
173
- }
174
-
175
- @Public()
176
- @Get('avatar/:id')
177
- async openAvatar(
79
+ @Get()
80
+ async list(@Pagination() paginationParams, @Query() filters, @User() user) {
81
+ return this.personService.list(
82
+ { ...paginationParams, ...filters },
83
+ Number(user?.id || 0),
84
+ );
85
+ }
86
+
87
+ @Get('accounts')
88
+ async listAccounts(
89
+ @Pagination() paginationParams,
90
+ @Query() query: AccountListQueryDTO,
91
+ ) {
92
+ return this.personService.listAccounts({
93
+ ...paginationParams,
94
+ ...query,
95
+ });
96
+ }
97
+
98
+ @Get('accounts/stats')
99
+ async getAccountStats() {
100
+ return this.personService.getAccountStats();
101
+ }
102
+
103
+ @Post('accounts')
104
+ async createAccount(
105
+ @Body() data: CreateAccountDTO,
106
+ @Locale() locale: string,
107
+ ) {
108
+ return this.personService.createAccount(data, locale);
109
+ }
110
+
111
+ @Patch('accounts/:id')
112
+ async updateAccount(
113
+ @Param('id', ParseIntPipe) id: number,
114
+ @Body() data: UpdateAccountDTO,
115
+ @Locale() locale: string,
116
+ ) {
117
+ return this.personService.updateAccount(id, data, locale);
118
+ }
119
+
120
+ @Delete('accounts')
121
+ async deleteAccounts(@Body() data: DeleteDTO, @Locale() locale: string) {
122
+ return this.personService.deleteAccounts(data, locale);
123
+ }
124
+
125
+ @Get('followups')
126
+ async listFollowups(
127
+ @Pagination() paginationParams,
128
+ @Query() query: FollowupListQueryDTO,
129
+ @User() user,
130
+ ) {
131
+ return this.personService.listFollowups(
132
+ { ...paginationParams, ...query },
133
+ Number(user?.id || 0),
134
+ );
135
+ }
136
+
137
+ @Get('followups/stats')
138
+ async getFollowupStats(
139
+ @Query() query: FollowupStatsQueryDTO,
140
+ @User() user,
141
+ ) {
142
+ return this.personService.getFollowupStats(
143
+ query,
144
+ Number(user?.id || 0),
145
+ );
146
+ }
147
+
148
+ @Get('activities')
149
+ async listActivities(
150
+ @Pagination() paginationParams,
151
+ @Query() query: ActivityListQueryDTO,
152
+ ) {
153
+ return this.personService.listActivities({
154
+ ...paginationParams,
155
+ ...query,
156
+ });
157
+ }
158
+
159
+ @Get('activities/stats')
160
+ async getActivityStats() {
161
+ return this.personService.getActivityStats();
162
+ }
163
+
164
+ @Get('activities/:id')
165
+ async getActivity(
166
+ @Param('id', ParseIntPipe) id: number,
167
+ @Locale() locale: string,
168
+ ) {
169
+ return this.personService.getActivity(id, locale);
170
+ }
171
+
172
+ @Post('activities/:id/complete')
173
+ async completeActivity(
174
+ @Param('id', ParseIntPipe) id: number,
175
+ @Locale() locale: string,
176
+ @User() user,
177
+ ) {
178
+ return this.personService.completeActivity(id, locale, {
179
+ id: Number(user?.id || 0),
180
+ name: user?.name,
181
+ });
182
+ }
183
+
184
+ @Public()
185
+ @Get('avatar/:id')
186
+ async openAvatar(
178
187
  @Param('id', ParseIntPipe) id: number,
179
188
  @Res() res: Response,
180
189
  @Locale() locale: string,
@@ -232,22 +241,30 @@ export class PersonController {
232
241
  }
233
242
 
234
243
  @Post(':id/lifecycle-stage')
235
- async updateLifecycleStage(
236
- @Param('id', ParseIntPipe) id: number,
237
- @Body() data: UpdateLifecycleStageDTO,
238
- @Locale() locale: string,
239
- ) {
240
- return this.personService.updateLifecycleStage(id, data, locale);
241
- }
242
-
243
- @Patch(':id')
244
- async update(
245
- @Param('id', ParseIntPipe) id: number,
246
- @Body() data: UpdateAllPersonDTO,
247
- @Locale() locale: string
248
- ) {
249
- return this.personService.update(id, data, locale);
250
- }
244
+ async updateLifecycleStage(
245
+ @Param('id', ParseIntPipe) id: number,
246
+ @Body() data: UpdateLifecycleStageDTO,
247
+ @Locale() locale: string,
248
+ @User() user,
249
+ ) {
250
+ return this.personService.updateLifecycleStage(id, data, locale, {
251
+ id: Number(user?.id || 0),
252
+ name: user?.name,
253
+ });
254
+ }
255
+
256
+ @Patch(':id')
257
+ async update(
258
+ @Param('id', ParseIntPipe) id: number,
259
+ @Body() data: UpdateAllPersonDTO,
260
+ @Locale() locale: string,
261
+ @User() user,
262
+ ) {
263
+ return this.personService.update(id, data, locale, {
264
+ id: Number(user?.id || 0),
265
+ name: user?.name,
266
+ });
267
+ }
251
268
 
252
269
  @Delete()
253
270
  async delete(@Body() data: DeleteDTO, @Locale() locale: string) {