@natrave/shared-entities 8.26.0 → 8.27.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.
@@ -6,6 +6,7 @@ export declare class BillingSubscriptionGrant {
6
6
  reason: string;
7
7
  grantedBy: string;
8
8
  grantedAt: Date;
9
+ categoryLimit: number | null;
9
10
  expiresAt: Date | null;
10
11
  revokedAt: Date | null;
11
12
  revokedBy: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"billing-subscription-grant.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-grants/billing-subscription-grant.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAkC/D,qBAaa,wBAAwB;IAInC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,IAAI,EAAE,MAAM,CAAC;IAMb,MAAM,EAAE,MAAM,CAAC;IAQf,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAQvB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAO5B,SAAS,EAAE,IAAI,CAAC;IAehB,YAAY,EAAE,mBAAmB,CAAC;CACnC"}
1
+ {"version":3,"file":"billing-subscription-grant.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-subscription-grants/billing-subscription-grant.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAwC/D,qBAiBa,wBAAwB;IAInC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,IAAI,EAAE,MAAM,CAAC;IAMb,MAAM,EAAE,MAAM,CAAC;IAQf,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAQhB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ7B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAQvB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAO5B,SAAS,EAAE,IAAI,CAAC;IAehB,YAAY,EAAE,mBAAmB,CAAC;CACnC"}
@@ -62,6 +62,14 @@ __decorateClass([
62
62
  comment: "Quando a concess\xE3o foi dada (cria\xE7\xE3o = concess\xE3o)."
63
63
  })
64
64
  ], BillingSubscriptionGrant.prototype, "grantedAt", 2);
