mblabs-roccato-backend-commons 1.0.8 → 1.1.0

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 (102) hide show
  1. package/bitbucket-pipelines.yml +6 -48
  2. package/dist/database/entities/account.d.ts +1 -2
  3. package/dist/database/entities/account.js +2 -7
  4. package/dist/database/entities/address.d.ts +2 -1
  5. package/dist/database/entities/address.js +6 -5
  6. package/dist/database/entities/company-address.d.ts +10 -0
  7. package/dist/database/entities/company-address.js +51 -0
  8. package/dist/database/entities/company.d.ts +13 -0
  9. package/dist/database/entities/company.js +68 -0
  10. package/dist/database/entities/index.d.ts +3 -1
  11. package/dist/database/entities/index.js +5 -1
  12. package/dist/database/migrations/1748448589934-CreateAccountsTable.js +1 -6
  13. package/dist/database/migrations/1750432386920-CreateAddressTable.js +0 -5
  14. package/dist/database/migrations/{1750691840822-CreateAccountDetailsTable.d.ts → 1750437883213-CreateCompanyTable.d.ts} +1 -1
  15. package/dist/database/migrations/{1750691840822-CreateAccountDetailsTable.js → 1750437883213-CreateCompanyTable.js} +35 -23
  16. package/dist/database/migrations/{1750690818577-CreateAccountAddressTable.d.ts → 1750440116105-CreateCompanyAddressTable.d.ts} +1 -1
  17. package/dist/database/migrations/{1750690818577-CreateAccountAddressTable.js → 1750440116105-CreateCompanyAddressTable.js} +14 -21
  18. package/dist/database/migrations/index.d.ts +1 -29
  19. package/dist/database/migrations/index.js +18 -18
  20. package/dist/interfaces/aws.d.ts +41 -67
  21. package/dist/interfaces/azure.d.ts +38 -61
  22. package/dist/interfaces/firebase.d.ts +3 -7
  23. package/dist/interfaces/gcp.d.ts +5 -11
  24. package/dist/interfaces/grafana.d.ts +2 -6
  25. package/dist/interfaces/keycloak.d.ts +4 -171
  26. package/dist/interfaces/nodemailer.d.ts +16 -20
  27. package/dist/interfaces/redis.d.ts +8 -49
  28. package/dist/interfaces/sendgrid.d.ts +13 -15
  29. package/dist/services/aws/cloudwatch.d.ts +1 -1
  30. package/dist/services/aws/cloudwatch.js +38 -38
  31. package/dist/services/aws/pinpoint.d.ts +3 -3
  32. package/dist/services/aws/pinpoint.js +29 -29
  33. package/dist/services/aws/s3.d.ts +5 -5
  34. package/dist/services/aws/s3.js +55 -59
  35. package/dist/services/aws/secret-manager.d.ts +1 -1
  36. package/dist/services/aws/secret-manager.js +5 -5
  37. package/dist/services/aws/sqs.d.ts +3 -3
  38. package/dist/services/aws/sqs.js +16 -16
  39. package/dist/services/azure/application-insights.d.ts +4 -4
  40. package/dist/services/azure/application-insights.js +12 -12
  41. package/dist/services/azure/communication.d.ts +3 -3
  42. package/dist/services/azure/communication.js +17 -17
  43. package/dist/services/azure/keyvault.d.ts +1 -1
  44. package/dist/services/azure/keyvault.js +3 -3
  45. package/dist/services/azure/storage-blob.d.ts +3 -3
  46. package/dist/services/azure/storage-blob.js +22 -22
  47. package/dist/services/firebase.d.ts +2 -2
  48. package/dist/services/firebase.js +10 -12
  49. package/dist/services/gcp/drive.d.ts +1 -1
  50. package/dist/services/gcp/drive.js +4 -4
  51. package/dist/services/gcp/secrets.d.ts +1 -1
  52. package/dist/services/gcp/secrets.js +8 -6
  53. package/dist/services/gcp/sheets.d.ts +1 -1
  54. package/dist/services/gcp/sheets.js +6 -6
  55. package/dist/services/grafana.d.ts +2 -2
  56. package/dist/services/grafana.js +12 -12
  57. package/dist/services/keycloak.d.ts +2 -14
  58. package/dist/services/keycloak.js +24 -300
  59. package/dist/services/nodemailer.d.ts +2 -2
  60. package/dist/services/nodemailer.js +109 -19
  61. package/dist/services/redis.d.ts +8 -6
  62. package/dist/services/redis.js +24 -53
  63. package/dist/services/sendgrid.d.ts +1 -1
  64. package/dist/services/sendgrid.js +10 -10
  65. package/package.json +1 -1
  66. package/src/database/entities/account.ts +3 -5
  67. package/src/database/entities/address.ts +7 -4
  68. package/src/database/entities/company-address.ts +27 -0
  69. package/src/database/entities/company.ts +36 -0
  70. package/src/database/entities/index.ts +4 -0
  71. package/src/database/migrations/1748448589934-CreateAccountsTable.ts +1 -6
  72. package/src/database/migrations/1750432386920-CreateAddressTable.ts +0 -5
  73. package/src/database/migrations/{1750691840822-CreateAccountDetailsTable.ts → 1750437883213-CreateCompanyTable.ts} +35 -21
  74. package/src/database/migrations/{1750690818577-CreateAccountAddressTable.ts → 1750440116105-CreateCompanyAddressTable.ts} +14 -24
  75. package/src/database/migrations/index.ts +6 -6
  76. package/src/interfaces/aws.ts +55 -81
  77. package/src/interfaces/azure.ts +50 -71
  78. package/src/interfaces/firebase.ts +6 -10
  79. package/src/interfaces/gcp.ts +8 -14
  80. package/src/interfaces/grafana.ts +5 -9
  81. package/src/interfaces/keycloak.ts +7 -190
  82. package/src/interfaces/nodemailer.ts +18 -22
  83. package/src/interfaces/redis.ts +8 -54
  84. package/src/interfaces/sendgrid.ts +14 -16
  85. package/src/services/aws/cloudwatch.ts +39 -39
  86. package/src/services/aws/pinpoint.ts +30 -30
  87. package/src/services/aws/s3.ts +55 -59
  88. package/src/services/aws/secret-manager.ts +7 -8
  89. package/src/services/aws/sqs.ts +17 -23
  90. package/src/services/azure/application-insights.ts +12 -12
  91. package/src/services/azure/communication.ts +18 -18
  92. package/src/services/azure/keyvault.ts +3 -3
  93. package/src/services/azure/storage-blob.ts +30 -34
  94. package/src/services/firebase.ts +11 -21
  95. package/src/services/gcp/drive.ts +5 -8
  96. package/src/services/gcp/secrets.ts +10 -9
  97. package/src/services/gcp/sheets.ts +7 -10
  98. package/src/services/grafana.ts +12 -18
  99. package/src/services/keycloak.ts +25 -381
  100. package/src/services/nodemailer.ts +110 -19
  101. package/src/services/redis.ts +22 -58
  102. package/src/services/sendgrid.ts +11 -11
