@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/contact",
3
- "version": "0.0.295",
3
+ "version": "0.0.297",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -9,13 +9,13 @@
9
9
  "@nestjs/core": "^11",
10
10
  "@nestjs/jwt": "^11",
11
11
  "@nestjs/mapped-types": "*",
12
- "@hed-hog/core": "0.0.295",
13
- "@hed-hog/api-mail": "0.0.8",
14
- "@hed-hog/api-prisma": "0.0.5",
15
- "@hed-hog/api-locale": "0.0.13",
16
- "@hed-hog/address": "0.0.295",
17
- "@hed-hog/api": "0.0.4",
18
- "@hed-hog/api-pagination": "0.0.6"
12
+ "@hed-hog/core": "0.0.297",
13
+ "@hed-hog/api-mail": "0.0.9",
14
+ "@hed-hog/api": "0.0.6",
15
+ "@hed-hog/address": "0.0.297",
16
+ "@hed-hog/api-pagination": "0.0.7",
17
+ "@hed-hog/api-locale": "0.0.14",
18
+ "@hed-hog/api-prisma": "0.0.6"
19
19
  },
20
20
  "exports": {
21
21
  ".": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
34
- "prebuild": "npx ts-node ../../scripts/build-dependencies.ts libraries/contact",
34
+ "prebuild": "pnpm --dir ../.. exec ts-node ./scripts/build-dependencies.ts libraries/contact",
35
35
  "build": "tsc --project tsconfig.production.json",
36
36
  "patch": "npx ts-node ../../scripts/patch.ts libraries/contact",
37
37
  "prod": "pnpm run patch && pnpm run build && pnpm publish --access public --no-git-checks"
@@ -1,100 +1,100 @@
1
- import { Type } from 'class-transformer';
2
- import {
3
- IsEmail,
4
- IsIn,
5
- IsInt,
6
- IsNumber,
7
- IsOptional,
8
- IsString,
9
- MaxLength,
10
- } from 'class-validator';
11
- import { PersonStatus } from './create.dto';
12
-
13
- export const ACCOUNT_LIFECYCLE_STAGES = [
14
- 'prospect',
15
- 'customer',
16
- 'churned',
17
- 'inactive',
18
- ] as const;
19
-
20
- export type AccountLifecycleStage = (typeof ACCOUNT_LIFECYCLE_STAGES)[number];
21
-
22
- export class AccountListQueryDTO {
23
- @IsOptional()
24
- @IsString()
25
- search?: string;
26
-
27
- @IsOptional()
28
- @IsIn(['all', PersonStatus.ACTIVE, PersonStatus.INACTIVE])
29
- status?: 'all' | PersonStatus;
30
-
31
- @IsOptional()
32
- @IsIn(['all', ...ACCOUNT_LIFECYCLE_STAGES])
33
- lifecycle_stage?: 'all' | AccountLifecycleStage;
34
-
35
- @IsOptional()
36
- @IsIn(['name', 'created_at'])
37
- sortField?: 'name' | 'created_at';
38
-
39
- @IsOptional()
40
- @IsIn(['asc', 'desc'])
41
- sortOrder?: 'asc' | 'desc';
42
- }
43
-
44
- export class CreateAccountDTO {
45
- @IsString()
46
- name: string;
47
-
48
- @IsOptional()
49
- @IsString()
50
- trade_name?: string | null;
51
-
52
- @IsIn([PersonStatus.ACTIVE, PersonStatus.INACTIVE])
53
- status: PersonStatus;
54
-
55
- @IsOptional()
56
- @IsString()
57
- industry?: string | null;
58
-
59
- @IsOptional()
60
- @IsString()
61
- website?: string | null;
62
-
63
- @IsOptional()
64
- @IsEmail()
65
- email?: string | null;
66
-
67
- @IsOptional()
68
- @IsString()
69
- phone?: string | null;
70
-
71
- @IsOptional()
72
- @Type(() => Number)
73
- @IsInt()
74
- owner_user_id?: number | null;
75
-
76
- @IsOptional()
77
- @Type(() => Number)
78
- @IsNumber()
79
- annual_revenue?: number | null;
80
-
81
- @IsOptional()
82
- @Type(() => Number)
83
- @IsInt()
84
- employee_count?: number | null;
85
-
86
- @IsOptional()
87
- @IsIn(ACCOUNT_LIFECYCLE_STAGES)
88
- lifecycle_stage?: AccountLifecycleStage | null;
89
-
90
- @IsOptional()
91
- @IsString()
92
- city?: string | null;
93
-
94
- @IsOptional()
95
- @IsString()
96
- @MaxLength(2)
97
- state?: string | null;
98
- }
99
-
100
- export class UpdateAccountDTO extends CreateAccountDTO {}
1
+ import { Type } from 'class-transformer';
2
+ import {
3
+ IsEmail,
4
+ IsIn,
5
+ IsInt,
6
+ IsNumber,
7
+ IsOptional,
8
+ IsString,
9
+ MaxLength,
10
+ } from 'class-validator';
11
+ import { PersonStatus } from './create.dto';
12
+
13
+ export const ACCOUNT_LIFECYCLE_STAGES = [
14
+ 'prospect',
15
+ 'customer',
16
+ 'churned',
17
+ 'inactive',
18
+ ] as const;
19
+
20
+ export type AccountLifecycleStage = (typeof ACCOUNT_LIFECYCLE_STAGES)[number];
21
+
22
+ export class AccountListQueryDTO {
23
+ @IsOptional()
24
+ @IsString()
25
+ search?: string;
26
+
27
+ @IsOptional()
28
+ @IsIn(['all', PersonStatus.ACTIVE, PersonStatus.INACTIVE])
29
+ status?: 'all' | PersonStatus;
30
+
31
+ @IsOptional()
32
+ @IsIn(['all', ...ACCOUNT_LIFECYCLE_STAGES])
33
+ lifecycle_stage?: 'all' | AccountLifecycleStage;
34
+
35
+ @IsOptional()
36
+ @IsIn(['name', 'created_at'])
37
+ sortField?: 'name' | 'created_at';
38
+
39
+ @IsOptional()
40
+ @IsIn(['asc', 'desc'])
41
+ sortOrder?: 'asc' | 'desc';
42
+ }
43
+
44
+ export class CreateAccountDTO {
45
+ @IsString()
46
+ name: string;
47
+
48
+ @IsOptional()
49
+ @IsString()
50
+ trade_name?: string | null;
51
+
52
+ @IsIn([PersonStatus.ACTIVE, PersonStatus.INACTIVE])
53
+ status: PersonStatus;
54
+
55
+ @IsOptional()
56
+ @IsString()
57
+ industry?: string | null;
58
+
59
+ @IsOptional()
60
+ @IsString()
61
+ website?: string | null;
62
+
63
+ @IsOptional()
64
+ @IsEmail()
65
+ email?: string | null;
66
+
67
+ @IsOptional()
68
+ @IsString()
69
+ phone?: string | null;
70
+
71
+ @IsOptional()
72
+ @Type(() => Number)
73
+ @IsInt()
74
+ owner_user_id?: number | null;
75
+
76
+ @IsOptional()
77
+ @Type(() => Number)
78
+ @IsNumber()
79
+ annual_revenue?: number | null;
80
+
81
+ @IsOptional()
82
+ @Type(() => Number)
83
+ @IsInt()
84
+ employee_count?: number | null;
85
+
86
+ @IsOptional()
87
+ @IsIn(ACCOUNT_LIFECYCLE_STAGES)
88
+ lifecycle_stage?: AccountLifecycleStage | null;
89
+
90
+ @IsOptional()
91
+ @IsString()
92
+ city?: string | null;
93
+
94
+ @IsOptional()
95
+ @IsString()
96
+ @MaxLength(2)
97
+ state?: string | null;
98
+ }
99
+
100
+ export class UpdateAccountDTO extends CreateAccountDTO {}
@@ -1,54 +1,54 @@
1
- import { getLocaleText } from '@hed-hog/api-locale';
2
- import { IsIn, IsOptional, IsString } from 'class-validator';
3
-
4
- export const CRM_ACTIVITY_TYPES = [
5
- 'call',
6
- 'email',
7
- 'meeting',
8
- 'whatsapp',
9
- 'task',
10
- 'note',
11
- ] as const;
12
-
13
- export const CRM_ACTIVITY_PRIORITIES = ['high', 'medium', 'low'] as const;
14
- export const CRM_ACTIVITY_STATUSES = [
15
- 'pending',
16
- 'overdue',
17
- 'completed',
18
- ] as const;
19
- export const CRM_ACTIVITY_SOURCE_KINDS = [
20
- 'manual',
21
- 'followup',
22
- 'interaction',
23
- ] as const;
24
-
25
- export type CrmActivityType = (typeof CRM_ACTIVITY_TYPES)[number];
26
- export type CrmActivityPriority = (typeof CRM_ACTIVITY_PRIORITIES)[number];
27
- export type CrmActivityStatus = (typeof CRM_ACTIVITY_STATUSES)[number];
28
- export type CrmActivitySourceKind = (typeof CRM_ACTIVITY_SOURCE_KINDS)[number];
29
-
30
- export class ActivityListQueryDTO {
31
- @IsOptional()
32
- @IsString({
33
- message: (args) => getLocaleText('validation.stringRequired', args.value),
34
- })
35
- search?: string;
36
-
37
- @IsOptional()
38
- @IsIn(['all', ...CRM_ACTIVITY_STATUSES], {
39
- message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
40
- })
41
- status?: 'all' | CrmActivityStatus;
42
-
43
- @IsOptional()
44
- @IsIn(['all', ...CRM_ACTIVITY_TYPES], {
45
- message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
46
- })
47
- type?: 'all' | CrmActivityType;
48
-
49
- @IsOptional()
50
- @IsIn(['all', ...CRM_ACTIVITY_PRIORITIES], {
51
- message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
52
- })
53
- priority?: 'all' | CrmActivityPriority;
54
- }
1
+ import { getLocaleText } from '@hed-hog/api-locale';
2
+ import { IsIn, IsOptional, IsString } from 'class-validator';
3
+
4
+ export const CRM_ACTIVITY_TYPES = [
5
+ 'call',
6
+ 'email',
7
+ 'meeting',
8
+ 'whatsapp',
9
+ 'task',
10
+ 'note',
11
+ ] as const;
12
+
13
+ export const CRM_ACTIVITY_PRIORITIES = ['high', 'medium', 'low'] as const;
14
+ export const CRM_ACTIVITY_STATUSES = [
15
+ 'pending',
16
+ 'overdue',
17
+ 'completed',
18
+ ] as const;
19
+ export const CRM_ACTIVITY_SOURCE_KINDS = [
20
+ 'manual',
21
+ 'followup',
22
+ 'interaction',
23
+ ] as const;
24
+
25
+ export type CrmActivityType = (typeof CRM_ACTIVITY_TYPES)[number];
26
+ export type CrmActivityPriority = (typeof CRM_ACTIVITY_PRIORITIES)[number];
27
+ export type CrmActivityStatus = (typeof CRM_ACTIVITY_STATUSES)[number];
28
+ export type CrmActivitySourceKind = (typeof CRM_ACTIVITY_SOURCE_KINDS)[number];
29
+
30
+ export class ActivityListQueryDTO {
31
+ @IsOptional()
32
+ @IsString({
33
+ message: (args) => getLocaleText('validation.stringRequired', args.value),
34
+ })
35
+ search?: string;
36
+
37
+ @IsOptional()
38
+ @IsIn(['all', ...CRM_ACTIVITY_STATUSES], {
39
+ message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
40
+ })
41
+ status?: 'all' | CrmActivityStatus;
42
+
43
+ @IsOptional()
44
+ @IsIn(['all', ...CRM_ACTIVITY_TYPES], {
45
+ message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
46
+ })
47
+ type?: 'all' | CrmActivityType;
48
+
49
+ @IsOptional()
50
+ @IsIn(['all', ...CRM_ACTIVITY_PRIORITIES], {
51
+ message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
52
+ })
53
+ priority?: 'all' | CrmActivityPriority;
54
+ }
@@ -1,25 +1,25 @@
1
- import { Type } from 'class-transformer';
2
- import { IsDateString, IsIn, IsInt, IsOptional } from 'class-validator';
3
-
4
- export const CRM_DASHBOARD_PERIODS = ['7d', '30d', '90d', 'custom'] as const;
5
-
6
- export type CrmDashboardPeriod = (typeof CRM_DASHBOARD_PERIODS)[number];
7
-
8
- export class DashboardQueryDTO {
9
- @IsOptional()
10
- @Type(() => Number)
11
- @IsInt()
12
- owner_user_id?: number;
13
-
14
- @IsOptional()
15
- @IsIn(CRM_DASHBOARD_PERIODS)
16
- period?: CrmDashboardPeriod;
17
-
18
- @IsOptional()
19
- @IsDateString()
20
- date_from?: string;
21
-
22
- @IsOptional()
23
- @IsDateString()
24
- date_to?: string;
25
- }
1
+ import { Type } from 'class-transformer';
2
+ import { IsDateString, IsIn, IsInt, IsOptional } from 'class-validator';
3
+
4
+ export const CRM_DASHBOARD_PERIODS = ['7d', '30d', '90d', 'custom'] as const;
5
+
6
+ export type CrmDashboardPeriod = (typeof CRM_DASHBOARD_PERIODS)[number];
7
+
8
+ export class DashboardQueryDTO {
9
+ @IsOptional()
10
+ @Type(() => Number)
11
+ @IsInt()
12
+ owner_user_id?: number;
13
+
14
+ @IsOptional()
15
+ @IsIn(CRM_DASHBOARD_PERIODS)
16
+ period?: CrmDashboardPeriod;
17
+
18
+ @IsOptional()
19
+ @IsDateString()
20
+ date_from?: string;
21
+
22
+ @IsOptional()
23
+ @IsDateString()
24
+ date_to?: string;
25
+ }
@@ -1,25 +1,25 @@
1
- import { IsIn, IsOptional, IsString, Matches } from 'class-validator';
2
-
3
- export class FollowupListQueryDTO {
4
- @IsOptional()
5
- @IsString()
6
- search?: string;
7
-
8
- @IsOptional()
9
- @IsIn(['all', 'today', 'upcoming', 'overdue'])
10
- status?: 'all' | 'today' | 'upcoming' | 'overdue';
11
-
12
- @IsOptional()
13
- @Matches(/^\d{4}-\d{2}-\d{2}$/)
14
- date_from?: string;
15
-
16
- @IsOptional()
17
- @Matches(/^\d{4}-\d{2}-\d{2}$/)
18
- date_to?: string;
19
- }
20
-
21
- export class FollowupStatsQueryDTO {
22
- @IsOptional()
23
- @IsString()
24
- search?: string;
25
- }
1
+ import { IsIn, IsOptional, IsString, Matches } from 'class-validator';
2
+
3
+ export class FollowupListQueryDTO {
4
+ @IsOptional()
5
+ @IsString()
6
+ search?: string;
7
+
8
+ @IsOptional()
9
+ @IsIn(['all', 'today', 'upcoming', 'overdue'])
10
+ status?: 'all' | 'today' | 'upcoming' | 'overdue';
11
+
12
+ @IsOptional()
13
+ @Matches(/^\d{4}-\d{2}-\d{2}$/)
14
+ date_from?: string;
15
+
16
+ @IsOptional()
17
+ @Matches(/^\d{4}-\d{2}-\d{2}$/)
18
+ date_to?: string;
19
+ }
20
+
21
+ export class FollowupStatsQueryDTO {
22
+ @IsOptional()
23
+ @IsString()
24
+ search?: string;
25
+ }
@@ -0,0 +1,25 @@
1
+ import { getLocaleText } from '@hed-hog/api-locale';
2
+ import { IsDateString, IsIn } from 'class-validator';
3
+
4
+ export const CRM_REPORT_GROUP_BY = ['day', 'week', 'month', 'year'] as const;
5
+
6
+ export type CrmReportGroupBy = (typeof CRM_REPORT_GROUP_BY)[number];
7
+
8
+ export class ReportsQueryDTO {
9
+ @IsDateString(
10
+ {},
11
+ { message: (args) => getLocaleText('validation.dateMustBeString', args.value) },
12
+ )
13
+ date_from: string;
14
+
15
+ @IsDateString(
16
+ {},
17
+ { message: (args) => getLocaleText('validation.dateMustBeString', args.value) },
18
+ )
19
+ date_to: string;
20
+
21
+ @IsIn(CRM_REPORT_GROUP_BY, {
22
+ message: (args) => getLocaleText('validation.typeMustBeEnum', args.value),
23
+ })
24
+ group_by: CrmReportGroupBy;
25
+ }