@natrave/shared-entities 7.3.0 → 7.4.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 (30) hide show
  1. package/dist/billing/billing-accounts/billing-account.entity.d.ts +17 -4
  2. package/dist/billing/billing-accounts/billing-account.entity.d.ts.map +1 -1
  3. package/dist/billing/billing-accounts/billing-account.entity.js +128 -16
  4. package/dist/billing/billing-accounts/enums/billing-account-billable-entity-type.enum.d.ts +4 -0
  5. package/dist/billing/billing-accounts/enums/billing-account-billable-entity-type.enum.d.ts.map +1 -0
  6. package/dist/billing/billing-accounts/enums/billing-account-billable-entity-type.enum.js +7 -0
  7. package/dist/billing/billing-accounts/enums/billing-person-type.enum.d.ts +5 -0
  8. package/dist/billing/billing-accounts/enums/billing-person-type.enum.d.ts.map +1 -0
  9. package/dist/billing/billing-accounts/enums/billing-person-type.enum.js +8 -0
  10. package/dist/billing/billing-accounts/index.d.ts +2 -1
  11. package/dist/billing/billing-accounts/index.d.ts.map +1 -1
  12. package/dist/billing/billing-accounts/index.js +2 -1
  13. package/dist/billing/billing-subscription-items/billing-subscription-item.entity.d.ts.map +1 -1
  14. package/dist/billing/billing-subscription-items/billing-subscription-item.entity.js +3 -1
  15. package/dist/billing/billing-subscriptions/billing-subscription.entity.d.ts +3 -3
  16. package/dist/billing/billing-subscriptions/billing-subscription.entity.d.ts.map +1 -1
  17. package/dist/billing/billing-subscriptions/billing-subscription.entity.js +11 -11
  18. package/dist/billing/billing-subscriptions/enums/billing-subject-entity-type.enum.d.ts +4 -0
  19. package/dist/billing/billing-subscriptions/enums/billing-subject-entity-type.enum.d.ts.map +1 -0
  20. package/dist/billing/billing-subscriptions/enums/billing-subject-entity-type.enum.js +7 -0
  21. package/dist/billing/billing-subscriptions/index.d.ts +1 -1
  22. package/dist/billing/billing-subscriptions/index.d.ts.map +1 -1
  23. package/dist/billing/billing-subscriptions/index.js +1 -1
  24. package/package.json +1 -1
  25. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.d.ts +0 -4
  26. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.d.ts.map +0 -1
  27. package/dist/billing/billing-accounts/enums/billing-account-owner-type.enum.js +0 -7
  28. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.d.ts +0 -4
  29. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.d.ts.map +0 -1
  30. package/dist/billing/billing-subscriptions/enums/billing-resource-type.enum.js +0 -7
@@ -1,10 +1,23 @@
1
1
  import { BillingSubscription } from '../billing-subscriptions';