@@ -48,47 +48,11 @@ pipelines:
48
48
  caches:
49
49
  - node
50
50
  script:
51
- - apt-get update && apt-get install -y jq
52
- - PACKAGE_NAME=$(jq -r .name package.json)
53
- - PUBLISHED_VERSION=$(npm view $PACKAGE_NAME version)
54
-
55
- - jq --arg version "$PUBLISHED_VERSION" '.version = $version' package.json > pkg.json && mv pkg.json package.json
56
- - PATCH_VERSION=$(npm version patch --no-git-tag-version)
57
-
58
- - git add package.json
59
- - git commit -m "chore(release):bump patch version [skip ci]"
60
- - git tag $PATCH_VERSION
61
- - git push origin $PATCH_VERSION
62
- - pipe: atlassian/npm-publish:0.2.0
63
- variables:
64
- NPM_TOKEN: $NPM_TOKEN
65
- homolog:
66
- - step:
67
- name: "Build SDK"
68
- caches:
69
- - node
70
- script:
71
- - yarn clean-install
72
- - yarn build
73
- artifacts:
74
- - dist/**
75
-
76
- - step:
77
- name: "Publish SDK"
78
- caches:
79
- - node
80
- script:
81
- - apt-get update && apt-get install -y jq
82
- - PACKAGE_NAME=$(jq -r .name package.json)
83
- - PUBLISHED_VERSION=$(npm view $PACKAGE_NAME version)
84
-
85
- - jq --arg version "$PUBLISHED_VERSION" '.version = $version' package.json > pkg.json && mv pkg.json package.json
86
- - MINOR_VERSION=$(npm version minor --no-git-tag-version)
87
-
51
+ - VERSION=$(npm version minor --no-git-tag-version)
88
52
  - git add package.json
89
53
  - git commit -m "chore(release):bump minor version [skip ci]"
90
- - git tag $MINOR_VERSION
91
- - git push origin $MINOR_VERSION
54
+ - git tag $VERSION
55
+ - git push origin $VERSION
92
56
  - pipe: atlassian/npm-publish:0.2.0
93
57
  variables:
94
58
  NPM_TOKEN: $NPM_TOKEN
@@ -108,17 +72,11 @@ pipelines:
108
72
  caches:
109
73
  - node
110
74
  script:
111
- - apt-get update && apt-get install -y jq
112
- - PACKAGE_NAME=$(jq -r .name package.json)
113
- - PUBLISHED_VERSION=$(npm view $PACKAGE_NAME version)
114
-
115
- - jq --arg version "$PUBLISHED_VERSION" '.version = $version' package.json > pkg.json && mv pkg.json package.json
116
- - MAJOR_VERSION=$(npm version major --no-git-tag-version)
117
-
75
+ - VERSION=$(npm version major --no-git-tag-version)
118
76
  - git add package.json
119
77
  - git commit -m "chore(release):bump major version [skip ci]"
120
- - git tag $MAJOR_VERSION
121
- - git push origin $MAJOR_VERSION
78
+ - git tag $VERSION
79
+ - git push origin $VERSION
122
80
  - pipe: atlassian/npm-publish:0.2.0
123
81
  variables:
124
82
  NPM_TOKEN: $NPM_TOKEN
@@ -4,8 +4,7 @@ export default class AccountEntity extends BaseEntity {
4
4
  tenantId?: string;
5
5
  name?: string;
6
6
  email?: string;
7
- personalDocument?: string;
8
- businessDocument?: string;
7
+ cellphone?: string;
9
8
  profile?: ProfileEntity;
10
9
  lastAccessAt?: Date;
11
10
  constructor(partial: Partial<AccountEntity>);
@@ -19,8 +19,7 @@ let AccountEntity = class AccountEntity extends base_1.default {
19
19
  tenantId;
20
20
  name;
21
21
  email;
22
- personalDocument;
23
- businessDocument;
22
+ cellphone;
24
23
  profile;
25
24
  lastAccessAt;
26
25
  constructor(partial) {
@@ -43,11 +42,7 @@ __decorate([
43
42
  __decorate([
44
43
  (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
45
44
  __metadata("design:type", String)
46
- ], AccountEntity.prototype, "personalDocument", void 0);
47
- __decorate([
48
- (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
49
- __metadata("design:type", String)
50
- ], AccountEntity.prototype, "businessDocument", void 0);
45
+ ], AccountEntity.prototype, "cellphone", void 0);
51
46
  __decorate([
52
47
  (0, typeorm_1.ManyToOne)(() => profile_1.default),
53
48
  (0, typeorm_1.JoinColumn)({ name: 'profileId', referencedColumnName: 'id' }),
@@ -1,11 +1,12 @@
1
1
  import BaseEntity from './base';
2
+ import CompanyAddressEntity from './company-address';
2
3
  export default class AddressEntity extends BaseEntity {
3
4
  zipcode?: string;
4
5
  street?: string;
5
6
  streetNumber?: string;
6
7
  complement?: string;
7
8
  city?: string;
8
- neighborhood?: string;
9
9
  state?: string;
10
+ companyAddresses?: CompanyAddressEntity[];
10
11
  constructor(partial: Partial<AddressEntity>);
11
12
  }
@@ -14,14 +14,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const typeorm_1 = require("typeorm");
16
16
  const base_1 = __importDefault(require("./base"));
17
+ const company_address_1 = __importDefault(require("./company-address"));
17
18
  let AddressEntity = class AddressEntity extends base_1.default {
18
19
  zipcode;
19
20
  street;
20
21
  streetNumber;
21
22
  complement;
22
23
  city;
23
- neighborhood;
24
24
  state;
25
+ companyAddresses;
25
26
  constructor(partial) {
26
27
  super();
27
28
  Object.assign(this, partial);
@@ -47,14 +48,14 @@ __decorate([
47
48
  (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
48
49
  __metadata("design:type", String)
49
50
  ], AddressEntity.prototype, "city", void 0);
50
- __decorate([
51
- (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
52
- __metadata("design:type", String)
53
- ], AddressEntity.prototype, "neighborhood", void 0);
54
51
  __decorate([
55
52
  (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
56
53
  __metadata("design:type", String)
57
54
  ], AddressEntity.prototype, "state", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.OneToMany)(() => company_address_1.default, (companyAddress) => companyAddress.address),
57
+ __metadata("design:type", Array)
58
+ ], AddressEntity.prototype, "companyAddresses", void 0);
58
59
  AddressEntity = __decorate([
59
60
  (0, typeorm_1.Entity)('address'),
60
61
  __metadata("design:paramtypes", [Object])
@@ -0,0 +1,10 @@
1
+ import AddressEntity from './address';
2
+ import BaseEntity from './base';
3
+ import CompanyEntity from './company';
4
+ export default class CompanyAddressEntity extends BaseEntity {
5
+ companyId?: string;
6
+ addressId?: string;
7
+ company?: CompanyEntity;
8
+ address?: AddressEntity;
9
+ constructor(partial: Partial<CompanyAddressEntity>);
10
+ }
@@ -0,0 +1,51 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const typeorm_1 = require("typeorm");
16
+ const address_1 = __importDefault(require("./address"));
17
+ const base_1 = __importDefault(require("./base"));
18
+ const company_1 = __importDefault(require("./company"));
19
+ let CompanyAddressEntity = class CompanyAddressEntity extends base_1.default {
20
+ companyId;
21
+ addressId;
22
+ company;
23
+ address;
24
+ constructor(partial) {
25
+ super();
26
+ Object.assign(this, partial);
27
+ }
28
+ };
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
31
+ __metadata("design:type", String)
32
+ ], CompanyAddressEntity.prototype, "companyId", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
35
+ __metadata("design:type", String)
36
+ ], CompanyAddressEntity.prototype, "addressId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => company_1.default, (company) => company.companyAddresses),
39
+ (0, typeorm_1.JoinColumn)({ name: 'companyId' }),
40
+ __metadata("design:type", company_1.default)
41
+ ], CompanyAddressEntity.prototype, "company", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.ManyToOne)(() => address_1.default, (address) => address.companyAddresses),
44
+ (0, typeorm_1.JoinColumn)({ name: 'addressId' }),
45
+ __metadata("design:type", address_1.default)
46
+ ], CompanyAddressEntity.prototype, "address", void 0);
47
+ CompanyAddressEntity = __decorate([
48
+ (0, typeorm_1.Entity)({ name: 'company_address' }),
49
+ __metadata("design:paramtypes", [Object])
50
+ ], CompanyAddressEntity);
51
+ exports.default = CompanyAddressEntity;
@@ -0,0 +1,13 @@
1
+ import BaseEntity from './base';
2
+ import CompanyAddressEntity from './company-address';
3
+ export default class CompanyEntity extends BaseEntity {
4
+ corporateName?: string;
5
+ fantasyName?: string;
6
+ businessDocument?: string;
7
+ primaryCNAE?: string;
8
+ secondaryCNAE?: string[];
9
+ stateRegistration?: string;
10
+ exempt?: boolean;
11
+ companyAddresses?: CompanyAddressEntity[];
12
+ constructor(partial: Partial<CompanyEntity>);
13
+ }
@@ -0,0 +1,68 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const typeorm_1 = require("typeorm");
16
+ const base_1 = __importDefault(require("./base"));
17
+ const company_address_1 = __importDefault(require("./company-address"));
18
+ let CompanyEntity = class CompanyEntity extends base_1.default {
19
+ corporateName;
20
+ fantasyName;
21
+ businessDocument;
22
+ primaryCNAE;
23
+ secondaryCNAE;
24
+ stateRegistration;
25
+ exempt;
26
+ companyAddresses;
27
+ constructor(partial) {
28
+ super();
29
+ Object.assign(this, partial);
30
+ }
31
+ };
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], CompanyEntity.prototype, "corporateName", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
38
+ __metadata("design:type", String)
39
+ ], CompanyEntity.prototype, "fantasyName", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
42
+ __metadata("design:type", String)
43
+ ], CompanyEntity.prototype, "businessDocument", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
46
+ __metadata("design:type", String)
47
+ ], CompanyEntity.prototype, "primaryCNAE", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'varchar', array: true, nullable: true }),
50
+ __metadata("design:type", Array)
51
+ ], CompanyEntity.prototype, "secondaryCNAE", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
54
+ __metadata("design:type", String)
55
+ ], CompanyEntity.prototype, "stateRegistration", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
58
+ __metadata("design:type", Boolean)
59
+ ], CompanyEntity.prototype, "exempt", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.OneToMany)(() => company_address_1.default, (companyAddress) => companyAddress.company),
62
+ __metadata("design:type", Array)
63
+ ], CompanyEntity.prototype, "companyAddresses", void 0);
64
+ CompanyEntity = __decorate([
65
+ (0, typeorm_1.Entity)({ name: 'company' }),
66
+ __metadata("design:paramtypes", [Object])
67
+ ], CompanyEntity);
68
+ exports.default = CompanyEntity;
@@ -2,8 +2,10 @@ import AccountEntity from './account';
2
2
  import AccountGroupEntity from './account-group';
3
3
  import AccountModuleEntity from './account-module';
4
4
  import AddressEntity from './address';
5
+ import CompanyEntity from './company';
6
+ import CompanyAddressEntity from './company-address';
5
7
  import GroupEntity from './group';
6
8
  import GroupModuleEntity from './group-module';
7
9
  import ModuleEntity from './module';
8
10
  import ProfileEntity from './profile';
9
- export { AccountEntity, AccountGroupEntity, AccountModuleEntity, GroupEntity, GroupModuleEntity, ModuleEntity, ProfileEntity, AddressEntity, };
11
+ export { AccountEntity, AccountGroupEntity, AccountModuleEntity, GroupEntity, GroupModuleEntity, ModuleEntity, ProfileEntity, AddressEntity, CompanyAddressEntity, CompanyEntity, };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AddressEntity = exports.ProfileEntity = exports.ModuleEntity = exports.GroupModuleEntity = exports.GroupEntity = exports.AccountModuleEntity = exports.AccountGroupEntity = exports.AccountEntity = void 0;
6
+ exports.CompanyEntity = exports.CompanyAddressEntity = exports.AddressEntity = exports.ProfileEntity = exports.ModuleEntity = exports.GroupModuleEntity = exports.GroupEntity = exports.AccountModuleEntity = exports.AccountGroupEntity = exports.AccountEntity = void 0;
7
7
  const account_1 = __importDefault(require("./account"));
8
8
  exports.AccountEntity = account_1.default;
9
9
  const account_group_1 = __importDefault(require("./account-group"));
@@ -12,6 +12,10 @@ const account_module_1 = __importDefault(require("./account-module"));
12
12
  exports.AccountModuleEntity = account_module_1.default;
13
13
  const address_1 = __importDefault(require("./address"));
14
14
  exports.AddressEntity = address_1.default;
15
+ const company_1 = __importDefault(require("./company"));
16
+ exports.CompanyEntity = company_1.default;
17
+ const company_address_1 = __importDefault(require("./company-address"));
18
+ exports.CompanyAddressEntity = company_address_1.default;
15
19
  const group_1 = __importDefault(require("./group"));
16
20
  exports.GroupEntity = group_1.default;
17
21
  const group_module_1 = __importDefault(require("./group-module"));
@@ -37,12 +37,7 @@ class CreateAccountsTable1748448589934 {
37
37
  isNullable: true,
38
38
  },
39
39
  {
40
- name: 'personalDocument',
41
- type: 'varchar',
42
- isNullable: true,
43
- },
44
- {
45
- name: 'businessDocument',
40
+ name: 'cellphone',
46
41
  type: 'varchar',
47
42
  isNullable: true,
48
43
  },
@@ -41,11 +41,6 @@ class CreateAddressTable1750432386920 {
41
41
  type: 'varchar',
42
42
  isNullable: true,
43
43
  },
44
- {
45
- name: 'neighborhood',
46
- type: 'varchar',
47
- isNullable: true,
48
- },
49
44
  {
50
45
  name: 'city',
51
46
  type: 'varchar',
@@ -1,5 +1,5 @@
1
1
  import { MigrationInterface, QueryRunner } from 'typeorm';
2
- export declare class CreateAccountDetailsTable1750691840822 implements MigrationInterface {
2
+ export declare class CreateCompanyTable1750437883213 implements MigrationInterface {
3
3
  up(queryRunner: QueryRunner): Promise<void>;
4
4
  down(queryRunner: QueryRunner): Promise<void>;
5
5
  }
@@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CreateAccountDetailsTable1750691840822 = void 0;
6
+ exports.CreateCompanyTable1750437883213 = void 0;
7
7
  const typeorm_1 = require("typeorm");
8
8
  const utils_1 = __importDefault(require("../utils"));
9
- class CreateAccountDetailsTable1750691840822 {
9
+ class CreateCompanyTable1750437883213 {
10
10
  async up(queryRunner) {
11
- const hasTable = await utils_1.default.checkHasTable('account_details', queryRunner);
11
+ const hasTable = await utils_1.default.checkHasTable('company', queryRunner);
12
12
  if (hasTable)
13
13
  return;
14
14
  await queryRunner.createTable(new typeorm_1.Table({
15
- name: 'account_details',
15
+ name: 'company',
16
16
  columns: [
17
17
  {
18
18
  name: 'id',
@@ -22,25 +22,41 @@ class CreateAccountDetailsTable1750691840822 {
22
22
  default: 'uuid_generate_v4()',
23
23
  },
24
24
  {
25
- name: 'accountId',
26
- type: 'uuid',
25
+ name: 'corporateName',
26
+ type: 'varchar',
27
+ isNullable: true,
28
+ },
29
+ {
30
+ name: 'fantasyName',
31
+ type: 'varchar',
32
+ isNullable: true,
33
+ },
34
+ {
35
+ name: 'businessDocument',
36
+ type: 'varchar',
27
37
  isNullable: true,
28
38
  },
29
39
  {
30
- name: 'position',
40
+ name: 'primaryCNAE',
31
41
  type: 'varchar',
32
42
  isNullable: true,
33
43
  },
34
44
  {
35
- name: 'immediateSuperior',
45
+ name: 'secondaryCNAE',
36
46
  type: 'varchar',
47
+ isArray: true,
37
48
  isNullable: true,
38
49
  },
39
50
  {
40
- name: 'photo',
51
+ name: 'stateRegistration',
41
52
  type: 'varchar',
42
53
  isNullable: true,
43
54
  },
55
+ {
56
+ name: 'exempt',
57
+ type: 'boolean',
58
+ isNullable: true,
59
+ },
44
60
  {
45
61
  name: 'createdBy',
46
62
  type: 'varchar',
@@ -72,28 +88,24 @@ class CreateAccountDetailsTable1750691840822 {
72
88
  isNullable: true,
73
89
  },
74
90
  ],
75
- foreignKeys: [
76
- {
77
- columnNames: ['accountId'],
78
- referencedTableName: 'account',
79
- referencedColumnNames: ['id'],
80
- },
81
- ],
82
91
  indices: [
83
92
  new typeorm_1.TableIndex({
84
- name: 'IDX_ACCOUNT_DETAILS',
85
- columnNames: ['id', 'accountId', 'position', 'immediateSuperior'],
93
+ name: 'IDX_COMPANY',
94
+ columnNames: [
95
+ 'id',
96
+ 'businessDocument',
97
+ 'stateRegistration',
98
+ ],
86
99
  }),
87
100
  ],
88
101
  }));
89
102
  }
90
103
  async down(queryRunner) {
91
- const hasTable = await utils_1.default.checkHasTable('account_details', queryRunner);
104
+ const hasTable = await utils_1.default.checkHasTable('company', queryRunner);
92
105
  if (!hasTable)
93
106
  return;
94
- await utils_1.default.dropTableForeignKeys('account_details', ['accountId'], queryRunner);
95
- await utils_1.default.dropIndex('account_details', 'IDX_ACCOUNT_DETAILS', queryRunner);
96
- await queryRunner.dropTable('account_details');
107
+ await utils_1.default.dropIndex('address', 'IDX_COMPANY', queryRunner);
108
+ await queryRunner.dropTable('company');
97
109
  }
98
110
  }
99
- exports.CreateAccountDetailsTable1750691840822 = CreateAccountDetailsTable1750691840822;
111
+ exports.CreateCompanyTable1750437883213 = CreateCompanyTable1750437883213;
@@ -1,5 +1,5 @@
1
1
  import { MigrationInterface, QueryRunner } from 'typeorm';
2
- export declare class CreateAccountAddressTable1750690818577 implements MigrationInterface {
2
+ export declare class CreateCompanyAddressTable1750440116105 implements MigrationInterface {
3
3
  up(queryRunner: QueryRunner): Promise<void>;
4
4
  down(queryRunner: QueryRunner): Promise<void>;
5
5
  }
@@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CreateAccountAddressTable1750690818577 = void 0;
6
+ exports.CreateCompanyAddressTable1750440116105 = void 0;
7
7
  const typeorm_1 = require("typeorm");
8
8
  const utils_1 = __importDefault(require("../utils"));
9
- class CreateAccountAddressTable1750690818577 {
9
+ class CreateCompanyAddressTable1750440116105 {
10
10
  async up(queryRunner) {
11
- const hasTable = await utils_1.default.checkHasTable('account_address', queryRunner);
11
+ const hasTable = await utils_1.default.checkHasTable('company_address', queryRunner);
12
12
  if (hasTable)
13
13
  return;
14
14
  await queryRunner.createTable(new typeorm_1.Table({
15
- name: 'account_address',
15
+ name: 'company_address',
16
16
  columns: [
17
17
  {
18
18
  name: 'id',
@@ -22,14 +22,14 @@ class CreateAccountAddressTable1750690818577 {
22
22
  default: 'uuid_generate_v4()',
23
23
  },
24
24
  {
25
- name: 'accountId',
25
+ name: 'companyId',
26
26
  type: 'uuid',
27
- isNullable: false,
27
+ isNullable: true,
28
28
  },
29
29
  {
30
30
  name: 'addressId',
31
31
  type: 'uuid',
32
- isNullable: false,
32
+ isNullable: true,
33
33
  },
34
34
  {
35
35
  name: 'createdBy',
@@ -64,31 +64,24 @@ class CreateAccountAddressTable1750690818577 {
64
64
  ],
65
65
  foreignKeys: [
66
66
  {
67
- columnNames: ['accountId'],
67
+ columnNames: ['companyId'],
68
+ referencedTableName: 'company',
68
69
  referencedColumnNames: ['id'],
69
- referencedTableName: 'account',
70
70
  },
71
71
  {
72
72
  columnNames: ['addressId'],
73
- referencedColumnNames: ['id'],
74
73
  referencedTableName: 'address',
74
+ referencedColumnNames: ['id'],
75
75
  },
76
76
  ],
77
- indices: [
78
- new typeorm_1.TableIndex({
79
- name: 'IDX_ACCOUNT_ADDRESS',
80
- columnNames: ['id', 'accountId', 'addressId'],
81
- }),
82
- ],
83
77
  }));
84
78
  }
85
79
  async down(queryRunner) {
86
- const hasTable = await utils_1.default.checkHasTable('account_address', queryRunner);
80
+ const hasTable = await utils_1.default.checkHasTable('company_address', queryRunner);
87
81
  if (!hasTable)
88
82
  return;
89
- await utils_1.default.dropTableForeignKeys('account_address', ['accountId', 'addressId'], queryRunner);
90
- await utils_1.default.dropIndex('account_address', 'IDX_ACCOUNT_ADDRESS', queryRunner);
91
- await queryRunner.dropTable('account_address');
83
+ await utils_1.default.dropTableForeignKeys('company_address', ['companyId', 'addressId'], queryRunner);
84
+ await queryRunner.dropTable('company_address');
92
85
  }
93
86
  }
94
- exports.CreateAccountAddressTable1750690818577 = CreateAccountAddressTable1750690818577;
87
+ exports.CreateCompanyAddressTable1750440116105 = CreateCompanyAddressTable1750440116105;
@@ -1,30 +1,2 @@
1
1
  import { Init1748448461165 } from './1748448461165-Init';
2
- import { CreateProfilesTable1748448589743 } from './1748448589743-CreateProfilesTable';
3
- import { CreateAccountsTable1748448589934 } from './1748448589934-CreateAccountsTable';
4
- import { CreateLeadsTable1748448590133 } from './1748448590133-CreateLeadsTable';
5
- import { CreateLeadResponsiblesTable1748448590361 } from './1748448590361-CreateLeadResponsiblesTable';
6
- import { CreateGroupTable1748449000000 } from './1749142281608-CreateGroupTable';
7
- import { CreateAccountGroupTable1748449000100 } from './1749142314101-CreateAccountGroupTable';
8
- import { CreateGroupModuleTable1748449000200 } from './1749142329095-CreateGroupModuleTable';
9
- import { CreateAccountModuleTable1748449000300 } from './1749142343254-CreateAccountModuleTable';
10
- import { CreateCredentialsTable1749477835922 } from './1749477835922-CreateCredentialsTable';
11
- import { CreateAccountContactTable1750432386914 } from './1750432386914-CreateAccountContactTable';
12
- import { CreateAddressTable1750432386920 } from './1750432386920-CreateAddressTable';
13
- import { CreateAccountAddressTable1750690818577 } from './1750690818577-CreateAccountAddressTable';
14
- import { CreateAccountDetailsTable1750691840822 } from './1750691840822-CreateAccountDetailsTable';
15
- export declare const Migrations: {
16
- Init1748448461165: typeof Init1748448461165;
17
- CreateProfilesTable1748448589743: typeof CreateProfilesTable1748448589743;
18
- CreateAccountsTable1748448589934: typeof CreateAccountsTable1748448589934;
19
- CreateLeadsTable1748448590133: typeof CreateLeadsTable1748448590133;
20
- CreateLeadResponsiblesTable1748448590361: typeof CreateLeadResponsiblesTable1748448590361;
21
- CreateGroupTable1748449000000: typeof CreateGroupTable1748449000000;
22
- CreateAccountGroupTable1748449000100: typeof CreateAccountGroupTable1748449000100;
23
- CreateGroupModuleTable1748449000200: typeof CreateGroupModuleTable1748449000200;
24
- CreateAccountModuleTable1748449000300: typeof CreateAccountModuleTable1748449000300;
25
- CreateCredentialsTable1749477835922: typeof CreateCredentialsTable1749477835922;
26
- CreateAccountContactTable1750432386914: typeof CreateAccountContactTable1750432386914;
27
- CreateAddressTable1750432386920: typeof CreateAddressTable1750432386920;
28
- CreateAccountAddressTable1750690818577: typeof CreateAccountAddressTable1750690818577;
29
- CreateAccountDetailsTable1750691840822: typeof CreateAccountDetailsTable1750691840822;
30
- };
2
+ export declare const Migrations: (typeof Init1748448461165)[];
@@ -13,21 +13,21 @@ const _1749142343254_CreateAccountModuleTable_1 = require("./1749142343254-Creat
13
13
  const _1749477835922_CreateCredentialsTable_1 = require("./1749477835922-CreateCredentialsTable");
14
14
  const _1750432386914_CreateAccountContactTable_1 = require("./1750432386914-CreateAccountContactTable");
15
15
  const _1750432386920_CreateAddressTable_1 = require("./1750432386920-CreateAddressTable");
16
- const _1750690818577_CreateAccountAddressTable_1 = require("./1750690818577-CreateAccountAddressTable");
17
- const _1750691840822_CreateAccountDetailsTable_1 = require("./1750691840822-CreateAccountDetailsTable");
18
- exports.Migrations = {
19
- Init1748448461165: _1748448461165_Init_1.Init1748448461165,
20
- CreateProfilesTable1748448589743: _1748448589743_CreateProfilesTable_1.CreateProfilesTable1748448589743,
21
- CreateAccountsTable1748448589934: _1748448589934_CreateAccountsTable_1.CreateAccountsTable1748448589934,
22
- CreateLeadsTable1748448590133: _1748448590133_CreateLeadsTable_1.CreateLeadsTable1748448590133,
23
- CreateLeadResponsiblesTable1748448590361: _1748448590361_CreateLeadResponsiblesTable_1.CreateLeadResponsiblesTable1748448590361,
24
- CreateGroupTable1748449000000: _1749142281608_CreateGroupTable_1.CreateGroupTable1748449000000,
25
- CreateAccountGroupTable1748449000100: _1749142314101_CreateAccountGroupTable_1.CreateAccountGroupTable1748449000100,
26
- CreateGroupModuleTable1748449000200: _1749142329095_CreateGroupModuleTable_1.CreateGroupModuleTable1748449000200,
27
- CreateAccountModuleTable1748449000300: _1749142343254_CreateAccountModuleTable_1.CreateAccountModuleTable1748449000300,
28
- CreateCredentialsTable1749477835922: _1749477835922_CreateCredentialsTable_1.CreateCredentialsTable1749477835922,
29
- CreateAccountContactTable1750432386914: _1750432386914_CreateAccountContactTable_1.CreateAccountContactTable1750432386914,
30
- CreateAddressTable1750432386920: _1750432386920_CreateAddressTable_1.CreateAddressTable1750432386920,
31
- CreateAccountAddressTable1750690818577: _1750690818577_CreateAccountAddressTable_1.CreateAccountAddressTable1750690818577,
32
- CreateAccountDetailsTable1750691840822: _1750691840822_CreateAccountDetailsTable_1.CreateAccountDetailsTable1750691840822,
33
- };
16
+ const _1750437883213_CreateCompanyTable_1 = require("./1750437883213-CreateCompanyTable");
17
+ const _1750440116105_CreateCompanyAddressTable_1 = require("./1750440116105-CreateCompanyAddressTable");
18
+ exports.Migrations = [
19
+ _1748448461165_Init_1.Init1748448461165,
20
+ _1748448589743_CreateProfilesTable_1.CreateProfilesTable1748448589743,
21
+ _1748448589934_CreateAccountsTable_1.CreateAccountsTable1748448589934,
22
+ _1748448590133_CreateLeadsTable_1.CreateLeadsTable1748448590133,
23
+ _1748448590361_CreateLeadResponsiblesTable_1.CreateLeadResponsiblesTable1748448590361,
24
+ _1749142281608_CreateGroupTable_1.CreateGroupTable1748449000000,
25
+ _1749142314101_CreateAccountGroupTable_1.CreateAccountGroupTable1748449000100,
26
+ _1749142329095_CreateGroupModuleTable_1.CreateGroupModuleTable1748449000200,
27
+ _1749142343254_CreateAccountModuleTable_1.CreateAccountModuleTable1748449000300,
28
+ _1749477835922_CreateCredentialsTable_1.CreateCredentialsTable1749477835922,
29
+ _1750432386914_CreateAccountContactTable_1.CreateAccountContactTable1750432386914,
30
+ _1750432386920_CreateAddressTable_1.CreateAddressTable1750432386920,
31
+ _1750437883213_CreateCompanyTable_1.CreateCompanyTable1750437883213,
32
+ _1750440116105_CreateCompanyAddressTable_1.CreateCompanyAddressTable1750440116105,
33
+ ];