@timardex/cluemart-server-shared 1.0.310 → 1.1.0

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.
@@ -1,7 +1,7 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, RelationType, AffiliateRewardType, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
2
+ import { RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, RelationType, AffiliateRewardEnumType, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
3
3
  import mongoose__default from 'mongoose';
4
- import { O as ObjectId } from './Chat-Wn7yfc3v.mjs';
4
+ import { O as ObjectId } from './Chat-NS-2VVEV.js';
5
5
 
6
6
  type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
7
7
  postId: ObjectId;
@@ -372,22 +372,53 @@ declare const RelationModel: mongoose__default.Model<SchemaRelationType, {}, {},
372
372
  __v: number;
373
373
  }, any>;
374
374
 
375
- type SchemaAffiliateReward = AffiliateRewardType;
376
- type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId" | "resourceOwner"> & {
375
+ /** Persistence reward dates are JS Date; GraphQL AffiliateRewardType uses ISO strings. */
376
+ type SchemaAffiliateReward = {
377
+ createdAt: Date;
378
+ redeemedAt?: Date | null;
379
+ rewardDescription: string;
380
+ rewardType: AffiliateRewardEnumType;
381
+ rewardValue: number;
382
+ };
383
+ type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceDeletedAt" | "resourceId" | "resourceOwner" | "rewards"> & {
384
+ resourceDeletedAt?: Date | null;
377
385
  resourceId: ObjectId;
378
386
  resourceOwner: SchemaOwnerType;
387
+ rewards?: SchemaAffiliateReward[];
388
+ };
389
+ /** Persistence redeem-history dates are JS Date; GraphQL RedeemHistoryType uses ISO strings. */
390
+ type SchemaRedeemHistory = {
391
+ paidAt?: Date | null;
392
+ redeemedAt: Date;
393
+ rewardValue: number;
379
394
  };
380
- type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
395
+ /**
396
+ * Mongoose affiliate document. GraphQL `Date` is an ISO string at the wire;
397
+ * documents store JS Date. Dual-shape vs generated AffiliateType — do not collapse.
398
+ */
399
+ type SchemaAffiliateType = Omit<AffiliateType, "_id" | "affiliateBonusRewards" | "affiliateResources" | "approvedAt" | "createdAt" | "deletedAt" | "owner" | "redeemHistory" | "updatedAt"> & {
400
+ affiliateBonusRewards?: SchemaAffiliateReward[];
381
401
  affiliateResources: SchemaAffiliateResourceType[];
402
+ approvedAt?: Date | null;
403
+ createdAt: Date;
404
+ deletedAt?: Date | null;
382
405
  owner: SchemaOwnerType;
406
+ redeemHistory?: SchemaRedeemHistory[];
407
+ updatedAt: Date;
383
408
  };
384
- declare const AffiliateModel: mongoose__default.Model<AffiliateDocument, {}, {}, {}, mongoose__default.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
409
+ declare const AffiliateModel: mongoose__default.Model<SchemaAffiliateType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAffiliateType, {}, {}> & Omit<AffiliateType, "_id" | "createdAt" | "deletedAt" | "updatedAt" | "approvedAt" | "owner" | "affiliateBonusRewards" | "affiliateResources" | "redeemHistory"> & {
410
+ affiliateBonusRewards?: SchemaAffiliateReward[];
385
411
  affiliateResources: SchemaAffiliateResourceType[];
412
+ approvedAt?: Date | null;
413
+ createdAt: Date;
414
+ deletedAt?: Date | null;
386
415
  owner: SchemaOwnerType;
416
+ redeemHistory?: SchemaRedeemHistory[];
417
+ updatedAt: Date;
387
418
  } & {
388
419
  _id: mongoose__default.Types.ObjectId;
389
420
  } & {
390
421
  __v: number;
391
422
  }, any>;
392
423
 
