phx-node 1.0.61 → 1.0.62

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.
@@ -35,20 +35,24 @@ export declare class PHXNotificationByModuleService {
35
35
  readNotification({ notificationId }: {
36
36
  notificationId: number;
37
37
  }): Promise<any>;
38
- updateTotalNotificationAfterRead({ app, deviceId, userId, hostname, moduleCode, notificationType, }: {
38
+ updateTotalNotificationAfterRead({ app, deviceId, userId, hostname, moduleCode, notificationType, action, payload }: {
39
39
  userId: number;
40
40
  hostname: string;
41
41
  deviceId: string;
42
42
  app: string;
43
43
  moduleCode: string;
44
44
  notificationType: string;
45
+ action: string;
46
+ payload: string;
45
47
  }): Promise<void>;
46
- getCurrentTotalNotificationUnreadByModule({ app, deviceId, userId, hostname, moduleCode }: {
48
+ getCurrentTotalNotificationUnreadByModule({ app, deviceId, userId, hostname, moduleCode, studentCode, action }: {
47
49
  app: string;
48
50
  deviceId: string;
49
51
  userId: number;
50
52
  hostname: string;
51
53
  moduleCode: string;
54
+ studentCode: string;
55
+ action: string;
52
56
  }): Promise<{
53
57
  currentTotalNotificationImportant: any;
54
58
  currentTotalNotification: any;
@@ -82,7 +82,7 @@ let PHXNotificationByModuleService = PHXNotificationByModuleService_1 = class PH
82
82
  const readSuccess = returning.length > 0;
83
83
  if (!readSuccess)
84
84
  return response;
85
- const { type: notificationType, module_code } = returning[0];
85
+ const { type: notificationType, module_code, action, payload } = returning[0];
86
86
  yield this.updateTotalNotificationAfterRead({
87
87
  app,
88
88
  deviceId,
@@ -90,44 +90,53 @@ let PHXNotificationByModuleService = PHXNotificationByModuleService_1 = class PH
90
90
  hostname,
91
91
  moduleCode: module_code,
92
92
  notificationType,
93
+ action,
94
+ payload
93
95
  });
94
96
  return response;
95
97
  }));
96
98
  });
97
99
  }
