@experts_hub/shared 1.0.675 → 1.0.676

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.
package/dist/index.mjs CHANGED
@@ -13170,73 +13170,30 @@ JobRoles = __decorateClass([
13170
13170
  Entity71("job_roles")
13171
13171
  ], JobRoles);
13172
13172
 
13173
- // src/entities/plan.entity.ts
13174
- import { Entity as Entity73, Column as Column74, ManyToMany as ManyToMany3, JoinTable } from "typeorm";
13175
-
13176
- // src/entities/feature.entity.ts
13177
- import { Entity as Entity72, Column as Column73, ManyToMany as ManyToMany2 } from "typeorm";
13178
- var Feature = class extends BaseEntity {
13179
- };
13180
- __decorateClass([
13181
- Column73({ name: "name", type: "varchar", unique: true })
13182
- ], Feature.prototype, "name", 2);
13183
- __decorateClass([
13184
- ManyToMany2(() => Plan, (plan) => plan.features)
13185
- ], Feature.prototype, "plans", 2);
13186
- Feature = __decorateClass([
13187
- Entity72("features")
13188
- ], Feature);
13189
-
13190
- // src/entities/plan.entity.ts
13191
- var Plan = class extends BaseEntity {
13192
- };
13193
- __decorateClass([
13194
- Column74({ name: "name", type: "varchar", unique: true })
13195
- ], Plan.prototype, "name", 2);
13196
- __decorateClass([
13197
- Column74({ name: "description", type: "varchar", nullable: true })
13198
- ], Plan.prototype, "description", 2);
13199
- __decorateClass([
13200
- Column74({ name: "price", type: "decimal", precision: 10, scale: 2 })
13201
- ], Plan.prototype, "price", 2);
13202
- __decorateClass([
13203
- Column74({ name: "billing_period", type: "varchar" })
13204
- ], Plan.prototype, "billingPeriod", 2);
13205
- __decorateClass([
13206
- Column74({ name: "is_current", type: "boolean", default: false })
13207
- ], Plan.prototype, "isCurrent", 2);
13208
- __decorateClass([
13209
- ManyToMany3(() => Feature, (feature) => feature.plans, { cascade: true }),
13210
- JoinTable()
13211
- ], Plan.prototype, "features", 2);
13212
- Plan = __decorateClass([
13213
- Entity73("plans")
13214
- ], Plan);
13215
-
13216
13173
  // src/entities/cms.entity.ts
13217
- import { Entity as Entity74, Column as Column75 } from "typeorm";
13174
+ import { Entity as Entity72, Column as Column73 } from "typeorm";
13218
13175
  var Cms = class extends BaseEntity {
13219
13176
  };
13220
13177
  __decorateClass([
13221
- Column75({ name: "title", type: "varchar", nullable: true })
13178
+ Column73({ name: "title", type: "varchar", nullable: true })
13222
13179
  ], Cms.prototype, "title", 2);
13223
13180
  __decorateClass([
13224
- Column75({ name: "slug", type: "varchar", nullable: true, unique: true })
13181
+ Column73({ name: "slug", type: "varchar", nullable: true, unique: true })
13225
13182
  ], Cms.prototype, "slug", 2);
13226
13183
  __decorateClass([
13227
- Column75({ name: "content", type: "varchar", nullable: true })
13184
+ Column73({ name: "content", type: "varchar", nullable: true })
13228
13185
  ], Cms.prototype, "content", 2);
13229
13186
  __decorateClass([
13230
- Column75({ name: "is_active", type: "boolean", default: true })
13187
+ Column73({ name: "is_active", type: "boolean", default: true })
13231
13188
  ], Cms.prototype, "isActive", 2);
13232
13189
  Cms = __decorateClass([
13233
- Entity74("cms")
13190
+ Entity72("cms")
13234
13191
  ], Cms);
13235
13192
 
13236
13193
  // src/entities/lead.entity.ts
13237
13194
  import {
13238
- Entity as Entity75,
13239
- Column as Column76
13195
+ Entity as Entity73,
13196
+ Column as Column74
13240
13197
  } from "typeorm";
