@experts_hub/shared 1.0.674 → 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
@@ -2708,6 +2708,9 @@ __decorateClass([
2708
2708
  __decorateClass([
2709
2709
  Column19({ name: "is_contract_sent", type: "boolean", default: false })
2710
2710
  ], F2FInterview.prototype, "isContractSent", 2);
2711
+ __decorateClass([
2712
+ Column19({ name: "feedback", type: "varchar", nullable: true })
2713
+ ], F2FInterview.prototype, "feedback", 2);
2711
2714
  __decorateClass([
2712
2715
  OneToMany8(() => F2FInterviewSchedule, (f2fInterviewSchedule) => f2fInterviewSchedule.f2fInterview)
2713
2716
  ], F2FInterview.prototype, "schedules", 2);
@@ -13167,73 +13170,30 @@ JobRoles = __decorateClass([
13167
13170
  Entity71("job_roles")
13168
13171
  ], JobRoles);
13169
13172
 
13170
- // src/entities/plan.entity.ts
13171
- import { Entity as Entity73, Column as Column74, ManyToMany as ManyToMany3, JoinTable } from "typeorm";
13172
-
13173
- // src/entities/feature.entity.ts
13174
- import { Entity as Entity72, Column as Column73, ManyToMany as ManyToMany2 } from "typeorm";
13175
- var Feature = class extends BaseEntity {
13176
- };
13177
- __decorateClass([
13178
- Column73({ name: "name", type: "varchar", unique: true })
13179
- ], Feature.prototype, "name", 2);
13180
- __decorateClass([
13181
- ManyToMany2(() => Plan, (plan) => plan.features)
13182
- ], Feature.prototype, "plans", 2);
13183
- Feature = __decorateClass([
13184
- Entity72("features")
13185
- ], Feature);
13186
-
13187
- // src/entities/plan.entity.ts
13188
- var Plan = class extends BaseEntity {
13189
- };
13190
- __decorateClass([
13191
- Column74({ name: "name", type: "varchar", unique: true })
13192
- ], Plan.prototype, "name", 2);
13193
- __decorateClass([
13194
- Column74({ name: "description", type: "varchar", nullable: true })
13195
- ], Plan.prototype, "description", 2);
13196
- __decorateClass([
13197
- Column74({ name: "price", type: "decimal", precision: 10, scale: 2 })
13198
- ], Plan.prototype, "price", 2);
13199
- __decorateClass([
13200
- Column74({ name: "billing_period", type: "varchar" })
13201
- ], Plan.prototype, "billingPeriod", 2);
13202
- __decorateClass([
13203
- Column74({ name: "is_current", type: "boolean", default: false })
13204
- ], Plan.prototype, "isCurrent", 2);
13205
- __decorateClass([
13206
- ManyToMany3(() => Feature, (feature) => feature.plans, { cascade: true }),
13207
- JoinTable()
13208
- ], Plan.prototype, "features", 2);
13209
- Plan = __decorateClass([
13210
- Entity73("plans")
13211
- ], Plan);
13212
-
13213
13173
  // src/entities/cms.entity.ts
13214
- import { Entity as Entity74, Column as Column75 } from "typeorm";
13174
+ import { Entity as Entity72, Column as Column73 } from "typeorm";
13215
13175
  var Cms = class extends BaseEntity {
13216
13176
  };
13217
13177
  __decorateClass([
13218
- Column75({ name: "title", type: "varchar", nullable: true })
13178
+ Column73({ name: "title", type: "varchar", nullable: true })
13219
13179
  ], Cms.prototype, "title", 2);
13220
13180
  __decorateClass([
13221
- Column75({ name: "slug", type: "varchar", nullable: true, unique: true })
13181
+ Column73({ name: "slug", type: "varchar", nullable: true, unique: true })
13222
13182
  ], Cms.prototype, "slug", 2);
13223
13183
  __decorateClass([
13224
- Column75({ name: "content", type: "varchar", nullable: true })
13184
+ Column73({ name: "content", type: "varchar", nullable: true })
13225
13185
  ], Cms.prototype, "content", 2);
13226
13186
  __decorateClass([
13227
- Column75({ name: "is_active", type: "boolean", default: true })
13187
+ Column73({ name: "is_active", type: "boolean", default: true })
13228
13188
  ], Cms.prototype, "isActive", 2);
13229
13189
  Cms = __decorateClass([
13230
- Entity74("cms")
13190
+ Entity72("cms")
13231
13191
  ], Cms);
13232
13192
 
13233
13193
  // src/entities/lead.entity.ts
13234
13194
  import {
13235
- Entity as Entity75,
13236
- Column as Column76
13195
+ Entity as Entity73,
13196
+ Column as Column74
13237
13197
  } from "typeorm";
13238
13198
  var CategoryEmum = /* @__PURE__ */ ((CategoryEmum2) => {
13239
13199
  CategoryEmum2["BUSINESS"] = "BUSINESS";
@@ -13243,22 +13203,22 @@ var CategoryEmum = /* @__PURE__ */ ((CategoryEmum2) => {
13243
13203
  var Lead = class extends BaseEntity {
13244
13204
  };
13245
13205
  __decorateClass([
13246
- Column76({ name: "name", type: "varchar", nullable: true })
13206
+ Column74({ name: "name", type: "varchar", nullable: true })
13247
13207
  ], Lead.prototype, "name", 2);
13248
13208
  __decorateClass([
13249
- Column76({ name: "mobile_code", type: "varchar", nullable: true })
13209
+ Column74({ name: "mobile_code", type: "varchar", nullable: true })
13250
13210
  ], Lead.prototype, "mobileCode", 2);
13251
13211
  __decorateClass([
13252
- Column76({ name: "mobile", type: "varchar", nullable: true })
13212
+ Column74({ name: "mobile", type: "varchar", nullable: true })
13253
13213
  ], Lead.prototype, "mobile", 2);
13254
13214
  __decorateClass([
13255
- Column76({ name: "email", type: "varchar", nullable: true })
13215
+ Column74({ name: "email", type: "varchar", nullable: true })
13256
13216
  ], Lead.prototype, "email", 2);
13257
13217
  __decorateClass([
13258
- Column76({ name: "description", type: "varchar", nullable: true })
13218
+ Column74({ name: "description", type: "varchar", nullable: true })
13259
13219
  ], Lead.prototype, "description", 2);
13260
13220
  __decorateClass([
13261
- Column76({
13221
+ Column74({
13262
13222
  name: "category",
13263
13223
  type: "enum",
13264
13224
  enum: CategoryEmum,
@@ -13266,7 +13226,7 @@ __decorateClass([
13266
13226
  })
13267
13227
  ], Lead.prototype, "category", 2);
13268
13228
  Lead = __decorateClass([
13269
- Entity75("leads")
13229
+ Entity73("leads")
13270
13230
  ], Lead);
13271
13231
 
13272
13232
  // src/entities/job-freelancer-recommendation.entity.ts
@@ -13507,7 +13467,7 @@ ClientFreelancerRecommendation = __decorateClass([
13507
13467
  ], ClientFreelancerRecommendation);
13508
13468
 
13509
13469
  // src/entities/commission.entity.ts
13510
- import { Entity as Entity76, Column as Column77 } from "typeorm";
13470
+ import { Entity as Entity74, Column as Column75 } from "typeorm";
13511
13471
  var CommissionTypeEnum = /* @__PURE__ */ ((CommissionTypeEnum2) => {
13512
13472
  CommissionTypeEnum2["PERCENTAGE"] = "PERCENTAGE";
13513
13473
  CommissionTypeEnum2["FLAT"] = "FLAT";
@@ -13516,7 +13476,7 @@ var CommissionTypeEnum = /* @__PURE__ */ ((CommissionTypeEnum2) => {
13516
13476
  var Commission = class extends BaseEntity {
13517
13477
  };
13518
13478
  __decorateClass([
13519
- Column77({
13479
+ Column75({
13520
13480
  name: "freelancer_commission_type",
13521
13481
  type: "enum",
13522
13482
  enum: CommissionTypeEnum,
@@ -13524,10 +13484,10 @@ __decorateClass([
13524
13484
  })
13525
13485
  ], Commission.prototype, "freelancerCommissionType", 2);
13526
13486
  __decorateClass([
13527
- Column77({ name: "freelancer_commission", type: "integer", default: 0 })
13487
+ Column75({ name: "freelancer_commission", type: "integer", default: 0 })
13528
13488
  ], Commission.prototype, "freelancerCommission", 2);
13529
13489
  __decorateClass([
13530
- Column77({
13490
+ Column75({
13531
13491
  name: "client_commission_type",
13532
13492
  type: "enum",
13533
13493
  enum: CommissionTypeEnum,
@@ -13535,58 +13495,58 @@ __decorateClass([
13535
13495
  })
13536
13496
  ], Commission.prototype, "clientCommissionType", 2);
13537
13497
  __decorateClass([
13538
- Column77({ name: "client_commission", type: "integer", default: 0 })
13498
+ Column75({ name: "client_commission", type: "integer", default: 0 })
13539
13499
  ], Commission.prototype, "clientCommission", 2);
13540
13500
  Commission = __decorateClass([
13541
- Entity76("commissions")
13501
+ Entity74("commissions")
13542
13502
  ], Commission);
13543
13503
 
13544
13504
  // src/entities/calendly-meeting-log.entity.ts
13545
13505
  import {
13546
- Entity as Entity77,
13547
- Column as Column78,
13506
+ Entity as Entity75,
13507
+ Column as Column76,
13548
13508
  Index as Index61
13549
13509
  } from "typeorm";
13550
13510
  var CalendlyMeetingLog = class extends BaseEntity {
13551
13511
  };
13552
13512
  __decorateClass([
13553
- Column78({ name: "calendly_event_id", type: "varchar", nullable: true }),
13513
+ Column76({ name: "calendly_event_id", type: "varchar", nullable: true }),
13554
13514
  Index61()
13555
13515
  ], CalendlyMeetingLog.prototype, "calendlyEventId", 2);
13556
13516
  __decorateClass([
13557
- Column78({ name: "calendly_event_type", type: "varchar", nullable: true })
13517
+ Column76({ name: "calendly_event_type", type: "varchar", nullable: true })
13558
13518
  ], CalendlyMeetingLog.prototype, "calendlyEventType", 2);
13559
13519
  __decorateClass([
13560
- Column78({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13520
+ Column76({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13561
13521
  ], CalendlyMeetingLog.prototype, "rawWebhookData", 2);
13562
13522
  CalendlyMeetingLog = __decorateClass([
13563
- Entity77("calendly_meeting_logs")
13523
+ Entity75("calendly_meeting_logs")
13564
13524
  ], CalendlyMeetingLog);
13565
13525
 
13566
13526
  // src/entities/zoom-meeting-log.entity.ts
13567
13527
  import {
13568
- Entity as Entity78,
13569
- Column as Column79,
13528
+ Entity as Entity76,
13529
+ Column as Column77,
13570
13530
  Index as Index62
13571
13531
  } from "typeorm";
13572
13532
  var ZoomMeetingLog = class extends BaseEntity {
13573
13533
  };
13574
13534
  __decorateClass([
13575
- Column79({ name: "zoom_meeting_id", type: "varchar", nullable: true }),
13535
+ Column77({ name: "zoom_meeting_id", type: "varchar", nullable: true }),
13576
13536
  Index62()
13577
13537
  ], ZoomMeetingLog.prototype, "zoomMeetingId", 2);
13578
13538
  __decorateClass([
13579
- Column79({ name: "zoom_event_type", type: "varchar", nullable: true })
13539
+ Column77({ name: "zoom_event_type", type: "varchar", nullable: true })
13580
13540
  ], ZoomMeetingLog.prototype, "zoomEventType", 2);
13581
13541
  __decorateClass([
13582
- Column79({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13542
+ Column77({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13583
13543
  ], ZoomMeetingLog.prototype, "rawWebhookData", 2);
13584
13544
  ZoomMeetingLog = __decorateClass([
13585
- Entity78("zoom_meeting_logs")
13545
+ Entity76("zoom_meeting_logs")
13586
13546
  ], ZoomMeetingLog);
13587
13547
 
13588
13548
  // src/entities/docuseal.entity.ts
13589
- 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";
13590
13550
  var DocuSealTypeEnum = /* @__PURE__ */ ((DocuSealTypeEnum2) => {
13591
13551
  DocuSealTypeEnum2["FREELANCER_SERVICE_AGGREMENT"] = "FREELANCER_SERVICE_AGGREMENT";
13592
13552
  DocuSealTypeEnum2["CLIENT_SERVICE_AGGREMENT"] = "CLIENT_SERVICE_AGGREMENT";
@@ -13596,56 +13556,56 @@ var DocuSealTypeEnum = /* @__PURE__ */ ((DocuSealTypeEnum2) => {
13596
13556
  var DocuSeal = class extends BaseEntity {
13597
13557
  };
13598
13558
  __decorateClass([
13599
- Column80({ name: "reference_id", type: "integer", nullable: false }),
13559
+ Column78({ name: "reference_id", type: "integer", nullable: false }),
13600
13560
  Index63()
13601
13561
  ], DocuSeal.prototype, "referenceId", 2);
13602
13562
  __decorateClass([
13603
- Column80({ name: "submitter_id", type: "integer", nullable: true }),
13563
+ Column78({ name: "submitter_id", type: "integer", nullable: true }),
13604
13564
  Index63()
13605
13565
  ], DocuSeal.prototype, "submitterId", 2);
13606
13566
  __decorateClass([
13607
- Column80({ name: "submitter_response", type: "jsonb", nullable: true })
13567
+ Column78({ name: "submitter_response", type: "jsonb", nullable: true })
13608
13568
  ], DocuSeal.prototype, "submitterResponse", 2);
13609
13569
  __decorateClass([
13610
- Column80({ name: "webhook_response", type: "jsonb", nullable: true })
13570
+ Column78({ name: "webhook_response", type: "jsonb", nullable: true })
13611
13571
  ], DocuSeal.prototype, "webhookResponse", 2);
13612
13572
  __decorateClass([
13613
- Column80({ name: "type", type: "enum", enum: DocuSealTypeEnum, nullable: true })
13573
+ Column78({ name: "type", type: "enum", enum: DocuSealTypeEnum, nullable: true })
13614
13574
  ], DocuSeal.prototype, "type", 2);
13615
13575
  DocuSeal = __decorateClass([
13616
- Entity79("docuseal")
13576
+ Entity77("docuseal")
13617
13577
  ], DocuSeal);
13618
13578
 
13619
13579
  // src/entities/stripe-logs.entity.ts
13620
- import { Entity as Entity80, Column as Column81 } from "typeorm";
13580
+ import { Entity as Entity78, Column as Column79 } from "typeorm";
13621
13581
  var StripeLog = class extends BaseEntity {
13622
13582
  };
13623
13583
  __decorateClass([
13624
- Column81({ name: "stripe_event_id", type: "varchar", nullable: true })
13584
+ Column79({ name: "stripe_event_id", type: "varchar", nullable: true })
13625
13585
  ], StripeLog.prototype, "stripeEventId", 2);
13626
13586
  __decorateClass([
13627
- Column81({ name: "event_type", type: "varchar", nullable: true })
13587
+ Column79({ name: "event_type", type: "varchar", nullable: true })
13628
13588
  ], StripeLog.prototype, "eventType", 2);
13629
13589
  __decorateClass([
13630
- Column81({ name: "stripe_account_id", type: "varchar", nullable: true })
13590
+ Column79({ name: "stripe_account_id", type: "varchar", nullable: true })
13631
13591
  ], StripeLog.prototype, "stripeAccountId", 2);
13632
13592
  __decorateClass([
13633
- Column81({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13593
+ Column79({ name: "raw_webhook_data", type: "jsonb", nullable: true })
13634
13594
  ], StripeLog.prototype, "rawWebhookData", 2);
13635
13595
  StripeLog = __decorateClass([
13636
- Entity80("stripe_logs")
13596
+ Entity78("stripe_logs")
13637
13597
  ], StripeLog);
13638
13598
 
13639
13599
  // src/entities/recommendation-weightage-config.entity.ts
13640
13600
  import {
13641
- Entity as Entity81,
13642
- Column as Column82,
13601
+ Entity as Entity79,
13602
+ Column as Column80,
13643
13603
  Index as Index64
13644
13604
  } from "typeorm";
13645
13605
  var RecommendationWeightageConfig = class extends BaseEntity {
13646
13606
  };
13647
13607
  __decorateClass([
13648
- Column82({
13608
+ Column80({
13649
13609
  type: "varchar",
13650
13610
  length: 100,
13651
13611
  unique: true,
@@ -13654,37 +13614,273 @@ __decorateClass([
13654
13614
  Index64()
13655
13615
  ], RecommendationWeightageConfig.prototype, "key", 2);
13656
13616
  __decorateClass([
13657
- Column82({
13617
+ Column80({
13658
13618
  type: "jsonb",
13659
13619
  comment: "JSON object containing weight values",
13660
13620
  nullable: true
13661
13621
  })
13662
13622
  ], RecommendationWeightageConfig.prototype, "value", 2);
13663
13623
  __decorateClass([
13664
- Column82({ name: "is_active", type: "boolean", default: true })
13624
+ Column80({ name: "is_active", type: "boolean", default: true })
13665
13625
  ], RecommendationWeightageConfig.prototype, "isActive", 2);
13666
13626
  RecommendationWeightageConfig = __decorateClass([
13667
- Entity81("recommendation_weightage_configs")
13627
+ Entity79("recommendation_weightage_configs")
13668
13628
  ], RecommendationWeightageConfig);
13669
13629
 
13670
13630
  // src/entities/global-setting.entity.ts
13671
13631
  import {
13672
- Entity as Entity82,
13673
- Column as Column83,
13632
+ Entity as Entity80,
13633
+ Column as Column81,
13674
13634
  Index as Index65
13675
13635
  } from "typeorm";
13676
13636
  var GlobalSetting = class extends BaseEntity {
13677
13637
  };
13678
13638
  __decorateClass([
13679
- Column83({ name: "key", type: "varchar", length: 255, nullable: false, unique: true })
13639
+ Column81({ name: "key", type: "varchar", length: 255, nullable: false, unique: true })
13680
13640
  ], GlobalSetting.prototype, "key", 2);
13681
13641
  __decorateClass([
13682
- Column83({ name: "value", type: "text", nullable: false })
13642
+ Column81({ name: "value", type: "text", nullable: false })
13683
13643
  ], GlobalSetting.prototype, "value", 2);
13684
13644
  GlobalSetting = __decorateClass([
13685
- Entity82("global_settings"),
13645
+ Entity80("global_settings"),
13686
13646
  Index65(["key"], { unique: true })
13687
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);
13688
13884
  export {
13689
13885
  ADMIN_FREELANCER_PATTERN,
13690
13886
  ADMIN_JOB_PATTERN,
@@ -13735,6 +13931,7 @@ export {
13735
13931
  BankAccountTypeEnum,
13736
13932
  BankDetail,
13737
13933
  BaseEntity,
13934
+ BillingCycle,
13738
13935
  BillingCycleEnum,
13739
13936
  CALENDLY_PATTERN,
13740
13937
  CITY_PATTERN,
@@ -13851,7 +14048,6 @@ export {
13851
14048
  FREELANCER_EXPERIENCE_PATTERN,
13852
14049
  FREELANCER_PROJECT_PATTERN,
13853
14050
  FREELANCER_SKILL_PATTERN,
13854
- Feature,
13855
14051
  FetchClientInfoForChatDto,
13856
14052
  FetchFreelancerInfoForChatDto,
13857
14053
  ForgotPasswordDto,
@@ -13971,6 +14167,8 @@ export {
13971
14167
  PROFILE_PATTERN,
13972
14168
  Permission,
13973
14169
  Plan,
14170
+ PlanFeature,
14171
+ PlanPricing,
13974
14172
  PreCheckoutCalculationDto,
13975
14173
  ProjectDto,
13976
14174
  Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experts_hub/shared",
3
- "version": "1.0.674",
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
- }