393
- export { AffiliateModel as A, CategorySchema as C, OwnerTypeSchema as O, ResourceImageTypeSchema as R, type SchemaOwnerType as S, type SchemaRelatedPostType as a, SocialMediaTypeSchema as b, ContactDetailsSchema as c, dateTimeSchema as d, locationsSchema as e, relatedPostSchema as f, baseResourceFields as g, relationDatesSchema as h, type SchemaRelationType as i, RelationTypeSchema as j, RelationModel as k, locationGeoSchema as l, type SchemaAffiliateReward as m, type SchemaAffiliateResourceType as n, resourceRelationsSchema as r, socialShareResourceSchema as s, termsAgreementSchema as t, userLicenseSchema as u };
424
+ export { AffiliateModel as A, CategorySchema as C, OwnerTypeSchema as O, ResourceImageTypeSchema as R, type SchemaOwnerType as S, type SchemaRelatedPostType as a, SocialMediaTypeSchema as b, ContactDetailsSchema as c, dateTimeSchema as d, locationsSchema as e, relatedPostSchema as f, baseResourceFields as g, relationDatesSchema as h, type SchemaRelationType as i, RelationTypeSchema as j, RelationModel as k, locationGeoSchema as l, type SchemaAffiliateReward as m, type SchemaAffiliateResourceType as n, type SchemaAffiliateType as o, resourceRelationsSchema as r, socialShareResourceSchema as s, termsAgreementSchema as t, userLicenseSchema as u };
@@ -1,7 +1,7 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, RelationType, AffiliateRewardType, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
2
+ import { RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, RelationType, AffiliateRewardEnumType, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
3
3
  import mongoose__default from 'mongoose';
4
- import { O as ObjectId } from './Chat-Wn7yfc3v.js';
4
+ import { O as ObjectId } from './Chat-NS-2VVEV.mjs';
5
5
 
6
6
  type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
7
7
  postId: ObjectId;
@@ -372,22 +372,53 @@ declare const RelationModel: mongoose__default.Model<SchemaRelationType, {}, {},
372
372
  __v: number;
373
373
  }, any>;
374
374
 
375
- type SchemaAffiliateReward = AffiliateRewardType;
376
- type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId" | "resourceOwner"> & {
375
+ /** Persistence reward dates are JS Date; GraphQL AffiliateRewardType uses ISO strings. */
376
+ type SchemaAffiliateReward = {
377
+ createdAt: Date;
378
+ redeemedAt?: Date | null;
379
+ rewardDescription: string;
380
+ rewardType: AffiliateRewardEnumType;
381
+ rewardValue: number;
382
+ };
383
+ type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceDeletedAt" | "resourceId" | "resourceOwner" | "rewards"> & {
384
+ resourceDeletedAt?: Date | null;
377
385
  resourceId: ObjectId;
378
386
  resourceOwner: SchemaOwnerType;
387
+ rewards?: SchemaAffiliateReward[];
388
+ };
389
+ /** Persistence redeem-history dates are JS Date; GraphQL RedeemHistoryType uses ISO strings. */
390
+ type SchemaRedeemHistory = {
391
+ paidAt?: Date | null;
392
+ redeemedAt: Date;
393
+ rewardValue: number;
379
394
  };
380
- type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
395
+ /**
396
+ * Mongoose affiliate document. GraphQL `Date` is an ISO string at the wire;
397
+ * documents store JS Date. Dual-shape vs generated AffiliateType — do not collapse.
398
+ */
399
+ type SchemaAffiliateType = Omit<AffiliateType, "_id" | "affiliateBonusRewards" | "affiliateResources" | "approvedAt" | "createdAt" | "deletedAt" | "owner" | "redeemHistory" | "updatedAt"> & {
400
+ affiliateBonusRewards?: SchemaAffiliateReward[];
381
401
  affiliateResources: SchemaAffiliateResourceType[];
402
+ approvedAt?: Date | null;
403
+ createdAt: Date;
404
+ deletedAt?: Date | null;
382
405
  owner: SchemaOwnerType;
406
+ redeemHistory?: SchemaRedeemHistory[];
407
+ updatedAt: Date;
383
408
  };
384
- declare const AffiliateModel: mongoose__default.Model<AffiliateDocument, {}, {}, {}, mongoose__default.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
409
+ declare const AffiliateModel: mongoose__default.Model<SchemaAffiliateType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaAffiliateType, {}, {}> & Omit<AffiliateType, "_id" | "createdAt" | "deletedAt" | "updatedAt" | "approvedAt" | "owner" | "affiliateBonusRewards" | "affiliateResources" | "redeemHistory"> & {
410
+ affiliateBonusRewards?: SchemaAffiliateReward[];
385
411
  affiliateResources: SchemaAffiliateResourceType[];
412
+ approvedAt?: Date | null;
413
+ createdAt: Date;
414
+ deletedAt?: Date | null;
386
415
  owner: SchemaOwnerType;
416
+ redeemHistory?: SchemaRedeemHistory[];
417
+ updatedAt: Date;
387
418
  } & {
388
419
  _id: mongoose__default.Types.ObjectId;
389
420
  } & {
390
421
  __v: number;
391
422
  }, any>;