65
+ __decorateClass([
66
+ Column({
67
+ name: "category_limit",
68
+ type: "int",
69
+ nullable: true,
70
+ comment: "Quantas categorias a concess\xE3o cobre, contando a licen\xE7a. Nulo = todas."
71
+ })
72
+ ], BillingSubscriptionGrant.prototype, "categoryLimit", 2);
65
73
  __decorateClass([
66
74
  Column({
67
75
  name: "expires_at",
@@ -119,6 +127,10 @@ BillingSubscriptionGrant = __decorateClass([
119
127
  where: `"revoked_at" IS NULL`
120
128
  }),
121
129
  Check("CHK_billing_subscription_grants_reason_not_blank", `btrim("reason") <> ''`),
130
+ Check(
131
+ "CHK_billing_subscription_grants_category_limit_positive",
132
+ `"category_limit" IS NULL OR "category_limit" >= 1`
133
+ ),
122
134
  Check(
123
135
  "CHK_billing_subscription_grants_revocation_complete",
124
136
  `("revoked_at" IS NULL AND "revoked_by" IS NULL AND "revoke_reason" IS NULL)
@@ -1,4 +1,5 @@
1
1
  import { BillingPlan } from '../billing-plans';
2
+ import { BillingSubscriptionGrant } from '../billing-subscription-grants';
2
3
  import { BillingSubscription } from '../billing-subscriptions';
3
4
  import { BillingCoveredEntityType } from './enums/billing-covered-entity-type.enum';
4
5
  import { BillingSubscriptionItemStatus } from './enums/billing-subscription-item-status.enum';
@@ -9,6 +10,7 @@ export declare class BillingSubscriptionItem {
9
10
  coveredEntityType: BillingCoveredEntityType;
10
11
  coveredEntityId: number;
11
12
  status: BillingSubscriptionItemStatus;
13
+ coveredByGrantId: string | null;
12
14
  quantity: number;
13
15
  activatedAt: Date | null;
14
16
  canceledAt: Date | null;
@@ -16,5 +18,6 @@ export declare class BillingSubscriptionItem {
16
18
  updatedAt: Date;
17
19
  subscription: BillingSubscription;
18
20
  plan: BillingPlan;
21
+ coveredByGrant: BillingSubscriptionGrant | null;
19
22
  }
20
23
  //# sourceMappingURL=billing-subscription-item.entity.d.ts.map
@@ -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":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAqB9F,qBAWa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,MAAM,EAAE,MAAM,CAAC;IASf,iBAAiB,EAAE,wBAAwB,CAAC;IAO5C,eAAe,EAAE,MAAM,CAAC;IASxB,MAAM,EAAE,6BAA6B,CAAC;IAOtC,QAAQ,EAAE,MAAM,CAAC;IAQjB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAOxB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAahB,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,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AA2B9F,qBAaa,uBAAuB;IAIlC,EAAE,EAAE,MAAM,CAAC;IAOX,cAAc,EAAE,MAAM,CAAC;IAOvB,MAAM,EAAE,MAAM,CAAC;IASf,iBAAiB,EAAE,wBAAwB,CAAC;IAO5C,eAAe,EAAE,MAAM,CAAC;IASxB,MAAM,EAAE,6BAA6B,CAAC;IAStC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAOhC,QAAQ,EAAE,MAAM,CAAC;IAQjB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAOxB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAahB,YAAY,EAAE,mBAAmB,CAAC;IAUlC,IAAI,EAAE,WAAW,CAAC;IAclB,cAAc,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACjD"}
@@ -20,6 +20,7 @@ import {
20
20
  UpdateDateColumn
21
21
  } from "typeorm";
22
22
  import { BillingPlan } from "../billing-plans/index.js";
23
+ import { BillingSubscriptionGrant } from "../billing-subscription-grants/index.js";
23
24
  import { BillingSubscription } from "../billing-subscriptions/index.js";
24
25
  import { BillingCoveredEntityType } from "./enums/billing-covered-entity-type.enum.js";
25
26
  import { BillingSubscriptionItemStatus } from "./enums/billing-subscription-item-status.enum.js";
@@ -69,6 +70,14 @@ __decorateClass([
69
70
  comment: "Estado do entitlement da categoria (pending_payment/active/canceled)."
70
71
  })
71
72
  ], BillingSubscriptionItem.prototype, "status", 2);
73
+ __decorateClass([
74
+ Column({
75
+ name: "covered_by_grant_id",
76
+ type: "uuid",
77
+ nullable: true,
78
+ comment: "Concess\xE3o (cortesia) que liberou esta categoria dentro do limite dela. Nulo = n\xE3o coberta."
79
+ })
80
+ ], BillingSubscriptionItem.prototype, "coveredByGrantId", 2);
72
81
  __decorateClass([
73
82
  Column({
74
83
  type: "int",
@@ -118,12 +127,23 @@ __decorateClass([
118
127
  }),
119
128
  JoinColumn({ name: "plan_id" })
120
129
  ], BillingSubscriptionItem.prototype, "plan", 2);
130
+ __decorateClass([
131
+ ManyToOne(() => BillingSubscriptionGrant, {
132
+ onDelete: "RESTRICT",
133
+ nullable: true
134
+ }),
135
+ JoinColumn({
136
+ name: "covered_by_grant_id",
137
+ foreignKeyConstraintName: "FK_billing_subscription_items_covered_by_grant"
138
+ })
139
+ ], BillingSubscriptionItem.prototype, "coveredByGrant", 2);
121
140
  BillingSubscriptionItem = __decorateClass([
122
141
  Entity("billing_subscription_items"),
123
142
  Check("CHK_billing_subscription_items_quantity_positive", '"quantity" >= 1'),
124
143
  Index("idx_billing_subscription_items_subscription", ["subscriptionId"]),
125
144
  Index("idx_billing_subscription_items_plan", ["planId"]),
126
145
  Index("idx_billing_subscription_items_covered", ["coveredEntityType", "coveredEntityId"]),
146
+ Index("idx_billing_subscription_items_covered_by_grant", ["coveredByGrantId"]),
127
147
  Index(
128
148
  "UQ_billing_subscription_items_live_covered",
129
149
  ["subscriptionId", "coveredEntityType", "coveredEntityId"],
@@ -12,5 +12,5 @@ import { Player, PlayerPersonalData, PlayerPosition } from '../players';
12
12
  import { PlayerTeam, Team, TeamAccessCode, TeamJoinRequest, TeamKit, TeamModality, TeamSponsor, TeamTrophy } from '../teams';
13
13
  import { Referee, RegulationExtraction, Tournament, TournamentAllowedPhone, TournamentBillingOutbox, TournamentBracket, TournamentBracketSlot, TournamentCategoryGroup, TournamentContact, TournamentCoupon, TournamentCreationDraft, TournamentFacility, TournamentFollow, TournamentFormatConfig, TournamentGroup, TournamentGroupContact, TournamentMatch, TournamentMatchAvailability, TournamentMatchCard, TournamentMatchGoal, TournamentMatchKit, TournamentMatchObservation, TournamentMatchPlayerNumber, TournamentMatchReferee, TournamentMatchRule, TournamentMatchSchema, TournamentMatchSubstitution, TournamentMatchTimeout, TournamentPayment, TournamentPenaltyShootout, TournamentPlayer, TournamentPlayerRule, TournamentPointsAdjustment, TournamentPrizeRule, TournamentPublicationChargeRule, TournamentRegistrationRequest, TournamentRegistrationRequirement, TournamentRegulationFieldStatus, TournamentTeam, TournamentTeamInvitation, TournamentTieBreakConfig } from '../tournaments';
14
14
  import { UserDomainEvent, UserEventView } from '../user-events';
15
- export declare const DATABASE_ENTITIES: (typeof PasswordReset | typeof Notification | typeof User | typeof NotificationDelivery | typeof NotificationDispatchLog | typeof PushDeviceToken | typeof UserNotificationPreference | typeof TeamPlayerMergeHistory | typeof Team | typeof PlayerTeam | typeof Player | typeof TournamentMatchGoal | typeof TournamentTeam | typeof TournamentMatch | typeof TournamentPlayer | typeof TournamentMatchKit | typeof TournamentMatchSubstitution | typeof TournamentMatchTimeout | typeof TournamentPenaltyShootout | typeof TournamentMatchReferee | typeof Referee | typeof RegulationExtraction | typeof Tournament | typeof TournamentAllowedPhone | typeof PhoneNumber | typeof TournamentBillingOutbox | typeof TournamentGroupContact | typeof TournamentCategoryGroup | typeof Organization | typeof TournamentContact | typeof Coupon | typeof CouponUsage | typeof TournamentCoupon | typeof TournamentCreationDraft | typeof City | typeof FacilityImage | typeof Facility | typeof FacilityOwner | typeof Field | typeof FieldImage | typeof TournamentFacility | typeof TournamentFollow | typeof TournamentFormatConfig | typeof TournamentMatchObservation | typeof TournamentMatchPlayerNumber | typeof TournamentMatchRule | typeof TournamentMatchSchema | typeof TournamentMatchAvailability | typeof UserPaymentProvider | typeof PaymentProvider | typeof Payment | typeof TournamentPayment | typeof OrganizationUser | typeof TournamentPlayerRule | typeof TournamentPointsAdjustment | typeof TournamentPrizeRule | typeof TournamentPublicationChargeRule | typeof TournamentRegistrationRequest | typeof TournamentRegistrationRequirement | typeof TournamentRegulationFieldStatus | typeof TournamentTeamInvitation | typeof TournamentTieBreakConfig | typeof Address | typeof OrganizationUserBillingInfo | typeof TournamentGroup | typeof TournamentBracket | typeof TournamentBracketSlot | typeof TeamTrophy | typeof TournamentMatchCard | typeof TeamAccessCode | typeof TeamJoinRequest | typeof TeamKit | typeof TeamModality | typeof TeamSponsor | typeof PlayerPosition | typeof PlayerPersonalData | typeof UserAuthProvider | typeof RefreshToken | typeof UserOnboardingIntent | typeof UserVerification | typeof BillingProduct | typeof BillingPlan | typeof BillingSubscriptionItem | typeof BillingSubscription | typeof BillingAccount | typeof BillingEvent | typeof BillingInvoice | typeof BillingInvoiceLineItem | typeof BillingMatchUsage | typeof BillingPayment | typeof BillingProviderWebhookEvent | typeof BillingSubscriptionGrant | typeof FeedActivityReaction | typeof FeedActivity | typeof FeedActivitySubject | typeof FeedOutbox | typeof FinanceAuditEvent | typeof FinanceEntryItem | typeof FinanceEntry | typeof FinanceLedger | typeof UserDomainEvent | typeof UserEventView)[];
15
+ export declare const DATABASE_ENTITIES: (typeof PasswordReset | typeof Notification | typeof User | typeof NotificationDelivery | typeof NotificationDispatchLog | typeof PushDeviceToken | typeof UserNotificationPreference | typeof TeamPlayerMergeHistory | typeof Team | typeof PlayerTeam | typeof Player | typeof TournamentMatchGoal | typeof TournamentTeam | typeof TournamentMatch | typeof TournamentPlayer | typeof TournamentMatchKit | typeof TournamentMatchSubstitution | typeof TournamentMatchTimeout | typeof TournamentPenaltyShootout | typeof TournamentMatchReferee | typeof Referee | typeof RegulationExtraction | typeof Tournament | typeof TournamentAllowedPhone | typeof PhoneNumber | typeof TournamentBillingOutbox | typeof TournamentGroupContact | typeof TournamentCategoryGroup | typeof Organization | typeof TournamentContact | typeof Coupon | typeof CouponUsage | typeof TournamentCoupon | typeof TournamentCreationDraft | typeof City | typeof FacilityImage | typeof Facility | typeof FacilityOwner | typeof Field | typeof FieldImage | typeof TournamentFacility | typeof TournamentFollow | typeof TournamentFormatConfig | typeof TournamentMatchObservation | typeof TournamentMatchPlayerNumber | typeof TournamentMatchRule | typeof TournamentMatchSchema | typeof TournamentMatchAvailability | typeof UserPaymentProvider | typeof PaymentProvider | typeof Payment | typeof TournamentPayment | typeof OrganizationUser | typeof TournamentPlayerRule | typeof TournamentPointsAdjustment | typeof TournamentPrizeRule | typeof TournamentPublicationChargeRule | typeof TournamentRegistrationRequest | typeof TournamentRegistrationRequirement | typeof TournamentRegulationFieldStatus | typeof TournamentTeamInvitation | typeof TournamentTieBreakConfig | typeof Address | typeof OrganizationUserBillingInfo | typeof TournamentGroup | typeof TournamentBracket | typeof TournamentBracketSlot | typeof TeamTrophy | typeof TournamentMatchCard | typeof TeamAccessCode | typeof TeamJoinRequest | typeof TeamKit | typeof TeamModality | typeof TeamSponsor | typeof PlayerPosition | typeof PlayerPersonalData | typeof UserAuthProvider | typeof RefreshToken | typeof UserOnboardingIntent | typeof UserVerification | typeof BillingProduct | typeof BillingPlan | typeof BillingSubscriptionGrant | typeof BillingSubscription | typeof BillingSubscriptionItem | typeof BillingAccount | typeof BillingEvent | typeof BillingInvoice | typeof BillingInvoiceLineItem | typeof BillingMatchUsage | typeof BillingPayment | typeof BillingProviderWebhookEvent | typeof FeedActivityReaction | typeof FeedActivity | typeof FeedActivitySubject | typeof FeedOutbox | typeof FinanceAuditEvent | typeof FinanceEntryItem | typeof FinanceEntry | typeof FinanceLedger | typeof UserDomainEvent | typeof UserEventView)[];
16
16
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "8.26.0",
3
+ "version": "8.27.0",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",