@timardex/cluemart-server-shared 1.1.12 → 1.1.16

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.
@@ -5402,11 +5402,15 @@ var VENDOR_DATETIME_FIELDS_FRAGMENT = gql`
5402
5402
  `;
5403
5403
  var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = gql`
5404
5404
  fragment VendorProductListFields on VendorProductListType {
5405
+ _id
5406
+ createdAt
5405
5407
  description
5408
+ hasCoupon
5406
5409
  name
5407
5410
  price
5408
5411
  priceUnit
5409
5412
  productGroups
5413
+ updatedAt
5410
5414
  }
5411
5415
  `;
5412
5416
  var VENDOR = gql`
@@ -7709,6 +7713,109 @@ var ASSIGN_AFFILIATE_BONUS_REWARD_MUTATION = gql`
7709
7713
  }
7710
7714
  ${AFFILIATE_FIELDS_FRAGMENT}
7711
7715
  `;
7716
+ var COUPON_CODE_FIELDS_FRAGMENT = gql`
7717
+ fragment CouponCodeFields on CouponCodeType {
7718
+ code
7719
+ qrCode {
7720
+ ...ResourceImageFields
7721
+ }
7722
+ }
7723
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
7724
+ `;
7725
+ var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
7726
+ fragment CouponParticipantUserFields on CouponParticipantUserType {
7727
+ couponCount
7728
+ couponRedeemedAt
7729
+ createdAt
7730
+ updatedAt
7731
+ userId
7732
+ }
7733
+ `;
7734
+ var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
7735
+ fragment ProductCouponFields on ProductCouponType {
7736
+ _id
7737
+ active
7738
+ couponCode {
7739
+ ...CouponCodeFields
7740
+ }
7741
+ couponDescription
7742
+ couponOption
7743
+ createdAt
7744
+ endDate
7745
+ participantProduct {
7746
+ ...VendorProductListFields
7747
+ }
7748
+ participantUsers {
7749
+ ...CouponParticipantUserFields
7750
+ }
7751
+ startDate
7752
+ updatedAt
7753
+ }
7754
+ ${COUPON_CODE_FIELDS_FRAGMENT}
7755
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
7756
+ ${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
7757
+ `;
7758
+ var COUPON = gql`
7759
+ fragment CouponFields on CouponType {
7760
+ _id
7761
+ active
7762
+ productCoupons {
7763
+ ...ProductCouponFields
7764
+ }
7765
+ createdAt
7766
+ deletedAt
7767
+ updatedAt
7768
+ }
7769
+ ${PRODUCT_COUPON_FIELDS_FRAGMENT}
7770
+ ${COUPON_CODE_FIELDS_FRAGMENT}
7771
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
7772
+ `;
7773
+ var GET_COUPONS = gql`
7774
+ query getCoupons {
7775
+ coupons {
7776
+ ...CouponFields
7777
+ }
7778
+ }
7779
+ ${COUPON}
7780
+ `;
7781
+ var GET_COUPON = gql`
7782
+ query getCoupon($_id: ID!) {
7783
+ coupon(_id: $_id) {
7784
+ ...CouponFields
7785
+ }
7786
+ }
7787
+ ${COUPON}
7788
+ `;
7789
+ var CREATE_COUPON_MUTATION = gql`
7790
+ mutation createCoupon($input: CouponInputType!) {
7791
+ createCoupon(input: $input) {
7792
+ data {
7793
+ ...CouponFields
7794
+ }
7795
+ message
7796
+ }
7797
+ }
7798
+ ${COUPON}
7799
+ `;
7800
+ var UPDATE_COUPON_MUTATION = gql`
7801
+ mutation updateCoupon($_id: ID!, $input: CouponInputType!) {
7802
+ updateCoupon(_id: $_id, input: $input) {
7803
+ data {
7804
+ ...CouponFields
7805
+ }
7806
+ message
7807
+ }
7808
+ }
7809
+ ${COUPON}
7810
+ `;
7811
+ var DELETE_COUPON_MUTATION = gql`
7812
+ mutation deleteCoupon($_id: ID!) {
7813
+ deleteCoupon(_id: $_id) {
7814
+ data
7815
+ message
7816
+ }
7817
+ }
7818
+ `;
7712
7819
  var PKG = "@timardex/cluemart-shared";
7713
7820
  var IMAGE_EXTENSION = ".webp";
7714
7821
  var posterIds = [
@@ -8845,20 +8952,21 @@ var VerificationTokenModel = mongoose12.models.VerificationToken || mongoose12.m
8845
8952
  // src/mongoose/vendor/Vendor.ts
8846
8953
  import mongoose13 from "mongoose";
8847
8954
  var MongooseSchema13 = mongoose13.Schema;
8848
- var productTypeSchema = new MongooseSchema13(
8955
+ var vendorProductTypeSchema = new MongooseSchema13(
8849
8956
  {
8850
8957
  description: { required: false, type: String },
8851
- name: { required: false, type: String },
8852
- price: { required: false, type: Number },
8853
- priceUnit: { required: false, type: String },
8958
+ hasCoupon: { default: false, required: false, type: Boolean },
8959
+ name: { required: true, type: String },
8960
+ price: { required: true, type: Number },
8961
+ priceUnit: { required: true, type: String },
8854
8962
  productGroups: { required: false, type: [String] }
8855
8963
  },
8856
- { _id: false }
8964
+ { timestamps: true }
8857
8965
  );
8858
8966
  var productWrapperSchema = new MongooseSchema13(
8859
8967
  {
8860
- active: { default: false, type: Boolean },
8861
- productsList: { required: false, type: [productTypeSchema] }
8968
+ active: { default: false, required: true, type: Boolean },
8969
+ productsList: { required: false, type: [vendorProductTypeSchema] }
8862
8970
  },
8863
8971
  { _id: false }
8864
8972
  );
@@ -8885,7 +8993,7 @@ var calendarSchema = new MongooseSchema13(
8885
8993
  );
8886
8994
  var calendarWrapperSchema = new MongooseSchema13(
8887
8995
  {
8888
- active: { default: false, type: Boolean },
8996
+ active: { default: false, required: true, type: Boolean },
8889
8997
  calendarData: { required: false, type: [calendarSchema] }
8890
8998
  },
8891
8999
  { _id: false }
@@ -9310,9 +9418,9 @@ var gameDataSchemas = {
9310
9418
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
9311
9419
  };
9312
9420
  var gameDataDefinition = Object.fromEntries(
9313
- Object.entries(gameDataSchemas).map(([key, schema18]) => [
9421
+ Object.entries(gameDataSchemas).map(([key, schema19]) => [
9314
9422
  key,
9315
- { default: null, required: false, type: schema18 }
9423
+ { default: null, required: false, type: schema19 }
9316
9424
  ])
9317
9425
  );
9318
9426
  var gameHistorySchema = new MongooseSchema23(
@@ -9537,6 +9645,63 @@ schema17.index(
9537
9645
  );
9538
9646
  var AffiliateModel = mongoose25.models.Affiliate || mongoose25.model("Affiliate", schema17);
9539
9647
 
9648
+ // src/mongoose/Coupon.ts
9649
+ import mongoose26 from "mongoose";
9650
+ var MongooseSchema26 = mongoose26.Schema;
9651
+ var couponOptionSchema = new MongooseSchema26(
9652
+ {
9653
+ buy: { required: true, type: Number },
9654
+ get: { required: true, type: Number },
9655
+ unit: { required: true, type: String }
9656
+ },
9657
+ { _id: false }
9658
+ );
9659
+ var couponCodeSchema = new MongooseSchema26(
9660
+ {
9661
+ code: { required: true, type: String },
9662
+ qrCode: { required: true, type: ResourceImageTypeSchema }
9663
+ },
9664
+ { _id: false }
9665
+ );
9666
+ var couponParticipantUserSchema = new MongooseSchema26(
9667
+ {
9668
+ couponCount: { default: 0, required: true, type: Number },
9669
+ couponRedeemedAt: { default: null, required: false, type: Date },
9670
+ userId: {
9671
+ ref: "User",
9672
+ required: true,
9673
+ type: mongoose26.Schema.Types.ObjectId
9674
+ }
9675
+ },
9676
+ { timestamps: true }
9677
+ );
9678
+ var productCouponSchema = new MongooseSchema26(
9679
+ {
9680
+ active: { default: true, required: true, type: Boolean },
9681
+ couponCode: { required: true, type: couponCodeSchema },
9682
+ couponDescription: { required: true, type: String },
9683
+ couponOption: { required: true, type: couponOptionSchema },
9684
+ endDate: { required: true, type: Date },
9685
+ participantProduct: { required: true, type: vendorProductTypeSchema },
9686
+ participantUsers: {
9687
+ default: null,
9688
+ required: false,
9689
+ type: [couponParticipantUserSchema]
9690
+ },
9691
+ startDate: { required: true, type: Date }
9692
+ },
9693
+ { timestamps: true }
9694
+ );
9695
+ var schema18 = new MongooseSchema26(
9696
+ {
9697
+ active: { default: true, required: true, type: Boolean },
9698
+ deletedAt: { default: null, required: false, type: Date },
9699
+ productCoupons: { required: false, type: [productCouponSchema] }
9700
+ },
9701
+ { timestamps: true }
9702
+ );
9703
+ var CouponModel = mongoose26.models.Coupon || mongoose26.model("Coupon", schema18);
9704
+
9540
9705
  export {
9541
9706
  EnumInviteStatus,
9542
9707
  EnumResourceType,
@@ -9582,6 +9747,7 @@ export {
9582
9747
  ResourceActivityModel,
9583
9748
  UserModel,
9584
9749
  VerificationTokenModel,
9750
+ vendorProductTypeSchema,
9585
9751
  VendorModel,
9586
9752
  VendorInfoModel,
9587
9753
  UnregisteredVendorModel,
@@ -9592,6 +9758,7 @@ export {
9592
9758
  AppSettingModel,
9593
9759
  GameModel,
9594
9760
  SchoolModel,
9595
- AffiliateModel
9761
+ AffiliateModel,
9762
+ CouponModel
9596
9763
  };
9597
- //# sourceMappingURL=chunk-ICAMGPFE.mjs.map
9764
+ //# sourceMappingURL=chunk-7GXZS3LI.mjs.map