392
423
 
393
- export { AffiliateModel as A, CategorySchema as C, OwnerTypeSchema as O, ResourceImageTypeSchema as R, type SchemaOwnerType as S, type SchemaRelatedPostType as a, SocialMediaTypeSchema as b, ContactDetailsSchema as c, dateTimeSchema as d, locationsSchema as e, relatedPostSchema as f, baseResourceFields as g, relationDatesSchema as h, type SchemaRelationType as i, RelationTypeSchema as j, RelationModel as k, locationGeoSchema as l, type SchemaAffiliateReward as m, type SchemaAffiliateResourceType as n, resourceRelationsSchema as r, socialShareResourceSchema as s, termsAgreementSchema as t, userLicenseSchema as u };
424
+ export { AffiliateModel as A, CategorySchema as C, OwnerTypeSchema as O, ResourceImageTypeSchema as R, type SchemaOwnerType as S, type SchemaRelatedPostType as a, SocialMediaTypeSchema as b, ContactDetailsSchema as c, dateTimeSchema as d, locationsSchema as e, relatedPostSchema as f, baseResourceFields as g, relationDatesSchema as h, type SchemaRelationType as i, RelationTypeSchema as j, RelationModel as k, locationGeoSchema as l, type SchemaAffiliateReward as m, type SchemaAffiliateResourceType as n, type SchemaAffiliateType as o, resourceRelationsSchema as r, socialShareResourceSchema as s, termsAgreementSchema as t, userLicenseSchema as u };
@@ -1,4 +1,4 @@
1
- import { CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType } from '@timardex/cluemart-shared';
1
+ import { CreateBulkNotificationInput, NotificationType, UserRoleEnumType, ChatMessageType, ChatParticipantType, ChatType } from '@timardex/cluemart-shared';
2
2
  import mongoose__default from 'mongoose';
3
3
  import { NotificationCount } from '@timardex/cluemart-shared/types';
4
4
  import express from 'express';
@@ -26,7 +26,7 @@ declare enum EnumPubSubEvents {
26
26
  }
27
27
  interface AuthUser {
28
28
  email: string;
29
- roles: EnumUserRole[];
29
+ roles: UserRoleEnumType[];
30
30
  userId: ObjectId;
31
31
  }
