@timardex/cluemart-server-shared 1.0.99 → 1.0.101

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
@@ -1704,9 +1704,10 @@ __export(index_exports, {
1704
1704
  convertObjectIdsToStrings: () => convertObjectIdsToStrings,
1705
1705
  dateTimeSchema: () => dateTimeSchema3,
1706
1706
  express: () => import_express.default,
1707
+ findEventOrImportedMarketById: () => findEventOrImportedMarketById,
1707
1708
  locationGeoSchema: () => locationGeoSchema,
1708
1709
  locationsSchema: () => locationsSchema,
1709
- mongoose: () => import_mongoose23.default,
1710
+ mongoose: () => import_mongoose24.default,
1710
1711
  refundPolicySchema: () => refundPolicySchema,
1711
1712
  relationDatesSchema: () => relationDatesSchema,
1712
1713
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -8613,6 +8614,7 @@ var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = gql`
8613
8614
  description
8614
8615
  name
8615
8616
  price
8617
+ priceUnit
8616
8618
  productGroups
8617
8619
  }
8618
8620
  `;
@@ -9005,6 +9007,14 @@ var GET_REPORTED_CHAT_USERS = gql`
9005
9007
  }
9006
9008
  ${CHAT_REPORT_FIELDS_FRAGMENT}
9007
9009
  `;
9010
+ var CREATE_PRIVATE_CHAT_MUTATION = gql`
9011
+ mutation createPrivateChat($userId: ID!) {
9012
+ createPrivateChat(userId: $userId) {
9013
+ ...ChatFields
9014
+ }
9015
+ }
9016
+ ${CHAT_FIELDS_FRAGMENT}
9017
+ `;
9008
9018
  var SEND_CHAT_MESSAGE_MUTATION = gql`
9009
9019
  mutation sendChatMessage($_id: ID!, $input: ChatMessageInputType!) {
9010
9020
  sendChatMessage(_id: $_id, input: $input) {
@@ -10289,19 +10299,16 @@ var eventInfoSchema = create$3().shape({
10289
10299
  ).required("Refund policy is required")
10290
10300
  });
10291
10301
  var vendroMenuSchema = create$3().shape({
10292
- description: create$6().trim().nullable().defined().test(
10293
- "description-required",
10294
- "Product description is required",
10295
- function(value) {
10296
- return value !== null && value !== void 0 && value.trim().length > 0;
10297
- }
10298
- ),
10302
+ description: create$6().trim().nullable(),
10299
10303
  name: create$6().trim().nullable().defined().test("name-required", "Product name is required", function(value) {
10300
10304
  return value !== null && value !== void 0 && value.trim().length > 0;
10301
10305
  }),
10302
10306
  price: create$5().transform((value, originalValue) => originalValue === "" ? null : value).min(0).nullable().defined().test("price-required", "Product price is required", function(value) {
10303
10307
  return value !== null && value !== void 0;
10304
10308
  }),
10309
+ priceUnit: create$6().trim().nullable().defined().test("unit-required", "Product unit is required", function(value) {
10310
+ return value !== null && value !== void 0 && value.trim().length > 0;
10311
+ }),
10305
10312
  productGroups: create$2().of(create$6().defined()).transform(
10306
10313
  (value, originalValue) => originalValue === void 0 ? null : value
10307
10314
  ).nullable().test(
@@ -11615,6 +11622,7 @@ var productTypeSchema = new MongooseSchema13(
11615
11622
  description: { required: false, type: String },
11616
11623
  name: { required: false, type: String },
11617
11624
  price: { required: false, type: Number },
11625
+ priceUnit: { required: false, type: String },
11618
11626
  productGroups: { required: false, type: [String] }
11619
11627
  },
11620
11628
  { _id: false }
@@ -12166,9 +12174,22 @@ function convertObjectIdsToStrings(obj) {
12166
12174
  return obj;
12167
12175
  }
12168
12176
 
12177
+ // src/service/event.ts
12178
+ async function findEventOrImportedMarketById(resourceId) {
12179
+ if (!resourceId) {
12180
+ return null;
12181
+ }
12182
+ const normalizedId = convertObjectIdsToStrings(resourceId);
12183
+ const [eventDoc, googleImportedDoc] = await Promise.all([
12184
+ EventModel.findById(normalizedId).select("_id name").lean().exec(),
12185
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
12186
+ ]);
12187
+ return eventDoc ?? googleImportedDoc;
12188
+ }
12189
+
12169
12190
  // src/types/index.ts
12170
12191
  var import_express = __toESM(require("express"));
12171
- var import_mongoose23 = __toESM(require("mongoose"));
12192
+ var import_mongoose24 = __toESM(require("mongoose"));
12172
12193
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12173
12194
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12174
12195
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12209,6 +12230,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12209
12230
  convertObjectIdsToStrings,
12210
12231
  dateTimeSchema,
12211
12232
  express,
12233
+ findEventOrImportedMarketById,
12212
12234
  locationGeoSchema,
12213
12235
  locationsSchema,
12214
12236
  mongoose,