@timardex/cluemart-server-shared 1.0.77 → 1.0.79

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.
@@ -49,9 +49,24 @@ interface GraphQLContext {
49
49
  response: express.Response;
50
50
  }
51
51
 
52
- type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
52
+ type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
53
53
  senderId: ObjectId;
54
54
  };
55
+ type SchemaChatMessageReactionType = Omit<NonNullable<ChatMessageType["likedBy"]>[number], "userId" | "createdAt"> & {
56
+ userId: ObjectId;
57
+ createdAt: Date;
58
+ };
59
+ type SchemaChatMessageSeenType = Omit<NonNullable<ChatMessageType["seenBy"]>[number], "userId" | "seenAt"> & {
60
+ userId: ObjectId;
61
+ seenAt: Date;
62
+ };
63
+ type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageId" | "replyPreview" | "likedBy" | "seenBy"> & {
64
+ senderId: ObjectId;
65
+ replyToMessageId?: ObjectId | null;
66
+ replyPreview?: SchemaChatMessageReplyPreviewType | null;
67
+ likedBy?: SchemaChatMessageReactionType[];
68
+ seenBy?: SchemaChatMessageSeenType[];
69
+ };
55
70
  type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
56
71
  userId: ObjectId;
57
72
  };
@@ -79,4 +94,4 @@ declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Doc
79
94
  __v: number;
80
95
  }, any>;
81
96
 
82
- export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageType as S, type SchemaParticipantType as a, type SchemaChatType as b, type SchemaCreateBulkNotificationInput as c, type SchemaNotificationType as d, type SubscriptionPayload as e };
97
+ export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageReplyPreviewType as S, type SchemaChatMessageReactionType as a, type SchemaChatMessageSeenType as b, type SchemaChatMessageType as c, type SchemaParticipantType as d, type SchemaChatType as e, type SchemaCreateBulkNotificationInput as f, type SchemaNotificationType as g, type SubscriptionPayload as h };
@@ -49,9 +49,24 @@ interface GraphQLContext {
49
49
  response: express.Response;
50
50
  }
51
51
 
52
- type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
52
+ type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
53
53
  senderId: ObjectId;
54
54
  };
55
+ type SchemaChatMessageReactionType = Omit<NonNullable<ChatMessageType["likedBy"]>[number], "userId" | "createdAt"> & {
56
+ userId: ObjectId;
57
+ createdAt: Date;
58
+ };
59
+ type SchemaChatMessageSeenType = Omit<NonNullable<ChatMessageType["seenBy"]>[number], "userId" | "seenAt"> & {
60
+ userId: ObjectId;
61
+ seenAt: Date;
62
+ };
63
+ type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageId" | "replyPreview" | "likedBy" | "seenBy"> & {
64
+ senderId: ObjectId;
65
+ replyToMessageId?: ObjectId | null;
66
+ replyPreview?: SchemaChatMessageReplyPreviewType | null;
67
+ likedBy?: SchemaChatMessageReactionType[];
68
+ seenBy?: SchemaChatMessageSeenType[];
69
+ };
55
70
  type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
56
71
  userId: ObjectId;
57
72
  };
@@ -79,4 +94,4 @@ declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Doc
79
94
  __v: number;
80
95
  }, any>;
81
96
 
82
- export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageType as S, type SchemaParticipantType as a, type SchemaChatType as b, type SchemaCreateBulkNotificationInput as c, type SchemaNotificationType as d, type SubscriptionPayload as e };
97
+ export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageReplyPreviewType as S, type SchemaChatMessageReactionType as a, type SchemaChatMessageSeenType as b, type SchemaChatMessageType as c, type SchemaParticipantType as d, type SchemaChatType as e, type SchemaCreateBulkNotificationInput as f, type SchemaNotificationType as g, type SubscriptionPayload as h };
@@ -6828,13 +6828,25 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource22) => {
6828
6828
  })(EnumRelationResource || {});