2
- import { BillingAccountOwnerType } from './enums/billing-account-owner-type.enum';
2
+ import { BillingAccountBillableEntityType } from './enums/billing-account-billable-entity-type.enum';
3
+ import { BillingPersonType } from './enums/billing-person-type.enum';
3
4
  export declare class BillingAccount {
4
5
  id: string;
5
- ownerType: BillingAccountOwnerType;
6
- ownerId: number;
7
- creditBalance: number;
6
+ billableEntityType: BillingAccountBillableEntityType;
7
+ billableEntityId: number;
8
+ personType: BillingPersonType | null;
9
+ document: string | null;
10
+ legalName: string | null;
11
+ email: string | null;
12
+ phone: string | null;
13
+ addressPostalCode: string | null;
14
+ addressStreet: string | null;
15
+ addressNumber: string | null;
16
+ addressComplement: string | null;
17
+ addressNeighborhood: string | null;
18
+ addressCity: string | null;
19
+ addressState: string | null;
20
+ addressCountry: string | null;
8
21
  createdAt: Date;
9
22
  updatedAt: Date;
10
23
  subscriptions: BillingSubscription[];
@@ -1 +1 @@
1
- {"version":3,"file":"billing-account.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/billing-account.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAalF,qBAGa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IASX,SAAS,EAAE,uBAAuB,CAAC;IAOnC,OAAO,EAAE,MAAM,CAAC;IAQhB,aAAa,EAAE,MAAM,CAAC;IAOtB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC"}
1
+ {"version":3,"file":"billing-account.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/billing-account.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAiBrE,qBAGa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IASX,kBAAkB,EAAE,gCAAgC,CAAC;IAOrD,gBAAgB,EAAE,MAAM,CAAC;IAYzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC;IASrC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IASxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IASzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAWrB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IASjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAS7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAS7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IASjC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IASnC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAS3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAU5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAO9B,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC"}
@@ -19,7 +19,8 @@ import {
19
19
  UpdateDateColumn
20
20
  } from "typeorm";
21
21
  import { BillingSubscription } from "../billing-subscriptions/index.js";
22
- import { BillingAccountOwnerType } from "./enums/billing-account-owner-type.enum.js";
22
+ import { BillingAccountBillableEntityType } from "./enums/billing-account-billable-entity-type.enum.js";
23
+ import { BillingPersonType } from "./enums/billing-person-type.enum.js";
23
24
  let BillingAccount = class {
24
25
  };
25
26
  __decorateClass([
@@ -29,28 +30,139 @@ __decorateClass([
29
30
  ], BillingAccount.prototype, "id", 2);
30
31
  __decorateClass([
31
32
  Column({
32
- name: "owner_type",
33
+ name: "billable_entity_type",
33
34
  type: "enum",
34
- enum: BillingAccountOwnerType,
35
- enumName: "billing_accounts_owner_type_enum",
36
- comment: "Tipo do dono da conta (ex.: organization)."
35
+ enum: BillingAccountBillableEntityType,
36
+ enumName: "billing_accounts_billable_entity_type_enum",
37
+ comment: "Tipo do pagador dono da conta (ex.: organization)."
37
38
  })
38
- ], BillingAccount.prototype, "ownerType", 2);
39
+ ], BillingAccount.prototype, "billableEntityType", 2);
39
40
  __decorateClass([
40
41
  Column({
41
- name: "owner_id",
42
+ name: "billable_entity_id",
42
43
  type: "int",
43
- comment: "Identificador do dono da conta no seu dom\xEDnio (ex.: organization.id)."
44
+ comment: "Identificador do pagador no seu dom\xEDnio (soft-ref, ex.: organization.id)."
44
45
  })
45
- ], BillingAccount.prototype, "ownerId", 2);
46
+ ], BillingAccount.prototype, "billableEntityId", 2);
46
47
  __decorateClass([
47
48
  Column({
48
- name: "credit_balance",
49
- type: "int",
50
- default: 0,
51
- comment: "Saldo de cr\xE9dito da conta em centavos (estornos/cr\xE9ditos). Nunca negativo."
49
+ name: "person_type",
50
+ type: "enum",
51
+ enum: BillingPersonType,
52
+ enumName: "billing_accounts_person_type_enum",
53
+ nullable: true,
54
+ comment: "Natureza jur\xEDdica do pagador (individual \u2192 CPF, company \u2192 CNPJ)."
55
+ })
56
+ ], BillingAccount.prototype, "personType", 2);
57
+ __decorateClass([
58
+ Column({
59
+ name: "document",
60
+ type: "varchar",
61
+ length: 14,
62
+ nullable: true,
63
+ comment: "Documento fiscal, s\xF3 d\xEDgitos: CPF (11) ou CNPJ (14)."
64
+ })
65
+ ], BillingAccount.prototype, "document", 2);
66
+ __decorateClass([
67
+ Column({
68
+ name: "legal_name",
69
+ type: "varchar",
70
+ length: 255,
71
+ nullable: true,
72
+ comment: "Nome completo (pessoa f\xEDsica) ou raz\xE3o social (pessoa jur\xEDdica)."
73
+ })
74
+ ], BillingAccount.prototype, "legalName", 2);
75
+ __decorateClass([
76
+ Column({
77
+ name: "email",
78
+ type: "varchar",
79
+ length: 255,
80
+ nullable: true,
81
+ comment: "E-mail de contato de cobran\xE7a."
82
+ })
83
+ ], BillingAccount.prototype, "email", 2);
84
+ __decorateClass([
85
+ Column({
86
+ name: "phone",
87
+ type: "varchar",
88
+ length: 20,
89
+ nullable: true,
90
+ comment: "Telefone de contato (d\xEDgitos / E.164)."
91
+ })
92
+ ], BillingAccount.prototype, "phone", 2);
93
+ __decorateClass([
94
+ Column({
95
+ name: "address_postal_code",
96
+ type: "varchar",
97
+ length: 8,
98
+ nullable: true,
99
+ comment: "CEP, s\xF3 d\xEDgitos."
100
+ })
101
+ ], BillingAccount.prototype, "addressPostalCode", 2);
102
+ __decorateClass([
103
+ Column({
104
+ name: "address_street",
105
+ type: "varchar",
106
+ length: 255,
107
+ nullable: true,
108
+ comment: "Logradouro."
109
+ })
110
+ ], BillingAccount.prototype, "addressStreet", 2);
111
+ __decorateClass([
112
+ Column({
113
+ name: "address_number",
114
+ type: "varchar",
115
+ length: 20,
116
+ nullable: true,
117
+ comment: 'N\xFAmero (varchar: aceita "S/N", "123-A").'
118
+ })
119
+ ], BillingAccount.prototype, "addressNumber", 2);
120
+ __decorateClass([
121
+ Column({
122
+ name: "address_complement",
123
+ type: "varchar",
124
+ length: 100,
125
+ nullable: true,
126
+ comment: "Complemento do endere\xE7o."
127
+ })
128
+ ], BillingAccount.prototype, "addressComplement", 2);
129
+ __decorateClass([
130
+ Column({
131
+ name: "address_neighborhood",
132
+ type: "varchar",
133
+ length: 100,
134
+ nullable: true,
135
+ comment: "Bairro."
136
+ })
137
+ ], BillingAccount.prototype, "addressNeighborhood", 2);
138
+ __decorateClass([
139
+ Column({
140
+ name: "address_city",
141
+ type: "varchar",
142
+ length: 100,
143
+ nullable: true,
144
+ comment: "Cidade."
145
+ })
146
+ ], BillingAccount.prototype, "addressCity", 2);
147
+ __decorateClass([
148
+ Column({
149
+ name: "address_state",
150
+ type: "char",
151
+ length: 2,
152
+ nullable: true,
153
+ comment: "UF (ex.: SP)."
154
+ })
155
+ ], BillingAccount.prototype, "addressState", 2);
156
+ __decorateClass([
157
+ Column({
158
+ name: "address_country",
159
+ type: "char",
160
+ length: 2,
161
+ default: "BR",
162
+ nullable: true,
163
+ comment: "Pa\xEDs (ISO 3166-1 alpha-2). Default BR."
52
164
  })
53
- ], BillingAccount.prototype, "creditBalance", 2);
165
+ ], BillingAccount.prototype, "addressCountry", 2);
54
166
  __decorateClass([
55
167
  CreateDateColumn({
56
168
  name: "created_at",
@@ -70,8 +182,8 @@ __decorateClass([
70
182
  ], BillingAccount.prototype, "subscriptions", 2);
71
183
  BillingAccount = __decorateClass([
72
184
  Entity("billing_accounts"),
73
- Unique("UQ_billing_accounts_owner", ["ownerType", "ownerId"]),
74
- Index("idx_billing_accounts_owner", ["ownerType", "ownerId"])
185
+ Unique("UQ_billing_accounts_billable_entity", ["billableEntityType", "billableEntityId"]),
186
+ Index("idx_billing_accounts_billable_entity", ["billableEntityType", "billableEntityId"])
75
187
  ], BillingAccount);
76
188
  export {
77
189
  BillingAccount
@@ -0,0 +1,4 @@
1
+ export declare enum BillingAccountBillableEntityType {
2
+ ORGANIZATION = "organization"
3
+ }
4
+ //# sourceMappingURL=billing-account-billable-entity-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-account-billable-entity-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-accounts/enums/billing-account-billable-entity-type.enum.ts"],"names":[],"mappings":"AAYA,oBAAY,gCAAgC;IAI1C,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,7 @@
1
+ var BillingAccountBillableEntityType = /* @__PURE__ */ ((BillingAccountBillableEntityType2) => {
2
+ BillingAccountBillableEntityType2["ORGANIZATION"] = "organization";
3
+ return BillingAccountBillableEntityType2;
4
+ })(BillingAccountBillableEntityType || {});
5
+ export {
6
+ BillingAccountBillableEntityType
7
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum BillingPersonType {
2
+ INDIVIDUAL = "individual",
3
+ COMPANY = "company"
4
+ }
5
+ //# sourceMappingURL=billing-person-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-person-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-accounts/enums/billing-person-type.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,iBAAiB;IAI3B,UAAU,eAAe;IAKzB,OAAO,YAAY;CACpB"}
@@ -0,0 +1,8 @@
1
+ var BillingPersonType = /* @__PURE__ */ ((BillingPersonType2) => {
2
+ BillingPersonType2["INDIVIDUAL"] = "individual";
3
+ BillingPersonType2["COMPANY"] = "company";
4
+ return BillingPersonType2;
5
+ })(BillingPersonType || {});
6
+ export {
7
+ BillingPersonType
8
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './billing-account.entity';
2
- export * from './enums/billing-account-owner-type.enum';
2
+ export * from './enums/billing-account-billable-entity-type.enum';
3
+ export * from './enums/billing-person-type.enum';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-accounts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mDAAmD,CAAC;AAClE,cAAc,kCAAkC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./billing-account.entity.js";
2
- export * from "./enums/billing-account-owner-type.enum.js";
2
+ export * from "./enums/billing-account-billable-entity-type.enum.js";
3
+ export * from "./enums/billing-person-type.enum.js";
@@ -1 +1 @@
1
- {"version":3,"file":"billing-subscription-item.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-items/billing-subscription-item.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAc/D,qBAGa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,MAAM,EAAE,MAAM,CAAC;IAOf,QAAQ,EAAE,MAAM,CAAC;IAOjB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,YAAY,EAAE,mBAAmB,CAAC;IAUlC,IAAI,EAAE,WAAW,CAAC;CACnB"}
1
+ {"version":3,"file":"billing-subscription-item.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-items/billing-subscription-item.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAc/D,qBAIa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,MAAM,EAAE,MAAM,CAAC;IAOf,QAAQ,EAAE,MAAM,CAAC;IAOjB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAahB,YAAY,EAAE,mBAAmB,CAAC;IAUlC,IAAI,EAAE,WAAW,CAAC;CACnB"}
@@ -9,6 +9,7 @@ var __decorateClass = (decorators, target, key, kind) => {
9
9
  return result;
10
10
  };
11
11
  import {
12
+ Check,
12
13
  Column,
13
14
  CreateDateColumn,
14
15
  Entity,
@@ -64,7 +65,7 @@ __decorateClass([
64
65
  ], BillingSubscriptionItem.prototype, "updatedAt", 2);
65
66
  __decorateClass([
66
67
  ManyToOne(() => BillingSubscription, (subscription) => subscription.items, {
67
- onDelete: "CASCADE"
68
+ onDelete: "RESTRICT"
68
69
  }),
69
70
  JoinColumn({ name: "subscription_id" })
70
71
  ], BillingSubscriptionItem.prototype, "subscription", 2);
@@ -76,6 +77,7 @@ __decorateClass([
76
77
  ], BillingSubscriptionItem.prototype, "plan", 2);
77
78
  BillingSubscriptionItem = __decorateClass([
78
79
  Entity("billing_subscription_items"),
80
+ Check("CHK_billing_subscription_items_quantity_positive", '"quantity" >= 1'),
79
81
  Index("idx_billing_subscription_items_subscription", ["subscriptionId"]),
80
82
  Index("idx_billing_subscription_items_plan", ["planId"])
81
83
  ], BillingSubscriptionItem);
@@ -1,12 +1,12 @@
1
1
  import { BillingAccount } from '../billing-accounts';
2
2
  import { BillingSubscriptionItem } from '../billing-subscription-items';
3
- import { BillingResourceType } from './enums/billing-resource-type.enum';
3
+ import { BillingSubjectEntityType } from './enums/billing-subject-entity-type.enum';
4
4
  import { BillingSubscriptionStatus } from './enums/billing-subscription-status.enum';
5
5
  export declare class BillingSubscription {
6
6
  id: string;
7
7
  billingAccountId: string;
8
- resourceType: BillingResourceType;
9
- resourceId: number;
8
+ subjectEntityType: BillingSubjectEntityType;
9
+ subjectEntityId: number;
10
10
  status: BillingSubscriptionStatus;
11
11
  trialStartsAt: Date | null;
12
12
  trialEndsAt: Date | null;
@@ -1 +1 @@
1
- {"version":3,"file":"billing-subscription.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscriptions/billing-subscription.entity.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAiBrF,qBAUa,mBAAmB;IAI9B,EAAE,EAAE,MAAM,CAAC;IAOX,gBAAgB,EAAE,MAAM,CAAC;IASzB,YAAY,EAAE,mBAAmB,CAAC;IAOlC,UAAU,EAAE,MAAM,CAAC;IASnB,MAAM,EAAE,yBAAyB,CAAC;IAQlC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAQ3B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAQxB,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAQhC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAO9B,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,cAAc,EAAE,cAAc,CAAC;IAM/B,KAAK,EAAE,uBAAuB,EAAE,CAAC;CAClC"}
1
+ {"version":3,"file":"billing-subscription.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscriptions/billing-subscription.entity.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAiBrF,qBAUa,mBAAmB;IAI9B,EAAE,EAAE,MAAM,CAAC;IAOX,gBAAgB,EAAE,MAAM,CAAC;IASzB,iBAAiB,EAAE,wBAAwB,CAAC;IAO5C,eAAe,EAAE,MAAM,CAAC;IASxB,MAAM,EAAE,yBAAyB,CAAC;IAQlC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAQ3B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAQxB,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAQhC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAO9B,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAYhB,cAAc,EAAE,cAAc,CAAC;IAM/B,KAAK,EAAE,uBAAuB,EAAE,CAAC;CAClC"}
@@ -22,7 +22,7 @@ import {
22
22
  } from "typeorm";
23
23
  import { BillingAccount } from "../billing-accounts/index.js";
24
24
  import { BillingSubscriptionItem } from "../billing-subscription-items/index.js";
25
- import { BillingResourceType } from "./enums/billing-resource-type.enum.js";
25
+ import { BillingSubjectEntityType } from "./enums/billing-subject-entity-type.enum.js";
26
26
  import { BillingSubscriptionStatus } from "./enums/billing-subscription-status.enum.js";
27
27
  let BillingSubscription = class {
28
28
  };
@@ -40,20 +40,20 @@ __decorateClass([
40
40
  ], BillingSubscription.prototype, "billingAccountId", 2);
41
41
  __decorateClass([
42
42
  Column({
43
- name: "resource_type",
43
+ name: "subject_entity_type",
44
44
  type: "enum",
45
- enum: BillingResourceType,
46
- enumName: "billing_subscriptions_resource_type_enum",
47
- comment: "Tipo do recurso cobr\xE1vel (ex.: tournament_category_group)."
45
+ enum: BillingSubjectEntityType,
46
+ enumName: "billing_subscriptions_subject_entity_type_enum",
47
+ comment: "Tipo do objeto assinado (ex.: tournament_category_group)."
48
48
  })
49
- ], BillingSubscription.prototype, "resourceType", 2);
49
+ ], BillingSubscription.prototype, "subjectEntityType", 2);
50
50
  __decorateClass([
51
51
  Column({
52
- name: "resource_id",
52
+ name: "subject_entity_id",
53
53
  type: "int",
54
- comment: "Identificador do recurso cobr\xE1vel no seu dom\xEDnio (ex.: category_group.id)."
54
+ comment: "Identificador do objeto assinado no seu dom\xEDnio (soft-ref, ex.: category_group.id)."
55
55
  })
56
- ], BillingSubscription.prototype, "resourceId", 2);
56
+ ], BillingSubscription.prototype, "subjectEntityId", 2);
57
57
  __decorateClass([
58
58
  Column({
59
59
  type: "enum",
@@ -136,9 +136,9 @@ __decorateClass([
136
136
  ], BillingSubscription.prototype, "items", 2);
137
137
  BillingSubscription = __decorateClass([
138
138
  Entity("billing_subscriptions"),
139
- Unique("UQ_billing_subscriptions_resource", ["resourceType", "resourceId"]),
139
+ Unique("UQ_billing_subscriptions_subject", ["subjectEntityType", "subjectEntityId"]),
140
140
  Index("idx_billing_subscriptions_account", ["billingAccountId"]),
141
- Index("idx_billing_subscriptions_resource", ["resourceType", "resourceId"]),
141
+ Index("idx_billing_subscriptions_subject", ["subjectEntityType", "subjectEntityId"]),
142
142
  Index("idx_billing_subscriptions_status", ["status"]),
143
143
  Index("idx_billing_subscriptions_trial_expiring", ["trialEndsAt"], {
144
144
  where: `"status" = 'trialing'`
@@ -0,0 +1,4 @@
1
+ export declare enum BillingSubjectEntityType {
2
+ TOURNAMENT_CATEGORY_GROUP = "tournament_category_group"
3
+ }
4
+ //# sourceMappingURL=billing-subject-entity-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-subject-entity-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-subscriptions/enums/billing-subject-entity-type.enum.ts"],"names":[],"mappings":"AAYA,oBAAY,wBAAwB;IAIlC,yBAAyB,8BAA8B;CACxD"}
@@ -0,0 +1,7 @@
1
+ var BillingSubjectEntityType = /* @__PURE__ */ ((BillingSubjectEntityType2) => {
2
+ BillingSubjectEntityType2["TOURNAMENT_CATEGORY_GROUP"] = "tournament_category_group";
3
+ return BillingSubjectEntityType2;
4
+ })(BillingSubjectEntityType || {});
5
+ export {
6
+ BillingSubjectEntityType
7
+ };
@@ -1,4 +1,4 @@
1
1
  export * from './billing-subscription.entity';
2
- export * from './enums/billing-resource-type.enum';
2
+ export * from './enums/billing-subject-entity-type.enum';
3
3
  export * from './enums/billing-subscription-status.enum';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscriptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscriptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./billing-subscription.entity.js";
2
- export * from "./enums/billing-resource-type.enum.js";
2
+ export * from "./enums/billing-subject-entity-type.enum.js";
3
3
  export * from "./enums/billing-subscription-status.enum.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -1,4 +0,0 @@
1
- export declare enum BillingAccountOwnerType {
2
- ORGANIZATION = "organization"
3
- }
4
- //# sourceMappingURL=billing-account-owner-type.enum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"billing-account-owner-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-accounts/enums/billing-account-owner-type.enum.ts"],"names":[],"mappings":"AAWA,oBAAY,uBAAuB;IAIjC,YAAY,iBAAiB;CAC9B"}
@@ -1,7 +0,0 @@
1
- var BillingAccountOwnerType = /* @__PURE__ */ ((BillingAccountOwnerType2) => {
2
- BillingAccountOwnerType2["ORGANIZATION"] = "organization";
3
- return BillingAccountOwnerType2;
4
- })(BillingAccountOwnerType || {});
5
- export {
6
- BillingAccountOwnerType
7
- };
@@ -1,4 +0,0 @@
1
- export declare enum BillingResourceType {
2
- TOURNAMENT_CATEGORY_GROUP = "tournament_category_group"
3
- }
4
- //# sourceMappingURL=billing-resource-type.enum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"billing-resource-type.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-subscriptions/enums/billing-resource-type.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,mBAAmB;IAI7B,yBAAyB,8BAA8B;CACxD"}
@@ -1,7 +0,0 @@
1
- var BillingResourceType = /* @__PURE__ */ ((BillingResourceType2) => {
2
- BillingResourceType2["TOURNAMENT_CATEGORY_GROUP"] = "tournament_category_group";
3
- return BillingResourceType2;
4
- })(BillingResourceType || {});
5
- export {
6
- BillingResourceType
7
- };