98
100
  updateTotalNotificationAfterRead(_a) {
99
- return __awaiter(this, arguments, void 0, function* ({ app, deviceId, userId, hostname, moduleCode, notificationType, }) {
101
+ return __awaiter(this, arguments, void 0, function* ({ app, deviceId, userId, hostname, moduleCode, notificationType, action, payload }) {
102
+ var _b;
103
+ const studentCode = (_b = JSON.parse(payload)) === null || _b === void 0 ? void 0 : _b.student_code;
100
104
  const { currentTotalNotification, currentTotalNotificationImportant } = yield this.getCurrentTotalNotificationUnreadByModule({
101
105
  app,
102
106
  deviceId,
103
107
  userId,
104
108
  hostname,
105
- moduleCode: moduleCode,
109
+ moduleCode,
110
+ action,
111
+ studentCode
106
112
  });
107
113
  yield this.statisticalNotificationByModuleService.updateStatisticalNotificationByModule({
108
114
  userId,
109
115
  deviceId,
110
116
  hostname,
111
117
  moduleCode,
112
- totalNotificationImportant: notificationType === constant_1.NOTIFICATION_TYPE_IMPORTANT
118
+ action,
119
+ studentCode,
120
+ totalNotificationImportant: Math.max(0, notificationType === constant_1.NOTIFICATION_TYPE_IMPORTANT
113
121
  ? currentTotalNotificationImportant - 1
114
- : currentTotalNotificationImportant,
122
+ : currentTotalNotificationImportant),
115
123
  appName: app,
116
- totalNotification: currentTotalNotification - 1
124
+ totalNotification: Math.max(0, currentTotalNotification - 1)
117
125
  });
118
126
  });
119
127
  }
120
128
  getCurrentTotalNotificationUnreadByModule(_a) {
121
- return __awaiter(this, arguments, void 0, function* ({ app, deviceId, userId, hostname, moduleCode }) {
129
+ return __awaiter(this, arguments, void 0, function* ({ app, deviceId, userId, hostname, moduleCode, studentCode, action }) {
122
130
  var _b;
123
131
  const response = yield this.grpcClientSystemService.queryDataCenter({
124
- query: query_1.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE,
132
+ query: (0, query_1.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE)(studentCode),
125
133
  variables: {
126
134
  app,
127
135
  device_id: deviceId,
128
136
  user_id: userId,
129
137
  hostname,
130
138
  module_code: moduleCode,
139
+ action
131
140
  },
132
141
  });
133
142
  const resultTotal = (_b = response === null || response === void 0 ? void 0 : response.feature_mobile_push_count_notification_unread) === null || _b === void 0 ? void 0 : _b[0];
@@ -163,7 +172,7 @@ let PHXNotificationByModuleService = PHXNotificationByModuleService_1 = class PH
163
172
  const readSuccess = returning.length > 0;
164
173
  if (!readSuccess)
165
174
  return response;
166
- const { type: notificationType, module_code } = returning[0];
175
+ const { type: notificationType, module_code, payload, action } = returning[0];
167
176
  yield this.updateTotalNotificationAfterRead({
168
177
  app,
169
178
  deviceId,
@@ -171,6 +180,8 @@ let PHXNotificationByModuleService = PHXNotificationByModuleService_1 = class PH
171
180
  hostname,
172
181
  moduleCode: module_code,
173
182
  notificationType,
183
+ action,
184
+ payload
174
185
  });
175
186
  return response;
176
187
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../src/module/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,uCAAuC;AACvC,0DAKwC;AACxC,iDAAiG;AACjG,0FAAqF;AAErF,yFAA6F;AAqBtF,IAAM,8BAA8B,sCAApC,MAAM,8BAA8B;IAEvC,YACqB,uBAAmD,EACnD,sCAAiF,EACjF,OAAiC;QAFjC,4BAAuB,GAAvB,uBAAuB,CAA4B;QACnD,2CAAsC,GAAtC,sCAAsC,CAA2C;QAChE,YAAO,GAAP,OAAO,CAAS;QAJtD,WAAM,GAAG,IAAI,eAAM,CAAC,gCAA8B,CAAC,IAAI,CAAC,CAAC;IAKtD,CAAC;IAKS,2BAA2B;6DAAC,EACvC,MAAM,GAAG,CAAC,EACV,MAAM,EACN,MAAM,EAKP;YACG,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAW,OAAO,CAAC,WAAW,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAW,OAAO,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,QAAQ,GAAW,OAAO,CAA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BAAgB,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC7D,MAAM,IAAI,CAAC,gCAAgC,CAAC;oBACxC,GAAG;oBACH,QAAQ;oBACR,MAAM;oBACN,QAAQ;oBACR,UAAU,EAAE,WAAW;oBACvB,gBAAgB;iBACnB,CAAC,CAAC;gBAEH,OAAO,QAAQ,CAAC;YACpB,CAAC,CAAA,CAAC,CAAC;QACX,CAAC;KAAA;CACJ,CAAA;AAlMY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;IAMJ,WAAA,IAAA,eAAM,EAAC,cAAO,CAAC,CAAA;qCAF0B,uDAA0B;QACX,4EAAyC;QACvD,OAAO;GAL7C,8BAA8B,CAkM1C"}
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../src/module/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,uCAAuC;AACvC,0DAKwC;AACxC,iDAAiG;AACjG,0FAAqF;AAErF,yFAA6F;AAqBtF,IAAM,8BAA8B,sCAApC,MAAM,8BAA8B;IAEvC,YACqB,uBAAmD,EACnD,sCAAiF,EACjF,OAAiC;QAFjC,4BAAuB,GAAvB,uBAAuB,CAA4B;QACnD,2CAAsC,GAAtC,sCAAsC,CAA2C;QAChE,YAAO,GAAP,OAAO,CAAS;QAJtD,WAAM,GAAG,IAAI,eAAM,CAAC,gCAA8B,CAAC,IAAI,CAAC,CAAC;IAKtD,CAAC;IAKS,2BAA2B;6DAAC,EACvC,MAAM,GAAG,CAAC,EACV,MAAM,EACN,MAAM,EAKP;YACG,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAW,OAAO,CAAC,WAAW,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAW,OAAO,CAA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Q;oBACR,OAAO,EAAE,MAAM;oBACf,GAAG;oBACH,SAAS,EAAE,QAAQ;oBACnB,MAAM;oBACN,OAAO,EAAE,MAAM;iBAClB;aACJ,CAAC;iBACD,IAAI,CAAC,CAAO,QAAQ,EAAE,EAAE;gBACrB,MAAM,EACF,0BAA0B,EAAE,EAAE,SAAS,EAAE,GAC5C,GAAG,QAAQ,CAAC;gBACb,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,WAAW;oBAAE,OAAO,QAAQ,CAAC;gBAElC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9E,MAAM,IAAI,CAAC,gCAAgC,CAAC;oBACxC,GAAG;oBACH,QAAQ;oBACR,MAAM;oBACN,QAAQ;oBACR,UAAU,EAAE,WAAW;oBACvB,gBAAgB;oBAChB,MAAM;oBACN,OAAO;iBACV,CAAC,CAAC;gBAEH,OAAO,QAAQ,CAAC;YACpB,CAAC,CAAA,CAAC,CAAC;QACX,CAAC;KAAA;CACJ,CAAA;AApNY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;IAMJ,WAAA,IAAA,eAAM,EAAC,cAAO,CAAC,CAAA;qCAF0B,uDAA0B;QACX,4EAAyC;QACvD,OAAO;GAL7C,8BAA8B,CAoN1C"}
@@ -4,12 +4,14 @@ export declare class PHXStatisticalNotificationByModuleService {
4
4
  private readonly grpcClientSystemService;
5
5
  logger: Logger;
6
6
  constructor(grpcClientSystemService: PHXGrpcClientSystemService);
7
- updateStatisticalNotificationByModule({ userId, deviceId, appName, hostname, moduleCode, totalNotification, totalNotificationImportant, }: {
7
+ updateStatisticalNotificationByModule({ userId, deviceId, appName, hostname, moduleCode, action, studentCode, totalNotification, totalNotificationImportant, }: {
8
8
  userId: number;
9
9
  deviceId: string;
10
10
  hostname: string;
11
11
  appName: string;
12
12
  moduleCode: string;
13
+ studentCode: string;
14
+ action: string;
13
15
  totalNotification: number;
14
16
  totalNotificationImportant: number;
15
17
  }): Promise<void>;
@@ -29,16 +29,17 @@ let PHXStatisticalNotificationByModuleService = PHXStatisticalNotificationByModu
29
29
  this.logger = new common_1.Logger(PHXStatisticalNotificationByModuleService_1.name);
30
30
  }
31
31
  updateStatisticalNotificationByModule(_a) {
32
- return __awaiter(this, arguments, void 0, function* ({ userId, deviceId, appName, hostname, moduleCode, totalNotification, totalNotificationImportant, }) {
32
+ return __awaiter(this, arguments, void 0, function* ({ userId, deviceId, appName, hostname, moduleCode, action, studentCode, totalNotification, totalNotificationImportant, }) {
33
33
  yield this.grpcClientSystemService
34
34
  .mutationDataCenter({
35
- query: query_1.MUTATION_UPDATE_NOTIFICATION_UNREAD,
35
+ query: (0, query_1.MUTATION_UPDATE_NOTIFICATION_UNREAD)(studentCode),
36
36
  variables: {
37
37
  user_id: userId,
38
38
  device_id: deviceId,
39
39
  hostname,
40
40
  app: appName,
41
41
  module_code: moduleCode,
42
+ action,
42
43
  total_notification: totalNotification,
43
44
  total_notification_important: totalNotificationImportant,
44
45
  },
@@ -54,15 +55,7 @@ let PHXStatisticalNotificationByModuleService = PHXStatisticalNotificationByModu
54
55
  return;
55
56
  yield this.grpcClientSystemService.mutationDataCenter({
56
57
  query: query_1.MUTATION_INSERT_NOTIFICATION,
57
- variables: {
58
- user_id: userId,
59
- device_id: deviceId,
60
- hostname,
61
- app: appName,
62
- module_code: moduleCode,
63
- total_notification: totalNotification,
64
- total_notification_important: 0,
65
- },
58
+ variables: Object.assign(Object.assign({ user_id: userId, device_id: deviceId, hostname, app: appName, module_code: moduleCode, action }, (studentCode && { student_code: studentCode })), { total_notification: totalNotification, total_notification_important: totalNotificationImportant }),
66
59
  });
67
60
  this.logger.log('Insert row statistical notification successfully');
68
61
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"statistical-notification.service.js","sourceRoot":"","sources":["../../../src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AAkB,EAAE,iBAAiB;wBACrC,4BAA4B,EAAE,CAAC;qBAClC;iBACJ,CAAC,CAAC;gBAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;YACxE,CAAC,CAAA,CAAC,CAAC;QACX,CAAC;KAAA;CACJ,CAAA;AAlEY,8FAAyC;oDAAzC,yCAAyC;IADrD,IAAA,mBAAU,GAAE;qCAIqC,uDAA0B;GAH/D,yCAAyC,CAkErD"}
1
+ {"version":3,"file":"statistical-notification.service.js","sourceRoot":"","sources":["../../../src/module/notification/statistical-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAkD;AAClD,0DAGwC;AACxC,0FAAqF;AAG9E,IAAM,yCAAyC,iDAA/C,MAAM,yCAAyC;IAElD,YACqB,uBAAmD;QAAnD,4BAAuB,GAAvB,uBAAuB,CAA4B;QAFxE,WAAM,GAAG,IAAI,eAAM,CAAC,2CAAyC,CAAC,IAAI,CAAC,CAAC;IAGjE,CAAC;IAKS,qCAAqC;6DAAC,EAChD,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,0BAA0B,GAW5B;YACG,MAAM,IAAI,CAAC,uBAAuB;iBAC7B,kBAAkB,CAAC;gBAChB,KAAK,EAAE,IAAA,2CAAmC,EAAC,WAAW,CAAC;gBACvD,SAAS,EAAE;oBACP,OAAO,EAAE,MAAM;oBACf,SAAS,EAAE,QAAQ;oBACnB,QAAQ;oBACR,GAAG,EAAE,OAAO;oBACZ,WAAW,EAAE,UAAU;oBACvB,MAAM;oBACN,kBAAkB,EAAE,iBAAiB;oBACrC,4BAA4B,EAAE,0BAA0B;iBAC3D;aACJ,CAAC;iBACD,IAAI,CAAC,CAAO,QAAQ,EAAE,EAAE;gBACrB,MAAM,gCAAgC,GAClC,QAAQ,CAAC,oDAAoD;qBACxD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC9B,IAAI,gCAAgC,EAAE,CAAC;oBACnC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;oBACpE,OAAO;gBACX,CAAC;gBAGD,IAAI,iBAAiB,KAAK,CAAC;oBAAE,OAAO;gBACpC,MAAM,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAAC;oBAClD,KAAK,EAAE,oCAA4B;oBACnC,SAAS,gCACL,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,QAAQ,EACnB,QAAQ,EACR,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,UAAU,EACvB,MAAM,IACH,CAAC,WAAW,IAAI,EAAC,YAAY,EAAE,WAAW,EAAC,CAAC,KAC/C,kBAAkB,EAAE,iBAAiB,EACrC,4BAA4B,EAAE,0BAA0B,GAC3D;iBACJ,CAAC,CAAC;gBAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;YACxE,CAAC,CAAA,CAAC,CAAC;QACX,CAAC;KAAA;CACJ,CAAA;AAzEY,8FAAyC;oDAAzC,yCAAyC;IADrD,IAAA,mBAAU,GAAE;qCAIqC,uDAA0B;GAH/D,yCAAyC,CAyErD"}
@@ -1,6 +1,6 @@
1
1
  export declare const QUERY_GET_LIST_NOTIFICATION_BY_ACTION: string;
2
- export declare const QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE: string;
3
- export declare const MUTATION_UPDATE_NOTIFICATION_UNREAD = "\n mutation MyMutation($hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $user_id: Int!, $total_notification: Int!, $total_notification_important: Int!) {\n update_feature_mobile_push_count_notification_unread(where: {deleted_at: {_is_null: true}, hostname: {_eq: $hostname}, module_code: {_eq: $module_code}, app: {_eq: $app}, device_id: {_eq: $device_id}, user_id: {_eq: $user_id}}, _set: {total_notification: $total_notification, total_notification_important: $total_notification_important, updated_at: \"now\"}) {\n returning {\n total_notification\n total_notification_important\n module_code\n }\n }\n }\n";
2
+ export declare const QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE: (studentCode: string) => string;
3
+ export declare const MUTATION_UPDATE_NOTIFICATION_UNREAD: (studentCode: string) => string;
4
4
  export declare const MUTATION_UPDATE_READ_NOTIFICATION: string;
5
- export declare const MUTATION_INSERT_NOTIFICATION = "\n mutation MyMutation($total_notification: Int!, $total_notification_important: Int!, $user_id: Int!, $hostname: String!, $app: String!, $device_id: String!, $module_code: String!) {\n insert_feature_mobile_push_count_notification_unread(objects: {app: $app, created_at: \"now\", hostname: $hostname, module_code: $module_code, total_notification: $total_notification, total_notification_important: $total_notification_important, user_id: $user_id, device_id: $device_id}) {\n returning {\n total_notification_important\n total_notification\n module_code\n }\n }\n }\n";
5
+ export declare const MUTATION_INSERT_NOTIFICATION = "\n mutation MyMutation($total_notification: Int!, $total_notification_important: Int!, $user_id: Int!, $hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $action: String!, $student_code: String = null) {\n insert_feature_mobile_push_count_notification_unread(objects: {app: $app, created_at: \"now\", hostname: $hostname, module_code: $module_code, total_notification: $total_notification, total_notification_important: $total_notification_important, user_id: $user_id, device_id: $device_id, action: $action, student_code: $student_code}) {\n returning {\n total_notification_important\n total_notification\n module_code\n }\n }\n }\n";
6
6
  export declare const MUTATION_UPDATE_READ_NOTIFICATION_IN_DETAIL_FORM: string;
@@ -37,13 +37,14 @@ exports.QUERY_GET_LIST_NOTIFICATION_BY_ACTION = (0, graphql_request_1.gql) `
37
37
  }
38
38
  }
39
39
  `;
40
- exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = (0, graphql_request_1.gql) `
40
+ const QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = (studentCode) => `
41
41
  query MyQuery(
42
42
  $hostname: String!
43
43
  $app: String!
44
44
  $device_id: String!
45
45
  $user_id: Int!
46
46
  $module_code: String!
47
+ $action: String!
47
48
  ) {
48
49
  feature_mobile_push_count_notification_unread(
49
50
  where: {
@@ -53,6 +54,8 @@ exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = (0, graphql_reques
53
54
  device_id: { _eq: $device_id }
54
55
  user_id: { _eq: $user_id }
55
56
  module_code: { _eq: $module_code }
57
+ action: { _eq: $action }
58
+ ${studentCode ? `student_code: {_eq: "${studentCode}"}` : ''}
56
59
  }
57
60
  ) {
58
61
  total_notification
@@ -60,17 +63,20 @@ exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = (0, graphql_reques
60
63
  }
61
64
  }
62
65
  `;
63
- exports.MUTATION_UPDATE_NOTIFICATION_UNREAD = `
64
- mutation MyMutation($hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $user_id: Int!, $total_notification: Int!, $total_notification_important: Int!) {
65
- update_feature_mobile_push_count_notification_unread(where: {deleted_at: {_is_null: true}, hostname: {_eq: $hostname}, module_code: {_eq: $module_code}, app: {_eq: $app}, device_id: {_eq: $device_id}, user_id: {_eq: $user_id}}, _set: {total_notification: $total_notification, total_notification_important: $total_notification_important, updated_at: "now"}) {
66
- returning {
67
- total_notification
68
- total_notification_important
69
- module_code
66
+ exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE;
67
+ const MUTATION_UPDATE_NOTIFICATION_UNREAD = (studentCode) => `
68
+ mutation MyMutation($hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $user_id: Int!, $total_notification: Int!, $total_notification_important: Int!, $action: String!) {
69
+ update_feature_mobile_push_count_notification_unread(where: {deleted_at: {_is_null: true}, hostname: {_eq: $hostname}, module_code: {_eq: $module_code}, app: {_eq: $app}, device_id: {_eq: $device_id}, user_id: {_eq: $user_id}, action: {_eq: $action}, ${studentCode ? `student_code: {_eq: "${studentCode}"}` : ''}}, _set: {total_notification: $total_notification, total_notification_important: $total_notification_important, updated_at: "now"}) {
70
+ returning {
71
+ id
72
+ total_notification
73
+ total_notification_important
74
+ module_code
75
+ }
76
+ }
70
77
  }
71
- }
72
- }
73
78
  `;
79
+ exports.MUTATION_UPDATE_NOTIFICATION_UNREAD = MUTATION_UPDATE_NOTIFICATION_UNREAD;
74
80
  exports.MUTATION_UPDATE_READ_NOTIFICATION = (0, graphql_request_1.gql) `
75
81
  mutation MyMutation($id: Int!) {
76
82
  update_feature_mobile_push(
@@ -80,20 +86,22 @@ exports.MUTATION_UPDATE_READ_NOTIFICATION = (0, graphql_request_1.gql) `
80
86
  returning {
81
87
  type
82
88
  module_code
89
+ action
90
+ payload
83
91
  }
84
92
  }
85
93
  }
86
94
  `;
87
95
  exports.MUTATION_INSERT_NOTIFICATION = `
88
- mutation MyMutation($total_notification: Int!, $total_notification_important: Int!, $user_id: Int!, $hostname: String!, $app: String!, $device_id: String!, $module_code: String!) {
89
- insert_feature_mobile_push_count_notification_unread(objects: {app: $app, created_at: "now", hostname: $hostname, module_code: $module_code, total_notification: $total_notification, total_notification_important: $total_notification_important, user_id: $user_id, device_id: $device_id}) {
90
- returning {
91
- total_notification_important
92
- total_notification
93
- module_code
96
+ mutation MyMutation($total_notification: Int!, $total_notification_important: Int!, $user_id: Int!, $hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $action: String!, $student_code: String = null) {
97
+ insert_feature_mobile_push_count_notification_unread(objects: {app: $app, created_at: "now", hostname: $hostname, module_code: $module_code, total_notification: $total_notification, total_notification_important: $total_notification_important, user_id: $user_id, device_id: $device_id, action: $action, student_code: $student_code}) {
98
+ returning {
99
+ total_notification_important
100
+ total_notification
101
+ module_code
102
+ }
103
+ }
94
104
  }
95
- }
96
- }
97
105
  `;
98
106
  exports.MUTATION_UPDATE_READ_NOTIFICATION_IN_DETAIL_FORM = (0, graphql_request_1.gql) `
99
107
  mutation MyMutation($app: String!, $device_id: String!, $user_id: Int!, $hostname: String!, $action: String!, $form_id: Int!) {
@@ -101,6 +109,8 @@ exports.MUTATION_UPDATE_READ_NOTIFICATION_IN_DETAIL_FORM = (0, graphql_request_1
101
109
  returning {
102
110
  type
103
111
  module_code
112
+ payload
113
+ action
104
114
  }
105
115
  }
106
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/query/notification/query.ts"],"names":[],"mappings":";;;AAAA,qDAAoC;AAEvB,QAAA,qCAAqC,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCvD,CAAC;AAEW,QAAA,mDAAmD,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;CAsBrE,CAAC;AAEW,QAAA,mCAAmC,GAAG;;;;;;;;;;CAUlD,CAAC;AAEW,QAAA,iCAAiC,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;CAYnD,CAAC;AAEW,QAAA,4BAA4B,GAAG;;;;;;;;;;CAU3C,CAAC;AAEW,QAAA,gDAAgD,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;CASlE,CAAC"}
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/query/notification/query.ts"],"names":[],"mappings":";;;AAAA,qDAAoC;AAEvB,QAAA,qCAAqC,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCvD,CAAC;AAEK,MAAM,mDAAmD,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;UAkBlF,WAAW,CAAC,CAAC,CAAC,wBAAwB,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE;;;;;;;CAOnE,CAAC;AAzBW,QAAA,mDAAmD,uDAyB9D;AAEK,MAAM,mCAAmC,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC;;uQAE2L,WAAW,CAAC,CAAC,CAAC,wBAAwB,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE;;;;;;;;;CAShU,CAAC;AAXW,QAAA,mCAAmC,uCAW9C;AAEW,Q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