@timardex/cluemart-server-shared 1.0.78 → 1.0.80

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.cjs CHANGED
@@ -1703,6 +1703,7 @@ __export(index_exports, {
1703
1703
  connectToDatabase: () => connectToDatabase,
1704
1704
  dateTimeSchema: () => dateTimeSchema3,
1705
1705
  express: () => import_express.default,
1706
+ locationGeoSchema: () => locationGeoSchema,
1706
1707
  locationsSchema: () => locationsSchema,
1707
1708
  mongoose: () => import_mongoose21.default,
1708
1709
  relationDatesSchema: () => relationDatesSchema,
@@ -8500,17 +8501,25 @@ var CONTACT_DETAILS_FIELDS_FRAGMENT = gql`
8500
8501
  mobilePhone
8501
8502
  }
8502
8503
  `;
8504
+ var LOCATION_GEO_FIELDS_FRAGMENT = gql`
8505
+ fragment LocationGeoFields on LocationGeoType {
8506
+ coordinates
8507
+ type
8508
+ }
8509
+ `;
8503
8510
  var LOCATION_FIELDS_FRAGMENT = gql`
8504
8511
  fragment LocationFields on LocationType {
8505
8512
  city
8506
- coordinates
8507
8513
  country
8508
8514
  fullAddress
8515
+ geo {
8516
+ ...LocationGeoFields
8517
+ }
8509
8518
  latitude
8510
8519
  longitude
8511
8520
  region
8512
- type
8513
8521
  }
8522
+ ${LOCATION_GEO_FIELDS_FRAGMENT}
8514
8523
  `;
8515
8524
  var EVENT_LIST_ITEM = gql`
8516
8525
  fragment EventListItemFields on EventListItemType {
@@ -8813,14 +8822,16 @@ var GET_TESTER = gql`
8813
8822
  var VENDOR_LOCATION_FIELDS_FRAGMENT = gql`
8814
8823
  fragment VendorLocationFields on VendorLocationType {
8815
8824
  city
8816
- coordinates
8817
8825
  country
8818
8826
  fullAddress
8827
+ geo {
8828
+ ...LocationGeoFields
8829
+ }
8819
8830
  latitude
8820
8831
  longitude
8821
8832
  region
8822
- type
8823
8833
  }
8834
+ ${LOCATION_GEO_FIELDS_FRAGMENT}
8824
8835
  `;
8825
8836
  var VENDOR_DATETIME_FIELDS_FRAGMENT = gql`
8826
8837
  fragment VendorDateTimeFields on VendorDateTimeType {
@@ -9169,6 +9180,7 @@ var CHAT_FIELDS_FRAGMENT = gql`
9169
9180
  participants {
9170
9181
  ...ChatParticipantFields
9171
9182
  }
9183
+ region
9172
9184
  updatedAt
9173
9185
  }
9174
9186
  ${CHAT_MESSAGE_FIELDS_FRAGMENT}
@@ -9190,6 +9202,14 @@ var USER_CHATS = gql`
9190
9202
  }
9191
9203
  ${CHAT_FIELDS_FRAGMENT}
9192
9204
  `;
9205
+ var GET_CHATS_BY_REGION = gql`
9206
+ query getChatsByRegion($region: String!) {
9207
+ chatsByRegion(region: $region) {
9208
+ ...ChatFields
9209
+ }
9210
+ }
9211
+ ${CHAT_FIELDS_FRAGMENT}
9212
+ `;
9193
9213
  var SEND_CHAT_MESSAGE_MUTATION = gql`
9194
9214
  mutation sendChatMessage($_id: ID!, $input: ChatMessageInputType!) {
9195
9215
  sendChatMessage(_id: $_id, input: $input) {
@@ -9213,7 +9233,10 @@ var ADD_PARTICIPANT_TO_CHAT_MUTATION = gql`
9213
9233
  `;
9214
9234
  var REMOVE_PARTICIPANT_FROM_CHAT_MUTATION = gql`
9215
9235
  mutation removeParticipantFromChat($chatId: ID!, $userId: ID!) {
9216
- removeParticipantFromChat(chatId: $chatId, userId: $userId)
9236
+ removeParticipantFromChat(chatId: $chatId, userId: $userId) {
9237
+ success
9238
+ region
9239
+ }
9217
9240
  }
9218
9241
  `;
9219
9242
  var TOGGLE_CHAT_MESSAGE_LIKE_MUTATION = gql`
@@ -9895,8 +9918,7 @@ var RESOURCE_ACTIVITY_FIELDS_FRAGMENT = gql`
9895
9918
  activity {
9896
9919
  activityType
9897
9920
  location {
9898
- type
9899
- coordinates
9921
+ ...LocationGeoFields
9900
9922
  }
9901
9923
  dateStatus
9902
9924
  startDate
@@ -9906,6 +9928,7 @@ var RESOURCE_ACTIVITY_FIELDS_FRAGMENT = gql`
9906
9928
  userId
9907
9929
  }
