@quesmed/types-rn 2.6.17 → 2.6.19

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.
@@ -17,6 +17,7 @@ export interface IMockTestType {
17
17
  }
18
18
  export interface IMockTest {
19
19
  id: Id;
20
+ demo: boolean;
20
21
  createdAt: number | Date;
21
22
  title: string;
22
23
  topicIds: number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.17",
3
+ "version": "2.6.19",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -5,6 +5,7 @@ const client_1 = require("@apollo/client");
5
5
  exports.MOCK_TEST_FIELDS = (0, client_1.gql) `
6
6
  fragment MockTestFields on MockTest {
7
7
  id
8
+ demo
8
9
  title
9
10
  passingMark
10
11
  correct
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateQuestionHighlights = exports.ADD_QUESTION_HIGHLIGHT = exports.optimisticQuestionCommentRemove = exports.updateQuestionCommentsRemove = exports.QUESTION_COMMENT_REMOVE = exports.optimisticCommentLike = exports.QUESTION_COMMENT_LIKE = exports.optimisticQuestionComment = exports.updateQuestionComments = exports.QUESTION_COMMENTS = exports.optimisticQuestionLike = exports.QUESTION_LIKE = exports.getQuestionTypeName = exports.getQuestionHighlightsFragment = exports.getLikeData = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_COMMENT_FIELDS = exports.QUESTION_RANKING_HIGHLIGHT_FIELDS = exports.QUESTION_SELECT3_HIGHLIGHT_FIELDS = exports.QUESTION_EMQ_HIGHLIGHT_FIELDS = exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = exports.QUESTION_SBA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_HIGHLIGHT_FIELDS = exports.QUESTION_RANKING_COMMENT_FIELDS = exports.QUESTION_SELECT3_COMMENT_FIELDS = exports.QUESTION_EMQ_COMMENT_FIELDS = exports.QUESTION_QA_COMMENT_FIELDS = exports.QUESTION_SBA_COMMENT_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
+ const luxon_1 = require("luxon");
5
6
  const models_1 = require("../../../models");
6
7
  exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
7
8
  fragment QuestionSBAComments on QuestionSBA {
@@ -779,7 +780,7 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
779
780
  if (!variables || !questionCommentRemove) {
780
781
  return;
781
782
  }
782
- const { questionId, id: commentId, parentId, userId, user, } = questionCommentRemove;
783
+ const { questionId, id: commentId, parentId, userId, user, createdAt, } = questionCommentRemove;
783
784
  try {
784
785
  const dataFragment = cache.readFragment({
785
786
  id: cache.identify({
@@ -790,6 +791,15 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
790
791
  });
791
792
  if (dataFragment) {
792
793
  const { comments = [] } = dataFragment;
794
+ const createdAtDate = luxon_1.DateTime.fromJSDate(createdAt);
795
+ const diffInHours = luxon_1.DateTime.now().diff(createdAtDate, 'hours').hours;
796
+ let updatedComments = [];
797
+ if (diffInHours >= 24) {
798
+ updatedComments = updateCommentFromDiscussion(comments, commentId, { userId, user }, parentId);
799
+ }
800
+ else {
801
+ updatedComments = removeCommnetFromDiscussion(comments, commentId, parentId);
802
+ }
793
803
  cache.writeFragment({
794
804
  id: cache.identify({
795
805
  id: questionId,
@@ -797,7 +807,7 @@ const updateQuestionCommentsRemove = (typeId) => (cache, result, options) => {
797
807
  }),
798
808
  data: {
799
809
  ...dataFragment,
800
- comments: updateCommentFromDiscussion(comments, commentId, { userId, user }, parentId),
810
+ comments: updatedComments,
801
811
  },
802
812
  fragment: getQuestionFragment(typeId),
803
813
  });