32
32
  interface SubscriptionPayload {
@@ -52,10 +52,12 @@ interface GraphQLContext {
52
52
  type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
53
53
  senderId: ObjectId;
54
54
  };
55
- type SchemaChatMessageReactionType = Omit<NonNullable<ChatMessageType["likedBy"]>[number], "userId"> & {
55
+ type SchemaChatMessageReactionType = Omit<NonNullable<NonNullable<ChatMessageType["likedBy"]>[number]>, "userId" | "createdAt"> & {
56
+ createdAt: Date;
56
57
  userId: ObjectId;
57
58
  };
58
- type SchemaChatMessageSeenType = Omit<NonNullable<ChatMessageType["seenBy"]>[number], "userId"> & {
59
+ type SchemaChatMessageSeenType = Omit<NonNullable<NonNullable<ChatMessageType["seenBy"]>[number]>, "userId" | "seenAt"> & {
60
+ seenAt: Date;
59
61
  userId: ObjectId;
60
62
  };
61
63
  type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageId" | "replyPreview" | "likedBy" | "seenBy"> & {
@@ -65,7 +67,7 @@ type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageI
65
67
  likedBy?: SchemaChatMessageReactionType[];
66
68
  seenBy?: SchemaChatMessageSeenType[];
67
69
  };
68
- type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
70
+ type SchemaParticipantType = Omit<ChatParticipantType, "userId"> & {
69
71
  userId: ObjectId;
70
72
  };
71
73
  type SchemaChatType = Omit<ChatType, "participants" | "messages"> & {
@@ -1,4 +1,4 @@
1
- import { CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType } from '@timardex/cluemart-shared';
1
+ import { CreateBulkNotificationInput, NotificationType, UserRoleEnumType, ChatMessageType, ChatParticipantType, ChatType } from '@timardex/cluemart-shared';
2
2
  import mongoose__default from 'mongoose';
3
3
  import { NotificationCount } from '@timardex/cluemart-shared/types';
4
4
  import express from 'express';
@@ -26,7 +26,7 @@ declare enum EnumPubSubEvents {
26
26
  }
27
27
  interface AuthUser {
28
28
  email: string;
29
- roles: EnumUserRole[];
29
+ roles: UserRoleEnumType[];
30
30
  userId: ObjectId;
31
31
  }
32
32
  interface SubscriptionPayload {
@@ -52,10 +52,12 @@ interface GraphQLContext {
52
52
  type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
53
53
  senderId: ObjectId;
54
54
  };
55
- type SchemaChatMessageReactionType = Omit<NonNullable<ChatMessageType["likedBy"]>[number], "userId"> & {
55
+ type SchemaChatMessageReactionType = Omit<NonNullable<NonNullable<ChatMessageType["likedBy"]>[number]>, "userId" | "createdAt"> & {
56
+ createdAt: Date;
56
57
  userId: ObjectId;
57
58
  };
58
- type SchemaChatMessageSeenType = Omit<NonNullable<ChatMessageType["seenBy"]>[number], "userId"> & {
59
+ type SchemaChatMessageSeenType = Omit<NonNullable<NonNullable<ChatMessageType["seenBy"]>[number]>, "userId" | "seenAt"> & {
60
+ seenAt: Date;
59
61
  userId: ObjectId;
60
62
  };
61
63
  type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageId" | "replyPreview" | "likedBy" | "seenBy"> & {
@@ -65,7 +67,7 @@ type SchemaChatMessageType = Omit<ChatMessageType, "senderId" | "replyToMessageI
65
67
  likedBy?: SchemaChatMessageReactionType[];
66
68
  seenBy?: SchemaChatMessageSeenType[];
67
69
  };
68
- type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
70
+ type SchemaParticipantType = Omit<ChatParticipantType, "userId"> & {
69
71
  userId: ObjectId;
70
72
  };
71
73
  type SchemaChatType = Omit<ChatType, "participants" | "messages"> & {
@@ -14,4 +14,4 @@ export {
14
14
  mongoose,
15
15
  EnumPubSubEvents
16
16
  };
17
- //# sourceMappingURL=chunk-6PNG5BI5.mjs.map
17
+ //# sourceMappingURL=chunk-RU5PTSIO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/index.ts"],"sourcesContent":["import { UserRoleEnumType } from \"@timardex/cluemart-shared\";\nimport { NotificationCount } from \"@timardex/cluemart-shared/types\";\nimport express from \"express\";\nimport mongoose from \"mongoose\";\n\nimport { SchemaChatType } from \"../mongoose/chat/Chat\";\nimport { SchemaNotificationType } from \"../mongoose/Notification\";\n\n// chnage to export type ObjectId = mongoose.Types.ObjectId;\n// chnage in server when setting decideGameType\nexport type ObjectId = mongoose.Types.ObjectId;\n\nexport enum EnumPubSubEvents {\n GET_CHAT_MESSAGE = \"GET_CHAT_MESSAGE\",\n GET_NOTIFICATIONS = \"GET_NOTIFICATIONS\",\n GET_NOTIFICATIONS_COUNT = \"GET_NOTIFICATIONS_COUNT\",\n USER_TYPING = \"USER_TYPING\",\n}\n\nexport interface AuthUser {\n email: string;\n roles: UserRoleEnumType[];\n userId: ObjectId;\n}\n\nexport interface SubscriptionPayload {\n getChatMessage?: SchemaChatType;\n userTyping?: SchemaChatType; // NOT USED\n getNotifications?: SchemaNotificationType[];\n // Used only for filtering; not part of the GraphQL schema output\n getNotificationsUserId?: ObjectId;\n getNotificationsCount?: NotificationCount & { userId: ObjectId };\n}\n\nexport interface GraphQLContext {\n appVersion: string | null;\n user: AuthUser | null;\n pubsub: {\n publish: (\n eventName: EnumPubSubEvents,\n payload: SubscriptionPayload,\n ) => void;\n subscribe: (eventName: EnumPubSubEvents) => AsyncIterable<any>;\n };\n request: express.Request;\n response: express.Response;\n}\n\nexport { mongoose, express };\n"],"mappings":";AAEA,OAAO,aAAa;AACpB,OAAO,cAAc;AASd,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,uBAAoB;AACpB,EAAAA,kBAAA,6BAA0B;AAC1B,EAAAA,kBAAA,iBAAc;AAJJ,SAAAA;AAAA,GAAA;","names":["EnumPubSubEvents"]}