@neutron.co.id/pendidikan-operation 1.26.31-beta.1 → 1.26.32
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.
- package/build/actions/akademik/updateReportStudent/updateReportStudent.action.cjs +0 -3
- package/build/actions/akademik/updateReportStudent/updateReportStudent.action.d.ts +4 -4
- package/build/actions/akademik/updateReportStudent/updateReportStudent.action.mjs +0 -3
- package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.cjs +4 -4
- package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.d.ts +12 -12
- package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.mjs +4 -4
- package/build/index.d.ts +4 -4
- package/build/providers/data/useImportData.cjs +15 -0
- package/build/providers/data/useImportData.mjs +15 -0
- package/package.json +6 -6
|
@@ -14,7 +14,6 @@ const updateReportStudent = operation.Action.define({
|
|
|
14
14
|
execute: async (input, stream) => {
|
|
15
15
|
utils.guard(stream, "streamRequired");
|
|
16
16
|
utils.guard(input, "inputRequired");
|
|
17
|
-
console.log("masuk");
|
|
18
17
|
return useTelemetry.useTelemetry(stream, "updateStudentReport", {
|
|
19
18
|
userId: stream.context.identitas.userId,
|
|
20
19
|
...input
|
|
@@ -23,8 +22,6 @@ const updateReportStudent = operation.Action.define({
|
|
|
23
22
|
const data = validate(input);
|
|
24
23
|
const dbs = stream.core.dbs;
|
|
25
24
|
const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
|
|
26
|
-
console.log("data", data);
|
|
27
|
-
console.log("dbStudent", dbStudent);
|
|
28
25
|
await dbStudent.findOneAndUpdate(
|
|
29
26
|
{ _id: data.studentId },
|
|
30
27
|
{
|
|
@@ -8,9 +8,9 @@ export interface UpdateReportStudentOutput {
|
|
|
8
8
|
export interface UpdateReportStudentMeta {
|
|
9
9
|
}
|
|
10
10
|
export declare const updateReportStudent: Action<"updateReportStudent", {
|
|
11
|
-
reportBranchId
|
|
12
|
-
reportType
|
|
13
|
-
studentClassGroupId
|
|
14
|
-
studentId
|
|
11
|
+
reportBranchId: string;
|
|
12
|
+
reportType: number[];
|
|
13
|
+
studentClassGroupId: string;
|
|
14
|
+
studentId: string;
|
|
15
15
|
}, UpdateReportStudentOutput, UpdateReportStudentMeta>;
|
|
16
16
|
export type UpdateReportStudentAction = typeof updateReportStudent;
|
|
@@ -12,7 +12,6 @@ const updateReportStudent = Action.define({
|
|
|
12
12
|
execute: async (input, stream) => {
|
|
13
13
|
guard(stream, "streamRequired");
|
|
14
14
|
guard(input, "inputRequired");
|
|
15
|
-
console.log("masuk");
|
|
16
15
|
return useTelemetry(stream, "updateStudentReport", {
|
|
17
16
|
userId: stream.context.identitas.userId,
|
|
18
17
|
...input
|
|
@@ -21,8 +20,6 @@ const updateReportStudent = Action.define({
|
|
|
21
20
|
const data = validate(input);
|
|
22
21
|
const dbs = stream.core.dbs;
|
|
23
22
|
const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
|
|
24
|
-
console.log("data", data);
|
|
25
|
-
console.log("dbStudent", dbStudent);
|
|
26
23
|
await dbStudent.findOneAndUpdate(
|
|
27
24
|
{ _id: data.studentId },
|
|
28
25
|
{
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
const z = require('@neon.id/z');
|
|
4
4
|
|
|
5
5
|
const UpdateReportStudentSchema = z.z.object({
|
|
6
|
-
reportBranchId: z.z.string().
|
|
7
|
-
studentClassGroupId: z.z.string().
|
|
8
|
-
studentId: z.z.string().
|
|
9
|
-
reportType: z.z.array(z.z.number()).
|
|
6
|
+
reportBranchId: z.z.string().explain({ label: "Report Student ID" }),
|
|
7
|
+
studentClassGroupId: z.z.string().explain({ label: "Student Class Group ID" }),
|
|
8
|
+
studentId: z.z.string().explain({ label: "Student ID" }),
|
|
9
|
+
reportType: z.z.array(z.z.number()).explain({ label: "Report Type" })
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
exports.UpdateReportStudentSchema = UpdateReportStudentSchema;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { z } from '@neon.id/z';
|
|
2
2
|
export declare const UpdateReportStudentSchema: z.ZodObject<{
|
|
3
|
-
reportBranchId: z.
|
|
4
|
-
studentClassGroupId: z.
|
|
5
|
-
studentId: z.
|
|
6
|
-
reportType: z.
|
|
3
|
+
reportBranchId: z.ZodString;
|
|
4
|
+
studentClassGroupId: z.ZodString;
|
|
5
|
+
studentId: z.ZodString;
|
|
6
|
+
reportType: z.ZodArray<z.ZodNumber, "many">;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
reportBranchId
|
|
9
|
-
reportType
|
|
10
|
-
studentClassGroupId
|
|
11
|
-
studentId
|
|
8
|
+
reportBranchId: string;
|
|
9
|
+
reportType: number[];
|
|
10
|
+
studentClassGroupId: string;
|
|
11
|
+
studentId: string;
|
|
12
12
|
}, {
|
|
13
|
-
reportBranchId
|
|
14
|
-
reportType
|
|
15
|
-
studentClassGroupId
|
|
16
|
-
studentId
|
|
13
|
+
reportBranchId: string;
|
|
14
|
+
reportType: number[];
|
|
15
|
+
studentClassGroupId: string;
|
|
16
|
+
studentId: string;
|
|
17
17
|
}>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from '@neon.id/z';
|
|
2
2
|
|
|
3
3
|
const UpdateReportStudentSchema = z.object({
|
|
4
|
-
reportBranchId: z.string().
|
|
5
|
-
studentClassGroupId: z.string().
|
|
6
|
-
studentId: z.string().
|
|
7
|
-
reportType: z.array(z.number()).
|
|
4
|
+
reportBranchId: z.string().explain({ label: "Report Student ID" }),
|
|
5
|
+
studentClassGroupId: z.string().explain({ label: "Student Class Group ID" }),
|
|
6
|
+
studentId: z.string().explain({ label: "Student ID" }),
|
|
7
|
+
reportType: z.array(z.number()).explain({ label: "Report Type" })
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
export { UpdateReportStudentSchema };
|
package/build/index.d.ts
CHANGED
|
@@ -91,10 +91,10 @@ export declare const actions: {
|
|
|
91
91
|
csvData?: any[] | undefined;
|
|
92
92
|
}, import("./actions").ImportDataOutput, import("./actions").ImportDataMeta>;
|
|
93
93
|
updateReportStudent: import("@neon.id/operation").Action<"updateReportStudent", {
|
|
94
|
-
reportBranchId
|
|
95
|
-
reportType
|
|
96
|
-
studentClassGroupId
|
|
97
|
-
studentId
|
|
94
|
+
reportBranchId: string;
|
|
95
|
+
reportType: number[];
|
|
96
|
+
studentClassGroupId: string;
|
|
97
|
+
studentId: string;
|
|
98
98
|
}, import("./actions").UpdateReportStudentOutput, import("./actions").UpdateReportStudentMeta>;
|
|
99
99
|
syncClassGroups: import("@neon.id/operation").Action<"syncClassGroups", {
|
|
100
100
|
endedAt?: string | undefined;
|
|
@@ -9,9 +9,24 @@ function useImportData(stream) {
|
|
|
9
9
|
utils.guard(stream, "streamRequired");
|
|
10
10
|
async function prepareGradingMapper(stream2, input) {
|
|
11
11
|
utils.guard(stream2, "streamRequired");
|
|
12
|
+
const allStudentsFound = await validateAllGradingsHaveStudent(stream2, input.datas);
|
|
13
|
+
if (!allStudentsFound) {
|
|
14
|
+
throw new Error("Import failed: Some gradings do not match any student.");
|
|
15
|
+
}
|
|
12
16
|
void queueArrayInChunks(stream2, input.datas, 100, processBatch);
|
|
13
17
|
return { status: "CSV has being processed" };
|
|
14
18
|
}
|
|
19
|
+
async function validateAllGradingsHaveStudent(stream2, gradings) {
|
|
20
|
+
const studentMap = await findStudentsByIdsAndNis(stream2, gradings);
|
|
21
|
+
for (const grading of gradings) {
|
|
22
|
+
const found = studentMap.get(grading.userId) || studentMap.get(grading.nis) || studentMap.get(grading.stageId) || studentMap.get(grading.branchId);
|
|
23
|
+
if (!found) {
|
|
24
|
+
console.warn(`\u274C Student not found for grading: ${JSON.stringify(grading.userId)}`);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
15
30
|
async function _gradingMapper(stream2, input) {
|
|
16
31
|
const operations = [];
|
|
17
32
|
const validGradings = input.gradings.filter((grading) => grading?.userId);
|
|
@@ -7,9 +7,24 @@ function useImportData(stream) {
|
|
|
7
7
|
guard(stream, "streamRequired");
|
|
8
8
|
async function prepareGradingMapper(stream2, input) {
|
|
9
9
|
guard(stream2, "streamRequired");
|
|
10
|
+
const allStudentsFound = await validateAllGradingsHaveStudent(stream2, input.datas);
|
|
11
|
+
if (!allStudentsFound) {
|
|
12
|
+
throw new Error("Import failed: Some gradings do not match any student.");
|
|
13
|
+
}
|
|
10
14
|
void queueArrayInChunks(stream2, input.datas, 100, processBatch);
|
|
11
15
|
return { status: "CSV has being processed" };
|
|
12
16
|
}
|
|
17
|
+
async function validateAllGradingsHaveStudent(stream2, gradings) {
|
|
18
|
+
const studentMap = await findStudentsByIdsAndNis(stream2, gradings);
|
|
19
|
+
for (const grading of gradings) {
|
|
20
|
+
const found = studentMap.get(grading.userId) || studentMap.get(grading.nis) || studentMap.get(grading.stageId) || studentMap.get(grading.branchId);
|
|
21
|
+
if (!found) {
|
|
22
|
+
console.warn(`\u274C Student not found for grading: ${JSON.stringify(grading.userId)}`);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
13
28
|
async function _gradingMapper(stream2, input) {
|
|
14
29
|
const operations = [];
|
|
15
30
|
const validGradings = input.gradings.filter((grading) => grading?.userId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neutron.co.id/pendidikan-operation",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.32",
|
|
4
4
|
"description": "Operation package of Neutron Pendidikan.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"contributors": [
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@neon.id/types": "^1.69.0",
|
|
40
40
|
"@neon.id/utils": "^1.52.0",
|
|
41
41
|
"@neon.id/z": "^1.16.0",
|
|
42
|
-
"@neutron.co.id/akademik-models": "^1.20.1
|
|
42
|
+
"@neutron.co.id/akademik-models": "^1.20.1",
|
|
43
43
|
"@neutron.co.id/jadwal-models": "^1.19.11",
|
|
44
|
-
"@neutron.co.id/pendidikan-types": "^1.22.23
|
|
44
|
+
"@neutron.co.id/pendidikan-types": "^1.22.23",
|
|
45
45
|
"@neutron.co.id/penilaian-models": "^1.17.8",
|
|
46
46
|
"@neutron.co.id/personalia-models": "^1.11.6",
|
|
47
47
|
"@neutron.co.id/tanya-models": "^1.13.4",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"@neon.id/types": "^1.69.0",
|
|
76
76
|
"@neon.id/utils": "^1.52.0",
|
|
77
77
|
"@neon.id/z": "^1.16.0",
|
|
78
|
-
"@neutron.co.id/akademik-models": "^1.20.1
|
|
78
|
+
"@neutron.co.id/akademik-models": "^1.20.1",
|
|
79
79
|
"@neutron.co.id/jadwal-models": "^1.19.11",
|
|
80
|
-
"@neutron.co.id/pendidikan-types": "^1.22.23
|
|
80
|
+
"@neutron.co.id/pendidikan-types": "^1.22.23",
|
|
81
81
|
"@neutron.co.id/penilaian-models": "^1.17.8",
|
|
82
82
|
"@neutron.co.id/personalia-models": "^1.11.6",
|
|
83
83
|
"@neutron.co.id/tanya-models": "^1.13.4",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"build":
|
|
89
|
+
"build": 123
|
|
90
90
|
}
|