@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.
@@ -38,6 +38,7 @@ __export(mongoose_exports, {
38
38
  ChatModel: () => ChatModel,
39
39
  ChatReportModel: () => ChatReportModel,
40
40
  ContactDetailsSchema: () => ContactDetailsSchema,
41
+ CouponModel: () => CouponModel,
41
42
  EventInfoModel: () => EventInfoModel,
42
43
  EventModel: () => EventModel,
43
44
  GameModel: () => GameModel,
@@ -69,7 +70,8 @@ __export(mongoose_exports, {
69
70
  resourceRelationsSchema: () => resourceRelationsSchema,
70
71
  socialShareResourceSchema: () => socialShareResourceSchema,
71
72
  termsAgreementSchema: () => termsAgreementSchema,
72
- userLicenseSchema: () => userLicenseSchema
73
+ userLicenseSchema: () => userLicenseSchema,
74
+ vendorProductTypeSchema: () => vendorProductTypeSchema
73
75
  });
74
76
  module.exports = __toCommonJS(mongoose_exports);
75
77
 
@@ -5475,11 +5477,15 @@ var VENDOR_DATETIME_FIELDS_FRAGMENT = gql`
5475
5477
  `;
5476
5478
  var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = gql`
5477
5479
  fragment VendorProductListFields on VendorProductListType {
5480
+ _id
5481
+ createdAt
5478
5482
  description
5483
+ hasCoupon
5479
5484
  name
5480
5485
  price
5481
5486
  priceUnit
5482
5487
  productGroups
5488
+ updatedAt
5483
5489
  }
5484
5490
  `;
5485
5491
  var VENDOR = gql`
@@ -7782,6 +7788,109 @@ var ASSIGN_AFFILIATE_BONUS_REWARD_MUTATION = gql`
7782
7788
  }
7783
7789
  ${AFFILIATE_FIELDS_FRAGMENT}
7784
7790
  `;
7791
+ var COUPON_CODE_FIELDS_FRAGMENT = gql`
7792
+ fragment CouponCodeFields on CouponCodeType {
7793
+ code
7794
+ qrCode {
7795
+ ...ResourceImageFields
7796
+ }
7797
+ }
7798
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
7799
+ `;
7800
+ var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
7801
+ fragment CouponParticipantUserFields on CouponParticipantUserType {
7802
+ couponCount
7803
+ couponRedeemedAt
7804
+ createdAt
7805
+ updatedAt
7806
+ userId
7807
+ }
7808
+ `;
7809
+ var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
7810
+ fragment ProductCouponFields on ProductCouponType {
7811
+ _id
7812
+ active
7813
+ couponCode {
7814
+ ...CouponCodeFields
7815
+ }
7816
+ couponDescription
7817
+ couponOption
7818
+ createdAt
7819
+ endDate
7820
+ participantProduct {
7821
+ ...VendorProductListFields
7822
+ }
7823
+ participantUsers {
7824
+ ...CouponParticipantUserFields
7825
+ }
7826
+ startDate
7827
+ updatedAt
7828
+ }
7829
+ ${COUPON_CODE_FIELDS_FRAGMENT}
7830
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
7831
+ ${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
7832
+ `;
7833
+ var COUPON = gql`
7834
+ fragment CouponFields on CouponType {
7835
+ _id
7836
+ active
7837
+ productCoupons {
7838
+ ...ProductCouponFields
7839
+ }
7840
+ createdAt
7841
+ deletedAt
7842
+ updatedAt
7843
+ }
7844
+ ${PRODUCT_COUPON_FIELDS_FRAGMENT}
7845
+ ${COUPON_CODE_FIELDS_FRAGMENT}
7846
+ ${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
7847
+ `;
7848
+ var GET_COUPONS = gql`
7849
+ query getCoupons {
7850
+ coupons {
7851
+ ...CouponFields
7852
+ }
7853
+ }
7854
+ ${COUPON}
7855
+ `;
7856
+ var GET_COUPON = gql`
7857
+ query getCoupon($_id: ID!) {
7858
+ coupon(_id: $_id) {
7859
+ ...CouponFields
7860
+ }
7861
+ }
7862
+ ${COUPON}
7863
+ `;
7864
+ var CREATE_COUPON_MUTATION = gql`
7865
+ mutation createCoupon($input: CouponInputType!) {
7866
+ createCoupon(input: $input) {
7867
+ data {
7868
+ ...CouponFields
7869
+ }
7870
+ message
7871
+ }
7872
+ }
7873
+ ${COUPON}
7874
+ `;
7875
+ var UPDATE_COUPON_MUTATION = gql`
7876
+ mutation updateCoupon($_id: ID!, $input: CouponInputType!) {
7877
+ updateCoupon(_id: $_id, input: $input) {
7878
+ data {
7879
+ ...CouponFields
7880
+ }
7881
+ message
7882
+ }
7883
+ }
7884
+ ${COUPON}
7885
+ `;
7886
+ var DELETE_COUPON_MUTATION = gql`
7887
+ mutation deleteCoupon($_id: ID!) {
7888
+ deleteCoupon(_id: $_id) {
7889
+ data
7890
+ message
7891
+ }
7892
+ }
7893
+ `;
7785
7894
  var PKG = "@timardex/cluemart-shared";
7786
7895
  var IMAGE_EXTENSION = ".webp";
7787
7896
  var posterIds = [
@@ -8870,20 +8979,21 @@ var VerificationTokenModel = import_mongoose12.default.models.VerificationToken
8870
8979
  // src/mongoose/vendor/Vendor.ts
8871
8980
  var import_mongoose13 = __toESM(require("mongoose"));
8872
8981
  var MongooseSchema13 = import_mongoose13.default.Schema;
8873
- var productTypeSchema = new MongooseSchema13(
8982
+ var vendorProductTypeSchema = new MongooseSchema13(
8874
8983
  {
8875
8984
  description: { required: false, type: String },
8876
- name: { required: false, type: String },
8877
- price: { required: false, type: Number },
8878
- priceUnit: { required: false, type: String },
8985
+ hasCoupon: { default: false, required: false, type: Boolean },
8986
+ name: { required: true, type: String },
8987
+ price: { required: true, type: Number },
8988
+ priceUnit: { required: true, type: String },
8879
8989
  productGroups: { required: false, type: [String] }
8880
8990
  },
8881
- { _id: false }
8991
+ { timestamps: true }
8882
8992
  );
8883
8993
  var productWrapperSchema = new MongooseSchema13(
8884
8994
  {
8885
- active: { default: false, type: Boolean },
8886
- productsList: { required: false, type: [productTypeSchema] }
8995
+ active: { default: false, required: true, type: Boolean },
8996
+ productsList: { required: false, type: [vendorProductTypeSchema] }
8887
8997
  },
8888
8998
  { _id: false }
8889
8999
  );
@@ -8910,7 +9020,7 @@ var calendarSchema = new MongooseSchema13(
8910
9020
  );
8911
9021
  var calendarWrapperSchema = new MongooseSchema13(
8912
9022
  {
8913
- active: { default: false, type: Boolean },
9023
+ active: { default: false, required: true, type: Boolean },
8914
9024
  calendarData: { required: false, type: [calendarSchema] }
8915
9025
  },
8916
9026
  { _id: false }
@@ -9335,9 +9445,9 @@ var gameDataSchemas = {
9335
9445
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
9336
9446
  };
9337
9447
  var gameDataDefinition = Object.fromEntries(
9338
- Object.entries(gameDataSchemas).map(([key, schema18]) => [
9448
+ Object.entries(gameDataSchemas).map(([key, schema19]) => [
9339
9449
  key,
9340
- { default: null, required: false, type: schema18 }
9450
+ { default: null, required: false, type: schema19 }
9341
9451
  ])
9342
9452
  );
9343
9453
  var gameHistorySchema = new MongooseSchema23(
@@ -9561,6 +9671,63 @@ schema17.index(
9561
9671
  }
9562
9672
  );
9563
9673
  var AffiliateModel = import_mongoose25.default.models.Affiliate || import_mongoose25.default.model("Affiliate", schema17);
9674
+
9675
+ // src/mongoose/Coupon.ts
9676
+ var import_mongoose26 = __toESM(require("mongoose"));
9677
+ var MongooseSchema26 = import_mongoose26.default.Schema;
9678
+ var couponOptionSchema = new MongooseSchema26(
9679
+ {
9680
+ buy: { required: true, type: Number },
9681
+ get: { required: true, type: Number },
9682
+ unit: { required: true, type: String }
9683
+ },
9684
+ { _id: false }
9685
+ );
9686
+ var couponCodeSchema = new MongooseSchema26(
9687
+ {
9688
+ code: { required: true, type: String },
9689
+ qrCode: { required: true, type: ResourceImageTypeSchema }
9690
+ },
9691
+ { _id: false }
9692
+ );
9693
+ var couponParticipantUserSchema = new MongooseSchema26(
9694
+ {
9695
+ couponCount: { default: 0, required: true, type: Number },
9696
+ couponRedeemedAt: { default: null, required: false, type: Date },
9697
+ userId: {
9698
+ ref: "User",
9699
+ required: true,
9700
+ type: import_mongoose26.default.Schema.Types.ObjectId
9701
+ }
9702
+ },
9703
+ { timestamps: true }
9704
+ );
9705
+ var productCouponSchema = new MongooseSchema26(
9706
+ {
9707
+ active: { default: true, required: true, type: Boolean },
9708
+ couponCode: { required: true, type: couponCodeSchema },
9709
+ couponDescription: { required: true, type: String },
9710
+ couponOption: { required: true, type: couponOptionSchema },
9711
+ endDate: { required: true, type: Date },
9712
+ participantProduct: { required: true, type: vendorProductTypeSchema },
9713
+ participantUsers: {
9714
+ default: null,
9715
+ required: false,
9716
+ type: [couponParticipantUserSchema]
9717
+ },
9718
+ startDate: { required: true, type: Date }
9719
+ },
9720
+ { timestamps: true }
9721
+ );
9722
+ var schema18 = new MongooseSchema26(
9723
+ {
9724
+ active: { default: true, required: true, type: Boolean },
9725
+ deletedAt: { default: null, required: false, type: Date },
9726
+ productCoupons: { required: false, type: [productCouponSchema] }
9727
+ },
9728
+ { timestamps: true }
9729
+ );
9730
+ var CouponModel = import_mongoose26.default.models.Coupon || import_mongoose26.default.model("Coupon", schema18);
9564
9731
  // Annotate the CommonJS export names for ESM import in node:
9565
9732
  0 && (module.exports = {
9566
9733
  APP_SETTINGS_ID,
@@ -9571,6 +9738,7 @@ var AffiliateModel = import_mongoose25.default.models.Affiliate || import_mongoo
9571
9738
  ChatModel,
9572
9739
  ChatReportModel,
9573
9740
  ContactDetailsSchema,
9741
+ CouponModel,
9574
9742
  EventInfoModel,
9575
9743
  EventModel,
9576
9744
  GameModel,
@@ -9602,6 +9770,7 @@ var AffiliateModel = import_mongoose25.default.models.Affiliate || import_mongoo
9602
9770
  resourceRelationsSchema,
9603
9771
  socialShareResourceSchema,
9604
9772
  termsAgreementSchema,
9605
- userLicenseSchema
9773
+ userLicenseSchema,
9774
+ vendorProductTypeSchema
9606
9775
  });
9607
9776
  //# sourceMappingURL=index.cjs.map