@neutron.co.id/pendidikan-operation 1.27.29 → 1.29.2

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.
@@ -173,8 +173,11 @@ const sendScoreNotification = operation.Action.define({
173
173
  // parentName: parent.user?.name || 'Parent',
174
174
  studentName: gradingData.student?.user?.name || "Student",
175
175
  gradingType: gradingData.gradingType?.name || "Grading"
176
- // academicPeriod: gradingData.gradingType?.academicPeriod?.name || 'Period',
177
176
  // branch: gradingData.branch?.name || 'Branch',
177
+ // studentId: String(gradingData.studentId),
178
+ // groupId: String(gradingData.studentId),
179
+ // gradingTypeId: gradingData.gradingType?.id || 'Grading ID',
180
+ // academicPeriod: gradingData.gradingType?.academicPeriod?.name || 'Period',
178
181
  // reportedAt: DateUtil.formatTz(gradingData.reportedAt, { pattern: 'yyyy-MM-dd' }),
179
182
  // scoreCount: scoresList.length,
180
183
  // scoreSummary: JSON.stringify(scoreSummary),
@@ -183,7 +186,9 @@ const sendScoreNotification = operation.Action.define({
183
186
  overrides: {
184
187
  fcm: {
185
188
  data: {
186
- userId: String(gradingData.student.userId),
189
+ userId: String(parentUserId),
190
+ studentId: String(gradingData.student.id),
191
+ gradingTypeId: String(gradingData.gradingType?.id),
187
192
  moduleType: "score-published-parent",
188
193
  moduleId: String(input?.gradingId),
189
194
  url: `${config?.appFluffyUrl}/rapor/grading-${input?.gradingId}`
@@ -195,9 +200,11 @@ const sendScoreNotification = operation.Action.define({
195
200
  await stream?.actions.data.createOne.execute({
196
201
  model: "neu:data:notification",
197
202
  data: {
198
- userId: gradingData.student.userId,
203
+ userId: parentUserId,
199
204
  moduleType: "score-published-parent",
200
205
  moduleId: input?.gradingId,
206
+ studentId: gradingData.student.id,
207
+ gradingTypeId: gradingData.gradingType?.id,
201
208
  messageData: {
202
209
  id: input?.gradingId,
203
210
  message: `Hai, ada penilaian baru untuk ${gradingData.student?.user?.name} dengan penilaian ${gradingData.gradingType?.name}! Yuk, lihat perkembangannya di Rekam Belajar.`
@@ -171,8 +171,11 @@ const sendScoreNotification = Action.define({
171
171
  // parentName: parent.user?.name || 'Parent',
172
172
  studentName: gradingData.student?.user?.name || "Student",
173
173
  gradingType: gradingData.gradingType?.name || "Grading"
174
- // academicPeriod: gradingData.gradingType?.academicPeriod?.name || 'Period',
175
174
  // branch: gradingData.branch?.name || 'Branch',
175
+ // studentId: String(gradingData.studentId),
176
+ // groupId: String(gradingData.studentId),
177
+ // gradingTypeId: gradingData.gradingType?.id || 'Grading ID',
178
+ // academicPeriod: gradingData.gradingType?.academicPeriod?.name || 'Period',
176
179
  // reportedAt: DateUtil.formatTz(gradingData.reportedAt, { pattern: 'yyyy-MM-dd' }),
177
180
  // scoreCount: scoresList.length,
178
181
  // scoreSummary: JSON.stringify(scoreSummary),
@@ -181,7 +184,9 @@ const sendScoreNotification = Action.define({
181
184
  overrides: {
182
185
  fcm: {
183
186
  data: {
184
- userId: String(gradingData.student.userId),
187
+ userId: String(parentUserId),
188
+ studentId: String(gradingData.student.id),
189
+ gradingTypeId: String(gradingData.gradingType?.id),
185
190
  moduleType: "score-published-parent",
186
191
  moduleId: String(input?.gradingId),
187
192
  url: `${config?.appFluffyUrl}/rapor/grading-${input?.gradingId}`
@@ -193,9 +198,11 @@ const sendScoreNotification = Action.define({
193
198
  await stream?.actions.data.createOne.execute({
194
199
  model: "neu:data:notification",
195
200
  data: {
196
- userId: gradingData.student.userId,
201
+ userId: parentUserId,
197
202
  moduleType: "score-published-parent",
198
203
  moduleId: input?.gradingId,
204
+ studentId: gradingData.student.id,
205
+ gradingTypeId: gradingData.gradingType?.id,
199
206
  messageData: {
200
207
  id: input?.gradingId,
201
208
  message: `Hai, ada penilaian baru untuk ${gradingData.student?.user?.name} dengan penilaian ${gradingData.gradingType?.name}! Yuk, lihat perkembangannya di Rekam Belajar.`
@@ -67,6 +67,7 @@ function useImportData(stream) {
67
67
  document: {
68
68
  branchId: Array.isArray(student?.branchIds) && student.branchIds[0] ? new core.ObjectId(student.branchIds[0]) : null,
69
69
  studentId: student?.id ? new core.ObjectId(student.id) : null,
70
+ branchIds: student.branchIds || [],
70
71
  stageId: student?.stageId ? new core.ObjectId(student.stageId) : null,
71
72
  reportedAt: /* @__PURE__ */ new Date(),
72
73
  createdAt: /* @__PURE__ */ new Date(),
@@ -65,6 +65,7 @@ function useImportData(stream) {
65
65
  document: {
66
66
  branchId: Array.isArray(student?.branchIds) && student.branchIds[0] ? new ObjectId(student.branchIds[0]) : null,
67
67
  studentId: student?.id ? new ObjectId(student.id) : null,
68
+ branchIds: student.branchIds || [],
68
69
  stageId: student?.stageId ? new ObjectId(student.stageId) : null,
69
70
  reportedAt: /* @__PURE__ */ new Date(),
70
71
  createdAt: /* @__PURE__ */ new Date(),
@@ -12,6 +12,7 @@ function usePenilaian(stream) {
12
12
  utils.guard(input.gradingId, "gradingIdRequired");
13
13
  const grading = await _getOneGrading(stream2, input);
14
14
  await prepareScoreComponentMapper(stream2, grading);
15
+ await updateOneGrading(stream2, grading);
15
16
  }
16
17
  async function prepareManyGradingScore(stream2, input) {
17
18
  utils.guard(stream2, "streamRequired");
@@ -26,6 +27,7 @@ function usePenilaian(stream) {
26
27
  }
27
28
  async function prepareScoreComponentMapper(stream2, grading) {
28
29
  utils.guard(stream2, "streamRequired");
30
+ console.log("grading: ", grading);
29
31
  const parsedScores = Object.fromEntries(
30
32
  Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
31
33
  const normalizedValue = Number.parseFloat(String(value).replace(",", "."));
@@ -40,14 +42,30 @@ function usePenilaian(stream) {
40
42
  }));
41
43
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
42
44
  }
45
+ async function updateOneGrading(stream2, grading) {
46
+ utils.guard(stream2, "streamRequired");
47
+ await stream2?.actions.data.updateOne.execute(
48
+ {
49
+ model: "neu:penilaian:grading",
50
+ id: grading.id || "",
51
+ data: {
52
+ branchIds: grading.student?.branchIds,
53
+ refreshAmount: (grading.refreshAmount || 0) + 1
54
+ }
55
+ },
56
+ stream2
57
+ );
58
+ }
43
59
  async function updateManyGradings(stream2, gradings) {
44
60
  utils.guard(stream2, "streamRequired");
45
61
  for (const grading of gradings) {
62
+ console.log("grading branches: ", grading.student?.branchIds);
46
63
  await stream2?.actions.data.updateOne.execute(
47
64
  {
48
65
  model: "neu:penilaian:grading",
49
66
  id: grading.id || "",
50
67
  data: {
68
+ branchIds: grading.student?.branchIds,
51
69
  refreshAmount: (grading.refreshAmount || 0) + 1
52
70
  }
53
71
  },
@@ -65,6 +83,9 @@ function usePenilaian(stream) {
65
83
  id: 1,
66
84
  data: 1,
67
85
  gradingTypeId: 1,
86
+ student: {
87
+ branchIds: 1
88
+ },
68
89
  branchId: 1
69
90
  }
70
91
  })
@@ -85,6 +106,9 @@ function usePenilaian(stream) {
85
106
  createdAt: 1,
86
107
  data: 1,
87
108
  gradingTypeId: 1,
109
+ student: {
110
+ branchIds: 1
111
+ },
88
112
  refreshAmount: 1,
89
113
  branchId: 1
90
114
  }
@@ -10,6 +10,7 @@ function usePenilaian(stream) {
10
10
  guard(input.gradingId, "gradingIdRequired");
11
11
  const grading = await _getOneGrading(stream2, input);
12
12
  await prepareScoreComponentMapper(stream2, grading);
13
+ await updateOneGrading(stream2, grading);
13
14
  }
14
15
  async function prepareManyGradingScore(stream2, input) {
15
16
  guard(stream2, "streamRequired");
@@ -24,6 +25,7 @@ function usePenilaian(stream) {
24
25
  }
25
26
  async function prepareScoreComponentMapper(stream2, grading) {
26
27
  guard(stream2, "streamRequired");
28
+ console.log("grading: ", grading);
27
29
  const parsedScores = Object.fromEntries(
28
30
  Object.entries(grading?.data?.import?.scores).map(([key, value]) => {
29
31
  const normalizedValue = Number.parseFloat(String(value).replace(",", "."));
@@ -38,14 +40,30 @@ function usePenilaian(stream) {
38
40
  }));
39
41
  await _generateScoreComponentMapper(stream2, gradingComponentMap, grading);
40
42
  }
43
+ async function updateOneGrading(stream2, grading) {
44
+ guard(stream2, "streamRequired");
45
+ await stream2?.actions.data.updateOne.execute(
46
+ {
47
+ model: "neu:penilaian:grading",
48
+ id: grading.id || "",
49
+ data: {
50
+ branchIds: grading.student?.branchIds,
51
+ refreshAmount: (grading.refreshAmount || 0) + 1
52
+ }
53
+ },
54
+ stream2
55
+ );
56
+ }
41
57
  async function updateManyGradings(stream2, gradings) {
42
58
  guard(stream2, "streamRequired");
43
59
  for (const grading of gradings) {
60
+ console.log("grading branches: ", grading.student?.branchIds);
44
61
  await stream2?.actions.data.updateOne.execute(
45
62
  {
46
63
  model: "neu:penilaian:grading",
47
64
  id: grading.id || "",
48
65
  data: {
66
+ branchIds: grading.student?.branchIds,
49
67
  refreshAmount: (grading.refreshAmount || 0) + 1
50
68
  }
51
69
  },
@@ -63,6 +81,9 @@ function usePenilaian(stream) {
63
81
  id: 1,
64
82
  data: 1,
65
83
  gradingTypeId: 1,
84
+ student: {
85
+ branchIds: 1
86
+ },
66
87
  branchId: 1
67
88
  }
68
89
  })
@@ -83,6 +104,9 @@ function usePenilaian(stream) {
83
104
  createdAt: 1,
84
105
  data: 1,
85
106
  gradingTypeId: 1,
107
+ student: {
108
+ branchIds: 1
109
+ },
86
110
  refreshAmount: 1,
87
111
  branchId: 1
88
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/pendidikan-operation",
3
- "version": "1.27.29",
3
+ "version": "1.29.2",
4
4
  "description": "Operation package of Neutron Pendidikan.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "contributors": [
@@ -41,15 +41,15 @@
41
41
  "@neon.id/z": "^1.16.0",
42
42
  "@neutron.co.id/akademik-models": "^1.21.5-beta.1",
43
43
  "@neutron.co.id/jadwal-models": "^1.19.13",
44
- "@neutron.co.id/pendidikan-types": "^1.23.3",
45
- "@neutron.co.id/penilaian-models": "^1.17.8",
44
+ "@neutron.co.id/pendidikan-types": "^1.24.1",
45
+ "@neutron.co.id/penilaian-models": "^1.19.0",
46
46
  "@neutron.co.id/personalia-models": "^1.11.6",
47
47
  "@neutron.co.id/tanya-models": "^1.13.4",
48
48
  "@sentry/node": "8.19.0",
49
49
  "node-cron": "^4.1.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@neon.id/cli": "0.23.0",
52
+ "@neon.co.id/cli": "0.1.0",
53
53
  "@neon.id/eslint": "0.3.0",
54
54
  "@neon.id/mock": "1.3.0",
55
55
  "@types/eslint": "9.6.0",
@@ -77,8 +77,8 @@
77
77
  "@neon.id/z": "^1.16.0",
78
78
  "@neutron.co.id/akademik-models": "^1.21.5-beta.1",
79
79
  "@neutron.co.id/jadwal-models": "^1.19.13",
80
- "@neutron.co.id/pendidikan-types": "^1.23.3",
81
- "@neutron.co.id/penilaian-models": "^1.17.8",
80
+ "@neutron.co.id/pendidikan-types": "^1.24.1",
81
+ "@neutron.co.id/penilaian-models": "^1.19.0",
82
82
  "@neutron.co.id/personalia-models": "^1.11.6",
83
83
  "@neutron.co.id/tanya-models": "^1.13.4",
84
84
  "@sentry/node": "8.19.0"
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "build": 154
89
+ "build": 158
90
90
  }