6829
6829
  var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType22) => {
6830
6830
  EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_EVENT"] = "added_as_associate_event";
6831
+ EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_PARTNER"] = "added_as_associate_partner";
6831
6832
  EnumNotificationResourceType22["ADDED_AS_ASSOCIATE_VENDOR"] = "added_as_associate_vendor";
6832
6833
  EnumNotificationResourceType22["APPROVED_EVENT"] = "approved_event";
6834
+ EnumNotificationResourceType22["APPROVED_PARTNER"] = "approved_partner";
6833
6835
  EnumNotificationResourceType22["APPROVED_VENDOR"] = "approved_vendor";
6834
6836
  EnumNotificationResourceType22["CREATED_EVENT"] = "created_event";
6837
+ EnumNotificationResourceType22["CREATED_PARTNER"] = "created_partner";
6835
6838
  EnumNotificationResourceType22["CREATED_VENDOR"] = "created_vendor";
6839
+ EnumNotificationResourceType22["DEACTIVATED_EVENT"] = "deactivated_event";
6840
+ EnumNotificationResourceType22["DEACTIVATED_PARTNER"] = "deactivated_partner";
6841
+ EnumNotificationResourceType22["DEACTIVATED_VENDOR"] = "deactivated_vendor";
6842
+ EnumNotificationResourceType22["DECLINED_EVENT"] = "declined_event";
6843
+ EnumNotificationResourceType22["DECLINED_PARTNER"] = "declined_partner";
6844
+ EnumNotificationResourceType22["DECLINED_VENDOR"] = "declined_vendor";
6836
6845
  EnumNotificationResourceType22["EVENT_INVITE_VENDOR"] = "event_invite_vendor";
6837
6846
  EnumNotificationResourceType22["EVENT_STARTING_SOON"] = "event_starting_soon";
6847
+ EnumNotificationResourceType22["EXPIRATION_REMINDER_EVENT"] = "expiration_reminder_event";
6848
+ EnumNotificationResourceType22["EXPIRATION_REMINDER_PARTNER"] = "expiration_reminder_partner";
6849
+ EnumNotificationResourceType22["EXPIRATION_REMINDER_VENDOR"] = "expiration_reminder_vendor";
6838
6850
  EnumNotificationResourceType22["NEW_CHAT_MESSAGE"] = "new_chat_message";
6839
6851
  EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
6840
6852
  EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
@@ -8357,6 +8369,7 @@ var USER_FIELDS_FRAGMENT = gql`
8357
8369
  licences {
8358
8370
  ...LicenceFields
8359
8371
  }
8372
+ partner
8360
8373
  platform
8361
8374
  preferredRegion
8362
8375
  refreshToken
@@ -9043,7 +9056,21 @@ var CHAT_MESSAGE_FIELDS_FRAGMENT = gql`
9043
9056
  _id
9044
9057
  content
9045
9058
  createdAt
9059
+ replyToMessageId
9060
+ replyPreview {
9061
+ senderId
9062
+ senderName
9063
+ contentPreview
9064
+ }
9065
+ likedBy {
9066
+ userId
9067
+ createdAt
9068
+ }
9046
9069
  senderId
9070
+ seenBy {
9071
+ userId
9072
+ seenAt
9073
+ }
9047
9074
  updatedAt
9048
9075
  }
9049
9076
  `;
@@ -9070,6 +9097,7 @@ var CHAT_FIELDS_FRAGMENT = gql`
9070
9097
  participants {
9071
9098
  ...ChatParticipantFields
9072
9099
  }
9100
+ region
9073
9101
  updatedAt
9074
9102
  }
9075
9103
  ${CHAT_MESSAGE_FIELDS_FRAGMENT}
@@ -9091,6 +9119,14 @@ var USER_CHATS = gql`
9091
9119
  }
9092
9120
  ${CHAT_FIELDS_FRAGMENT}
9093
9121
  `;
9122
+ var GET_CHATS_BY_REGION = gql`
9123
+ query getChatsByRegion($region: String!) {
9124
+ chatsByRegion(region: $region) {
9125
+ ...ChatFields
9126
+ }
9127
+ }
9128
+ ${CHAT_FIELDS_FRAGMENT}
9129
+ `;
9094
9130
  var SEND_CHAT_MESSAGE_MUTATION = gql`
9095
9131
  mutation sendChatMessage($_id: ID!, $input: ChatMessageInputType!) {
9096
9132
  sendChatMessage(_id: $_id, input: $input) {
@@ -9117,6 +9153,22 @@ var REMOVE_PARTICIPANT_FROM_CHAT_MUTATION = gql`
9117
9153
  removeParticipantFromChat(chatId: $chatId, userId: $userId)
9118
9154
  }