13241
13198
  var CategoryEmum = /* @__PURE__ */ ((CategoryEmum2) => {
13242
13199
  CategoryEmum2["BUSINESS"] = "BUSINESS";
@@ -13246,22 +13203,22 @@ var CategoryEmum = /* @__PURE__ */ ((CategoryEmum2) => {
13246
13203
  var Lead = class extends BaseEntity {
13247
13204
  };
13248
13205
  __decorateClass([
13249
- Column76({ name: "name", type: "varchar", nullable: true })
13206
+ Column74({ name: "name", type: "varchar", nullable: true })
13250
13207
  ], Lead.prototype, "name", 2);
13251
13208
  __decorateClass([
13252
- Column76({ name: "mobile_code", type: "varchar", nullable: true })
13209
+ Column74({ name: "mobile_code", type: "varchar", nullable: true })
13253
13210
  ], Lead.prototype, "mobileCode", 2);
13254
13211
  __decorateClass([
13255
- Column76({ name: "mobile", type: "varchar", nullable: true })
13212
+ Column74({ name: "mobile", type: "varchar", nullable: true })
13256
13213
  ], Lead.prototype, "mobile", 2);
13257
13214
  __decorateClass([
13258
- Column76({ name: "email", type: "varchar", nullable: true })
13215
+ Column74({ name: "email", type: "varchar", nullable: true })
13259
13216
  ], Lead.prototype, "email", 2);
13260
13217
  __decorateClass([
13261
- Column76({ name: "description", type: "varchar", nullable: true })
13218
+ Column74({ name: "description", type: "varchar", nullable: true })
13262
13219
  ], Lead.prototype, "description", 2);
13263
13220
  __decorateClass([
13264
- Column76({
13221
+ Column74({
13265
13222
  name: "category",
13266
13223
  type: "enum",
13267
13224
  enum: CategoryEmum,
@@ -13269,7 +13226,7 @@ __decorateClass([
13269
13226
  })
13270
13227
  ], Lead.prototype, "category", 2);
13271
13228
  Lead = __decorateClass([
13272
- Entity75("leads")
13229
+ Entity73("leads")
13273
13230
  ], Lead);
13274
13231
 
13275
13232
  // src/entities/job-freelancer-recommendation.entity.ts
@@ -13510,7 +13467,7 @@ ClientFreelancerRecommendation = __decorateClass([
13510
13467
  ], ClientFreelancerRecommendation);
13511
13468
 
13512
13469
  // src/entities/commission.entity.ts
13513
- import { Entity as Entity76, Column as Column77 } from "typeorm";
13470
+ import { Entity as Entity74, Column as Column75 } from "typeorm";
13514
13471
  var CommissionTypeEnum = /* @__PURE__ */ ((CommissionTypeEnum2) => {
13515
13472
  CommissionTypeEnum2["PERCENTAGE"] = "PERCENTAGE";
13516
13473
  CommissionTypeEnum2["FLAT"] = "FLAT";
@@ -13519,7 +13476,7 @@ var CommissionTypeEnum = /* @__PURE__ */ ((CommissionTypeEnum2) => {
13519
13476
  var Commission = class extends BaseEntity {
13520
13477
  };
13521
13478
  __decorateClass([
13522
- Column77({
13479
+ Column75({
13523
13480
  name: "freelancer_commission_type",
13524
13481
  type: "enum",
13525
13482
  enum: CommissionTypeEnum,
@@ -13527,10 +13484,10 @@ __decorateClass([
13527
13484
  })
13528
13485
  ], Commission.prototype, "freelancerCommissionType", 2);
13529
13486
  __decorateClass([
13530
- Column77({ name: "freelancer_commission", type: "integer", default: 0 })
13487
+ Column75({ name: "freelancer_commission", type: "integer", default: 0 })
13531
13488
  ], Commission.prototype, "freelancerCommission", 2);
13532
13489
  __decorateClass([
13533
- Column77({
13490
+ Column75({
13534
13491
  name: "client_commission_type",
13535
13492
  type: "enum",
13536
13493
  enum: CommissionTypeEnum,
@@ -13538,58 +13495,58 @@ __decorateClass([
13538
13495
  })
13539
13496
  ], Commission.prototype, "clientCommissionType", 2);
13540
13497
  __decorateClass([
13541
- Column77({ name: "client_commission", type: "integer", default: 0 })
13498
+ Column75({ name: "client_commission", type: "integer", default: 0 })
13542
13499
  ], Commission.prototype, "clientCommission", 2);
13543
13500
  Commission = __decorateClass([
13544
- Entity76("commissions")
13501
+ Entity74("commissions")
13545
13502
  ], Commission);
13546
13503
 
13547
13504
  // src/entities/calendly-meeting-log.entity.ts
13548
13505
  import {
13549
- Entity as Entity77,
13550
- Column as Column78,
13506
+ Entity as Entity75,
13507
+ Column as Column76,
13551
13508
  Index as Index61
13552
13509
  } from "typeorm";
13553
13510
  var CalendlyMeetingLog = class extends BaseEntity {
13554
13511
  };
13555
13512
  __decorateClass([
13556
- Column78({ name: "calendly_event_id", type: "varchar", nullable: true }),
13513
+ Column76({ name: "calendly_event_id", type: "varchar", nullable: true }),
13557
13514
  Index61()
13558
13515
  ], CalendlyMeetingLog.prototype, "calendlyEventId", 2);
13559
13516
  __decorateClass([
13560
- Column78({ name: "calendly_event_type", type: "varchar", nullable: true })
13517
+ Column76({ name: "calendly_event_type", type: "varchar", nullable: true })
13561
13518
  ], CalendlyMeetingLog.prototype, "calendlyEventType", 2);
13562
13519
  __decorateClass([
13563
- Column78({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13520
+ Column76({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13564
13521
  ], CalendlyMeetingLog.prototype, "rawWebhookData", 2);
13565
13522
  CalendlyMeetingLog = __decorateClass([
13566
- Entity77("calendly_meeting_logs")
13523
+ Entity75("calendly_meeting_logs")
13567
13524
  ], CalendlyMeetingLog);
13568
13525
 
13569
13526
  // src/entities/zoom-meeting-log.entity.ts
13570
13527
  import {
13571
- Entity as Entity78,
13572
- Column as Column79,
13528
+ Entity as Entity76,
13529
+ Column as Column77,
13573
13530
  Index as Index62
13574
13531
  } from "typeorm";
13575
13532
  var ZoomMeetingLog = class extends BaseEntity {
13576
13533
  };
13577
13534
  __decorateClass([
13578
- Column79({ name: "zoom_meeting_id", type: "varchar", nullable: true }),
13535
+ Column77({ name: "zoom_meeting_id", type: "varchar", nullable: true }),
13579
13536
  Index62()
13580
13537
  ], ZoomMeetingLog.prototype, "zoomMeetingId", 2);
13581
13538
  __decorateClass([
13582
- Column79({ name: "zoom_event_type", type: "varchar", nullable: true })
13539
+ Column77({ name: "zoom_event_type", type: "varchar", nullable: true })
13583
13540
  ], ZoomMeetingLog.prototype, "zoomEventType", 2);
13584
13541
  __decorateClass([
13585
- Column79({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13542
+ Column77({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13586
13543
  ], ZoomMeetingLog.prototype, "rawWebhookData", 2);
13587
13544
  ZoomMeetingLog = __decorateClass([
13588
- Entity78("zoom_meeting_logs")
13545
+ Entity76("zoom_meeting_logs")
13589
13546
  ], ZoomMeetingLog);
13590
13547
 
13591
13548
  // src/entities/docuseal.entity.ts
13592
- import { Entity as Entity79, Column as Column80, Index as Index63 } from "typeorm";
13549
+ import { Entity as Entity77, Column as Column78, Index as Index63 } from "typeorm";
13593
13550
  var DocuSealTypeEnum = /* @__PURE__ */ ((DocuSealTypeEnum2) => {
13594
13551
  DocuSealTypeEnum2["FREELANCER_SERVICE_AGGREMENT"] = "FREELANCER_SERVICE_AGGREMENT";
13595
13552
  DocuSealTypeEnum2["CLIENT_SERVICE_AGGREMENT"] = "CLIENT_SERVICE_AGGREMENT";
@@ -13599,56 +13556,56 @@ var DocuSealTypeEnum = /* @__PURE__ */ ((DocuSealTypeEnum2) => {
13599
13556
  var DocuSeal = class extends BaseEntity {
13600
13557
  };
13601
13558
  __decorateClass([
13602
- Column80({ name: "reference_id", type: "integer", nullable: false }),
13559
+ Column78({ name: "reference_id", type: "integer", nullable: false }),
13603
13560
  Index63()
13604
13561
  ], DocuSeal.prototype, "referenceId", 2);
13605
13562
  __decorateClass([
13606
- Column80({ name: "submitter_id", type: "integer", nullable: true }),
13563
+ Column78({ name: "submitter_id", type: "integer", nullable: true }),
13607
13564
  Index63()
13608
13565
  ], DocuSeal.prototype, "submitterId", 2);
13609
13566
  __decorateClass([
13610
- Column80({ name: "submitter_response", type: "jsonb", nullable: true })
13567
+ Column78({ name: "submitter_response", type: "jsonb", nullable: true })
13611
13568
  ], DocuSeal.prototype, "submitterResponse", 2);
13612
13569
  __decorateClass([
13613
- Column80({ name: "webhook_response", type: "jsonb", nullable: true })
13570
+ Column78({ name: "webhook_response", type: "jsonb", nullable: true })
13614
13571
  ], DocuSeal.prototype, "webhookResponse", 2);
13615
13572
  __decorateClass([
13616
- Column80({ name: "type", type: "enum", enum: DocuSealTypeEnum, nullable: true })
13573
+ Column78({ name: "type", type: "enum", enum: DocuSealTypeEnum, nullable: true })
13617
13574
  ], DocuSeal.prototype, "type", 2);
13618
13575
  DocuSeal = __decorateClass([
13619
- Entity79("docuseal")
13576
+ Entity77("docuseal")
13620
13577
  ], DocuSeal);
13621
13578
 
13622
13579
  // src/entities/stripe-logs.entity.ts
13623
- import { Entity as Entity80, Column as Column81 } from "typeorm";
13580
+ import { Entity as Entity78, Column as Column79 } from "typeorm";
13624
13581
  var StripeLog = class extends BaseEntity {
13625
13582
  };
13626
13583
  __decorateClass([
13627
- Column81({ name: "stripe_event_id", type: "varchar", nullable: true })
13584
+ Column79({ name: "stripe_event_id", type: "varchar", nullable: true })
13628
13585
  ], StripeLog.prototype, "stripeEventId", 2);
13629
13586
  __decorateClass([
13630
- Column81({ name: "event_type", type: "varchar", nullable: true })
13587
+ Column79({ name: "event_type", type: "varchar", nullable: true })
13631
13588
  ], StripeLog.prototype, "eventType", 2);
13632
13589
  __decorateClass([
13633
- Column81({ name: "stripe_account_id", type: "varchar", nullable: true })
13590
+ Column79({ name: "stripe_account_id", type: "varchar", nullable: true })
13634
13591
  ], StripeLog.prototype, "stripeAccountId", 2);
13635
13592
  __decorateClass([
13636
- Column81({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13593
+ Column79({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13637
13594
  ], StripeLog.prototype, "rawWebhookData", 2);
13638
13595
  StripeLog = __decorateClass([
13639
- Entity80("stripe_logs")
13596
+ Entity78("stripe_logs")
13640
13597
  ], StripeLog);
13641
13598
 
13642
13599
  // src/entities/recommendation-weightage-config.entity.ts
13643
13600
  import {
13644
- Entity as Entity81,
13645
- Column as Column82,
13601
+ Entity as Entity79,
13602
+ Column as Column80,
13646
13603
  Index as Index64
13647
13604
  } from "typeorm";
13648
13605
  var RecommendationWeightageConfig = class extends BaseEntity {
13649
13606
  };
13650
13607
  __decorateClass([
13651
- Column82({
13608
+ Column80({
13652
13609
  type: "varchar",
13653
13610
  length: 100,
13654
13611
  unique: true,
@@ -13657,37 +13614,273 @@ __decorateClass([
13657
13614
  Index64()
13658
13615
  ], RecommendationWeightageConfig.prototype, "key", 2);
13659
13616
  __decorateClass([
13660
- Column82({
13617
+ Column80({
13661
13618
  type: "jsonb",
13662
13619
  comment: "JSON object containing weight values",
13663
13620
  nullable: true
13664
13621
  })
13665
13622
  ], RecommendationWeightageConfig.prototype, "value", 2);
13666
13623
  __decorateClass([
13667
- Column82({ name: "is_active", type: "boolean", default: true })
13624
+ Column80({ name: "is_active", type: "boolean", default: true })
13668
13625
  ], RecommendationWeightageConfig.prototype, "isActive", 2);
13669
13626
  RecommendationWeightageConfig = __decorateClass([
13670
- Entity81("recommendation_weightage_configs")
13627
+ Entity79("recommendation_weightage_configs")
13671
13628
  ], RecommendationWeightageConfig);
13672
13629
 
13673
13630
  // src/entities/global-setting.entity.ts
13674
13631
  import {
13675
- Entity as Entity82,
13676
- Column as Column83,
13632
+ Entity as Entity80,
13633
+ Column as Column81,
13677
13634
  Index as Index65
13678
13635
  } from "typeorm";
13679
13636
  var GlobalSetting = class extends BaseEntity {
13680
13637
  };
13681
13638
  __decorateClass([
13682
- Column83({ name: "key", type: "varchar", length: 255, nullable: false, unique: true })
13639
+ Column81({ name: "key", type: "varchar", length: 255, nullable: false, unique: true })
13683
13640
  ], GlobalSetting.prototype, "key", 2);
13684
13641
  __decorateClass([
13685
- Column83({ name: "value", type: "text", nullable: false })
13642
+ Column81({ name: "value", type: "text", nullable: false })
13686
13643
  ], GlobalSetting.prototype, "value", 2);
13687
13644
  GlobalSetting = __decorateClass([
13688
- Entity82("global_settings"),
13645
+ Entity80("global_settings"),
13689
13646
  Index65(["key"], { unique: true })
13690
13647
  ], GlobalSetting);
13648
+
13649
+ // src/entities/plan.entity.ts
13650
+ import {
13651
+ Entity as Entity83,
13652
+ Column as Column84,
13653
+ Index as Index68,
13654
+ Check as Check4,
13655
+ BeforeInsert as BeforeInsert2,
13656
+ BeforeUpdate as BeforeUpdate2,
13657
+ OneToMany as OneToMany29
13658
+ } from "typeorm";
13659
+
13660
+ // src/entities/plan-feature.entity.ts
13661
+ import {
13662
+ Entity as Entity81,
13663
+ Column as Column82,
13664
+ ManyToOne as ManyToOne63,
13665
+ JoinColumn as JoinColumn64,
13666
+ Index as Index66,
13667
+ Check as Check2
13668
+ } from "typeorm";
13669
+ var PlanFeature = class extends BaseEntity {
13670
+ };
13671
+ // individual index to find features by plan
13672
+ __decorateClass([
13673
+ Column82({ name: "plan_id", type: "integer", nullable: false }),
13674
+ Index66()
13675
+ ], PlanFeature.prototype, "planId", 2);
13676
+ __decorateClass([
13677
+ ManyToOne63(() => Plan, (plan) => plan.features, {
13678
+ onDelete: "CASCADE",
13679
+ nullable: false
13680
+ }),
13681
+ JoinColumn64({ name: "plan_id" })
13682
+ ], PlanFeature.prototype, "plan", 2);
13683
+ __decorateClass([
13684
+ Column82({ name: "label", type: "varchar", length: 200 })
13685
+ ], PlanFeature.prototype, "label", 2);
13686
+ __decorateClass([
13687
+ Column82({ name: "tooltip", type: "varchar", length: 300, nullable: true })
13688
+ ], PlanFeature.prototype, "tooltip", 2);
13689
+ __decorateClass([
13690
+ Column82({ name: "sort_order", type: "smallint", default: 0 })
13691
+ ], PlanFeature.prototype, "sortOrder", 2);
13692
+ __decorateClass([
13693
+ Column82({ name: "is_active", type: "boolean", default: true })
13694
+ ], PlanFeature.prototype, "isActive", 2);
13695
+ PlanFeature = __decorateClass([
13696
+ Entity81("plan_features"),
13697
+ Index66("idx_plan_features_plan_id", ["plan"]),
13698
+ Index66("idx_plan_features_plan_sort", ["plan", "sort_order"]),
13699
+ Check2("chk_plan_features_sort_order_positive", '"sort_order" >= 0')
13700
+ ], PlanFeature);
13701
+
13702
+ // src/entities/plan-pricing.entity.ts
13703
+ import {
13704
+ Entity as Entity82,
13705
+ Column as Column83,
13706
+ ManyToOne as ManyToOne64,
13707
+ JoinColumn as JoinColumn65,
13708
+ Index as Index67,
13709
+ Unique,
13710
+ Check as Check3,
13711
+ BeforeInsert,
13712
+ BeforeUpdate
13713
+ } from "typeorm";
13714
+ var BillingCycle = /* @__PURE__ */ ((BillingCycle2) => {
13715
+ BillingCycle2["MONTHLY"] = "monthly";
13716
+ BillingCycle2["YEARLY"] = "yearly";
13717
+ return BillingCycle2;
13718
+ })(BillingCycle || {});
13719
+ var PlanPricing = class extends BaseEntity {
13720
+ sanitize() {
13721
+ if (this.currency) {
13722
+ this.currency = this.currency.toUpperCase().trim();
13723
+ }
13724
+ if (this.price !== void 0 && this.price !== null) {
13725
+ this.price = parseFloat(this.price);
13726
+ }
13727
+ if (this.originalPrice !== void 0 && this.originalPrice !== null) {
13728
+ this.originalPrice = parseFloat(
13729
+ this.originalPrice
13730
+ );
13731
+ }
13732
+ if (this.isFree) {
13733
+ this.price = 0;
13734
+ this.originalPrice = null;
13735
+ this.discountPct = null;
13736
+ this.stripePriceId = null;
13737
+ }
13738
+ }
13739
+ /**
13740
+ * Returns the per-month display price regardless of billing cycle.
13741
+ * Use this in the frontend transform layer or API response DTOs.
13742
+ *
13743
+ * monthly → price (e.g. $29.99)
13744
+ * yearly → price / 12 (e.g. $22.79)
13745
+ *
13746
+ * Returns null for free plans.
13747
+ */
13748
+ get monthlyEquivalent() {
13749
+ if (this.isFree) return null;
13750
+ if (this.billingCycle === "yearly" /* YEARLY */) {
13751
+ return Math.round(this.price / 12 * 100) / 100;
13752
+ }
13753
+ return this.price;
13754
+ }
13755
+ /**
13756
+ * Returns the absolute saving vs original_price for this cycle.
13757
+ * Returns null if no original_price is set.
13758
+ */
13759
+ get savingsAmount() {
13760
+ if (this.originalPrice === null || this.originalPrice === void 0) {
13761
+ return null;
13762
+ }
13763
+ return Math.round((this.originalPrice - this.price) * 100) / 100;
13764
+ }
13765
+ };
13766
+ // individual index to find pricing by plan
13767
+ __decorateClass([
13768
+ Column83({ name: "plan_id", type: "integer", nullable: false }),
13769
+ Index67()
13770
+ ], PlanPricing.prototype, "planId", 2);
13771
+ __decorateClass([
13772
+ ManyToOne64(() => Plan, (plan) => plan.pricing, {
13773
+ onDelete: "CASCADE",
13774
+ nullable: false
13775
+ }),
13776
+ JoinColumn65({ name: "plan_id" })
13777
+ ], PlanPricing.prototype, "plan", 2);
13778
+ __decorateClass([
13779
+ Column83({
13780
+ name: "billing_cycle",
13781
+ type: "enum",
13782
+ enum: BillingCycle
13783
+ })
13784
+ ], PlanPricing.prototype, "billingCycle", 2);
13785
+ __decorateClass([
13786
+ Column83({ name: "price", type: "decimal", precision: 10, scale: 2, default: 0 })
13787
+ ], PlanPricing.prototype, "price", 2);
13788
+ __decorateClass([
13789
+ Column83({ name: "original_price", type: "decimal", precision: 10, scale: 2, nullable: true })
13790
+ ], PlanPricing.prototype, "originalPrice", 2);
13791
+ __decorateClass([
13792
+ Column83({ name: "discount_pct", type: "smallint", nullable: true })
13793
+ ], PlanPricing.prototype, "discountPct", 2);
13794
+ __decorateClass([
13795
+ Column83({ name: "currency", type: "varchar", length: 3, default: "USD" })
13796
+ ], PlanPricing.prototype, "currency", 2);
13797
+ __decorateClass([
13798
+ Column83({ name: "is_free", type: "boolean", default: false })
13799
+ ], PlanPricing.prototype, "isFree", 2);
13800
+ __decorateClass([
13801
+ Column83({ name: "stripe_price_id", type: "varchar", length: 100, nullable: true, unique: true })
13802
+ ], PlanPricing.prototype, "stripePriceId", 2);
13803
+ __decorateClass([
13804
+ Column83({ name: "trial_days", type: "smallint", default: 0 })
13805
+ ], PlanPricing.prototype, "trialDays", 2);
13806
+ __decorateClass([
13807
+ Column83({ name: "is_active", type: "boolean", default: true })
13808
+ ], PlanPricing.prototype, "isActive", 2);
13809
+ __decorateClass([
13810
+ BeforeInsert(),
13811
+ BeforeUpdate()
13812
+ ], PlanPricing.prototype, "sanitize", 1);
13813
+ PlanPricing = __decorateClass([
13814
+ Entity82("plan_pricings"),
13815
+ Unique("uq_plan_pricings_plan_cycle", ["planId", "billingCycle"]),
13816
+ Index67("idx_plan_pricings_plan_id", ["planId"]),
13817
+ Index67("idx_plan_pricings_active", ["isActive", "billingCycle"]),
13818
+ Check3("chk_plan_pricings_price_non_negative", '"price" >= 0'),
13819
+ Check3(
13820
+ "chk_plan_pricings_original_price_non_negative",
13821
+ '"originalPrice" IS NULL OR "originalPrice" >= 0'
13822
+ ),
13823
+ Check3(
13824
+ "chk_plan_pricings_original_gte_price",
13825
+ '"originalPrice" IS NULL OR "originalPrice" >= "price"'
13826
+ ),
13827
+ Check3(
13828
+ "chk_plan_pricings_discount_range",
13829
+ '"discountPct" IS NULL OR ("discountPct" >= 1 AND "discountPct" <= 99)'
13830
+ ),
13831
+ Check3("chk_plan_pricings_trial_days_non_negative", '"trialDays" >= 0'),
13832
+ Check3(
13833
+ "chk_plan_pricings_free_price_zero",
13834
+ '("isFree" = false) OR ("isFree" = true AND "price" = 0)'
13835
+ )
13836
+ ], PlanPricing);
13837
+
13838
+ // src/entities/plan.entity.ts
13839
+ var Plan = class extends BaseEntity {
13840
+ createSlug() {
13841
+ if (!this.slug && this.name) {
13842
+ this.slug = this.name.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
13843
+ }
13844
+ }
13845
+ };
13846
+ __decorateClass([
13847
+ Column84({ name: "name", type: "varchar", length: 100 })
13848
+ ], Plan.prototype, "name", 2);
13849
+ __decorateClass([
13850
+ Column84({ name: "slug", type: "varchar", length: 100 })
13851
+ ], Plan.prototype, "slug", 2);
13852
+ __decorateClass([
13853
+ Column84({ name: "badge_label", type: "varchar", length: 60, nullable: true })
13854
+ ], Plan.prototype, "badgeLabel", 2);
13855
+ __decorateClass([
13856
+ Column84({ name: "sort_order", type: "smallint", default: 0 })
13857
+ ], Plan.prototype, "sortOrder", 2);
13858
+ __decorateClass([
13859
+ Column84({ name: "is_active", type: "boolean", default: true })
13860
+ ], Plan.prototype, "isActive", 2);
13861
+ __decorateClass([
13862
+ Column84({ name: "metadata", type: "jsonb", default: {} })
13863
+ ], Plan.prototype, "metadata", 2);
13864
+ __decorateClass([
13865
+ BeforeInsert2(),
13866
+ BeforeUpdate2()
13867
+ ], Plan.prototype, "createSlug", 1);
13868
+ __decorateClass([
13869
+ OneToMany29(() => PlanFeature, (feature) => feature.plan, {
13870
+ cascade: ["insert", "update"]
13871
+ })
13872
+ ], Plan.prototype, "features", 2);
13873
+ __decorateClass([
13874
+ OneToMany29(() => PlanPricing, (pricing) => pricing.plan, {
13875
+ cascade: ["insert", "update"]
13876
+ })
13877
+ ], Plan.prototype, "pricing", 2);
13878
+ Plan = __decorateClass([
13879
+ Entity83("plans"),
13880
+ Index68("idx_plans_slug", ["slug"], { unique: true, where: '"is_deleted" IS FALSE' }),
13881
+ Index68("idx_plans_active_sort", ["isActive", "sortOrder"]),
13882
+ Check4("chk_plans_sort_order_positive", '"sortOrder" >= 0')
13883
+ ], Plan);
13691
13884
  export {
13692
13885
  ADMIN_FREELANCER_PATTERN,
13693
13886
  ADMIN_JOB_PATTERN,
@@ -13738,6 +13931,7 @@ export {
13738
13931
  BankAccountTypeEnum,
13739
13932
  BankDetail,
13740
13933
  BaseEntity,
13934
+ BillingCycle,
13741
13935
  BillingCycleEnum,
13742
13936
  CALENDLY_PATTERN,
13743
13937
  CITY_PATTERN,
@@ -13854,7 +14048,6 @@ export {
13854
14048
  FREELANCER_EXPERIENCE_PATTERN,
13855
14049
  FREELANCER_PROJECT_PATTERN,
13856
14050
  FREELANCER_SKILL_PATTERN,
13857
- Feature,
13858
14051
  FetchClientInfoForChatDto,
13859
14052
  FetchFreelancerInfoForChatDto,
13860
14053
  ForgotPasswordDto,
@@ -13974,6 +14167,8 @@ export {
13974
14167
  PROFILE_PATTERN,
13975
14168
  Permission,
13976
14169
  Plan,
14170
+ PlanFeature,
14171
+ PlanPricing,
13977
14172
  PreCheckoutCalculationDto,
13978
14173
  ProjectDto,
13979
14174
  Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experts_hub/shared",
3
- "version": "1.0.675",
3
+ "version": "1.0.676",
4
4
  "description": "Shared DTOs, interfaces, and utilities for experts hub applications",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -1,6 +0,0 @@
1
- import { BaseEntity } from "./base.entity";
2
- import { Plan } from './plan.entity';
3
- export declare class Feature extends BaseEntity {
4
- name: string;
5
- plans: Plan[];
6
- }