9908
9930
  }
9931
+ ${LOCATION_GEO_FIELDS_FRAGMENT}
9909
9932
  `;
9910
9933
  var GET_RESOURCE_ACTIVITY = gql`
9911
9934
  query getResourceActivity(
@@ -10307,16 +10330,18 @@ var dateTimeWithPriceSchema = dateTimeSchema.shape({
10307
10330
  });
10308
10331
  var locationSchema = create$3().shape({
10309
10332
  city: create$6().label("City").required("City is required"),
10310
- coordinates: create$2().of(create$5().required("Coordinates must be numbers")).length(
10311
- 2,
10312
- "Coordinates must contain exactly two numbers (longitude, latitude)"
10313
- ).required("Coordinates are required"),
10314
10333
  country: create$6().label("Country").required("Country is required"),
10315
10334
  fullAddress: create$6().label("Address").required("Address is required"),
10335
+ geo: create$3().shape({
10336
+ coordinates: create$2().of(create$5().required("Coordinates must be numbers")).length(
10337
+ 2,
10338
+ "Coordinates must contain exactly two numbers (longitude, latitude)"
10339
+ ).required("Coordinates are required"),
10340
+ type: create$6().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
10341
+ }),
10316
10342
  latitude: create$5().label("Latitude").required("Latitude is required"),
10317
10343
  longitude: create$5().label("Longitude").required("Longitude is required"),
10318
- region: create$6().label("Region").required("Region is required"),
10319
- type: create$6().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
10344
+ region: create$6().label("Region").required("Region is required")
10320
10345
  });
10321
10346
  var passwordSchema = create$6().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
10322
10347
  var socialMediaSchema = create$3({
@@ -10795,15 +10820,16 @@ var appSettingsSchema = create$3({
10795
10820
  });
10796
10821
  var defaultLocation = {
10797
10822
  city: "",
10798
- coordinates: [0, 0],
10799
- // [longitude, latitude]
10800
10823
  country: "",
10801
10824
  fullAddress: "",
10825
+ geo: {
10826
+ coordinates: [0, 0],
10827
+ // [longitude, latitude]
10828
+ type: "Point"
10829
+ },
10802
10830
  latitude: 0,
10803
10831
  longitude: 0,
10804
- region: "",
10805
- type: "Point"
10806
- // Default type for GeoJSON
10832
+ region: ""
10807
10833
  };
10808
10834
  var globalDefaultValues = {
10809
10835
  active: false,
@@ -11193,25 +11219,27 @@ var dateTimeSchema3 = new MongooseSchema3(
11193
11219
  { _id: false }
11194
11220
  // Prevents Mongoose from creating an additional _id field for subdocuments
11195
11221
  );
11222
+ var locationGeoSchema = new MongooseSchema3(
11223
+ {
11224
+ coordinates: { required: true, type: [Number] },
11225
+ // [longitude, latitude]
11226
+ type: { default: "Point", enum: ["Point"], required: true, type: String }
11227
+ },
11228
+ { _id: false }
11229
+ // Prevents Mongoose from creating an additional _id field for subdocuments
11230
+ );
11196
11231
  var locationsSchema = new MongooseSchema3(
11197
11232
  {
11198
11233
  city: { required: true, type: String },
11199
- coordinates: {
11200
- required: true,
11201
- type: [Number]
11202
- // [longitude, latitude]
11203
- },
11204
11234
  country: { required: true, type: String },
11205
11235
  fullAddress: { required: true, type: String },
11236
+ geo: {
11237
+ required: true,
11238
+ type: locationGeoSchema
11239
+ },
11206
11240
  latitude: { required: true, type: Number },
11207
11241
  longitude: { required: true, type: Number },
11208
- region: { required: true, type: String },
11209
- type: {
11210
- default: "Point",
11211
- enum: ["Point"],
11212
- required: true,
11213
- type: String
11214
- }
11242
+ region: { required: true, type: String }
11215
11243
  },
11216
11244
  { _id: false }
11217
11245
  // Prevents Mongoose from creating an additional _id field for subdocuments
@@ -11396,7 +11424,8 @@ var ChatSchema = new MongooseSchema5(
11396
11424
  },
11397
11425
  deletedAt: { default: null, required: false, type: Date },
11398
11426
  messages: [MessageSchema],
11399
- participants: [ParticipantSchema]
11427
+ participants: [ParticipantSchema],
11428
+ region: { default: null, required: false, type: String }
11400
11429
  },
11401
11430
  {
11402
11431
  timestamps: true
@@ -11491,7 +11520,7 @@ var schema3 = new MongooseSchema6(
11491
11520
  },
11492
11521
  { timestamps: true }
11493
11522
  );
11494
- schema3.index({ location: "2dsphere" });
11523
+ schema3.index({ "location.geo": "2dsphere" });
11495
11524
  schema3.index({ name: 1 });
11496
11525
  schema3.index({ region: 1 });
11497
11526
  var GoogleImportedMarketModel = import_mongoose6.default.models.GoogleImportedMarket || import_mongoose6.default.model("GoogleImportedMarket", schema3);
@@ -11572,16 +11601,8 @@ var ActivitySchema = new MongooseSchema9(
11572
11601
  type: String
11573
11602
  },
11574
11603
  location: {
11575
- coordinates: {
11576
- required: false,
11577
- type: [Number]
11578
- },
11579
- type: {
11580
- default: "Point",
11581
- enum: ["Point"],
11582
- required: false,
11583
- type: String
11584
- }
11604
+ required: false,
11605
+ type: locationGeoSchema
11585
11606
  },
11586
11607
  startDate: { required: false, type: String },
11587
11608
  startTime: { required: false, type: String },
@@ -11963,19 +11984,8 @@ var LocationsSchema = new MongooseSchema13(
11963
11984
  },
11964
11985
  description: { required: false, type: String },
11965
11986
  location: {
11966
- city: { required: false, type: String },
11967
- coordinates: {
11968
- required: false,
11969
- type: [Number]
11970
- // [longitude, latitude]
11971
- },
11972
- country: { required: false, type: String },
11973
- fullAddress: { required: false, type: String },
11974
- latitude: { required: false, type: Number },
11975
- longitude: { required: false, type: Number },
11976
- region: { required: false, type: String },
11977
- type: { required: false, type: String }
11978
- // Mongoose GeoJSON type
11987
+ required: false,
11988
+ type: locationsSchema
11979
11989
  }
11980
11990
  },
11981
11991
  { _id: false }
@@ -12114,7 +12124,7 @@ var schema11 = new MongooseSchema15(
12114
12124
  schema11.index({ name: 1 });
12115
12125
  schema11.index({ description: 1 });
12116
12126
  schema11.index({ region: 1 });
12117
- schema11.index({ location: "2dsphere" });
12127
+ schema11.index({ "location.geo": "2dsphere" });
12118
12128
  schema11.index({ tags: 1 });
12119
12129
  schema11.index({ "associates.email": 1 });
12120
12130
  var EventModel = import_mongoose15.default.models.Event || import_mongoose15.default.model("Event", schema11);
@@ -12434,6 +12444,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12434
12444
  connectToDatabase,
12435
12445
  dateTimeSchema,
12436
12446
  express,
12447
+ locationGeoSchema,
12437
12448
  locationsSchema,
12438
12449
  mongoose,
12439
12450
  relationDatesSchema,