9119
9155
  `;
9156
+ var TOGGLE_CHAT_MESSAGE_LIKE_MUTATION = gql`
9157
+ mutation toggleChatMessageLike($chatId: ID!, $messageId: ID!) {
9158
+ toggleChatMessageLike(chatId: $chatId, messageId: $messageId) {
9159
+ ...ChatFields
9160
+ }
9161
+ }
9162
+ ${CHAT_FIELDS_FRAGMENT}
9163
+ `;
9164
+ var MARK_CHAT_MESSAGES_SEEN_MUTATION = gql`
9165
+ mutation markChatMessagesSeen($chatId: ID!, $messageIds: [ID!]!) {
9166
+ markChatMessagesSeen(chatId: $chatId, messageIds: $messageIds) {
9167
+ ...ChatFields
9168
+ }
9169
+ }
9170
+ ${CHAT_FIELDS_FRAGMENT}
9171
+ `;
9120
9172
  var GET_CHAT_MESSAGE = gql`
9121
9173
  subscription {
9122
9174
  getChatMessage {
@@ -11199,9 +11251,54 @@ var AdModel = mongoose4.models.Ad || mongoose4.model("Ad", schema2);
11199
11251
  // src/mongoose/Chat.ts
11200
11252
  import mongoose5 from "mongoose";
11201
11253
  var MongooseSchema5 = mongoose5.Schema;
11254
+ var MessageReplyPreviewSchema = new MongooseSchema5(
11255
+ {
11256
+ contentPreview: { required: true, type: String },
11257
+ senderId: {
11258
+ ref: "User",
11259
+ required: true,
11260
+ type: mongoose5.Schema.Types.ObjectId
11261
+ },
11262
+ senderName: { required: true, type: String }
11263
+ },
11264
+ { _id: false }
11265
+ );
11266
+ var MessageReactionSchema = new MongooseSchema5(
11267
+ {
11268
+ createdAt: { required: true, type: Date },
11269
+ userId: {
11270
+ ref: "User",
11271
+ required: true,
11272
+ type: mongoose5.Schema.Types.ObjectId
11273
+ }
11274
+ },
11275
+ { _id: false }
11276
+ );
11277
+ var MessageSeenSchema = new MongooseSchema5(
11278
+ {
11279
+ seenAt: { required: true, type: Date },
11280
+ userId: {
11281
+ ref: "User",
11282
+ required: true,
11283
+ type: mongoose5.Schema.Types.ObjectId
11284
+ }
11285
+ },
11286
+ { _id: false }
11287
+ );
11202
11288
  var MessageSchema = new MongooseSchema5(
11203
11289
  {
11204
11290
  content: { required: true, type: String },
11291
+ likedBy: { default: [], required: false, type: [MessageReactionSchema] },
11292
+ replyPreview: {
11293
+ required: false,
11294
+ type: MessageReplyPreviewSchema
11295
+ },
11296
+ replyToMessageId: {
11297
+ ref: "Chat.messages",
11298
+ required: false,
11299
+ type: mongoose5.Schema.Types.ObjectId
11300
+ },
11301
+ seenBy: { default: [], required: false, type: [MessageSeenSchema] },
11205
11302
  senderId: {
11206
11303
  ref: "User",
11207
11304
  required: true,
@@ -11236,7 +11333,8 @@ var ChatSchema = new MongooseSchema5(
11236
11333
  },
11237
11334
  deletedAt: { default: null, required: false, type: Date },
11238
11335
  messages: [MessageSchema],
11239
- participants: [ParticipantSchema]
11336
+ participants: [ParticipantSchema],
11337
+ region: { default: null, required: false, type: String }
11240
11338
  },
11241
11339
  {
11242
11340
  timestamps: true
@@ -11371,7 +11469,7 @@ schema4.index({ isRead: 1, userId: 1 });
11371
11469
  schema4.index({ createdAt: -1, userId: 1 });
11372
11470
  var NotificationModel = mongoose7.models.Notification || mongoose7.model("Notification", schema4);
11373
11471
 
11374
- // node_modules/@timardex/cluemart-shared/dist/chunk-FLDXD65Z.mjs
11472
+ // node_modules/@timardex/cluemart-shared/dist/chunk-R5HMLIJS.mjs
11375
11473
  var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
11376
11474
  EnumOSPlatform22["ANDROID"] = "android";
11377
11475
  EnumOSPlatform22["IOS"] = "ios";
@@ -12100,4 +12198,4 @@ react/cjs/react.development.js:
12100
12198
  * LICENSE file in the root directory of this source tree.
12101
12199
  *)
12102
12200
  */
12103
- //# sourceMappingURL=chunk-YWPI5EO2.mjs.map
12201
+ //# sourceMappingURL=chunk-SWHWX4E5.mjs.map