@neutron.co.id/pendidikan-operation 1.26.29 → 1.26.31-beta.1

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.
Files changed (34) hide show
  1. package/build/actions/akademik/index.d.ts +1 -0
  2. package/build/actions/akademik/studentReport/syncStudentReport.action.cjs +39 -15
  3. package/build/actions/akademik/studentReport/syncStudentReport.action.d.ts +1 -0
  4. package/build/actions/akademik/studentReport/syncStudentReport.action.mjs +39 -15
  5. package/build/actions/akademik/studentReport/syncStudentReport.schema.cjs +1 -0
  6. package/build/actions/akademik/studentReport/syncStudentReport.schema.d.ts +3 -0
  7. package/build/actions/akademik/studentReport/syncStudentReport.schema.mjs +1 -0
  8. package/build/actions/akademik/updateReportStudent/index.d.ts +2 -0
  9. package/build/actions/akademik/updateReportStudent/updateReportStudent.action.cjs +47 -0
  10. package/build/actions/akademik/updateReportStudent/updateReportStudent.action.d.ts +16 -0
  11. package/build/actions/akademik/updateReportStudent/updateReportStudent.action.mjs +45 -0
  12. package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.cjs +12 -0
  13. package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.d.ts +17 -0
  14. package/build/actions/akademik/updateReportStudent/updateReportStudent.schema.mjs +10 -0
  15. package/build/actions/jadwal/index.d.ts +1 -0
  16. package/build/actions/jadwal/syncClassGroups/index.d.ts +2 -0
  17. package/build/actions/jadwal/syncClassGroups/syncClassGroups.action.cjs +53 -0
  18. package/build/actions/jadwal/syncClassGroups/syncClassGroups.action.d.ts +13 -0
  19. package/build/actions/jadwal/syncClassGroups/syncClassGroups.action.mjs +51 -0
  20. package/build/actions/jadwal/syncClassGroups/syncClassGroups.schema.cjs +10 -0
  21. package/build/actions/jadwal/syncClassGroups/syncClassGroups.schema.d.ts +11 -0
  22. package/build/actions/jadwal/syncClassGroups/syncClassGroups.schema.mjs +8 -0
  23. package/build/actions/jadwal/syncClassSessions/syncClassSessions.action.cjs +7 -3
  24. package/build/actions/jadwal/syncClassSessions/syncClassSessions.action.d.ts +1 -0
  25. package/build/actions/jadwal/syncClassSessions/syncClassSessions.action.mjs +7 -3
  26. package/build/actions/jadwal/syncClassSessions/syncClassSessions.schema.cjs +2 -1
  27. package/build/actions/jadwal/syncClassSessions/syncClassSessions.schema.d.ts +3 -0
  28. package/build/actions/jadwal/syncClassSessions/syncClassSessions.schema.mjs +2 -1
  29. package/build/actions/tanya/action.reminderQuestions.cjs +1 -0
  30. package/build/actions/tanya/action.reminderQuestions.mjs +1 -0
  31. package/build/index.cjs +13 -1
  32. package/build/index.d.ts +12 -0
  33. package/build/index.mjs +10 -2
  34. package/package.json +6 -6
@@ -10,3 +10,4 @@ export * from './action.getStudentPoint';
10
10
  export * from './action.getTeacherPoint';
11
11
  export * from './action.getStaffPoint';
12
12
  export * from './studentReport';
13
+ export * from './updateReportStudent';
@@ -15,9 +15,15 @@ const syncStudentReport = operation.Action.define({
15
15
  utils.guard(stream, "streamRequired");
16
16
  utils.guard(input, "inputRequired");
17
17
  return useTelemetry.useTelemetry(stream, "syncStudentReport", { userId: stream.context.identitas.userId, ...input }, async () => {
18
+ const sessionIds = [];
19
+ const actions = stream.actions.data;
20
+ if (input.groupId !== null) {
21
+ const dbSession = stream.core.dbs["neu-jadwal"].models["neu:jadwal:classGroup"];
22
+ const findSession = await dbSession.find({ groupIds: { $in: [input.groupId] } }).select(["_id"]);
23
+ sessionIds.push(findSession);
24
+ }
18
25
  const dbs = stream.core.dbs;
19
26
  const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
20
- const dbAttendance = dbs["neu-jadwal"].models["neu:jadwal:classAttendance"];
21
27
  const dbConsultation = dbs["neu-jadwal"].models["neu:jadwal:classConsultation"];
22
28
  const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
23
29
  const dbCheckIn = dbs["neu-tempat"].models["neu:tempat:checkIn"];
@@ -51,19 +57,35 @@ const syncStudentReport = operation.Action.define({
51
57
  }
52
58
  );
53
59
  }
54
- const resultAttendance = await dbAttendance.find({
55
- studentId: input.studentId,
56
- presenceAt: {
57
- $gte: input.startedAt,
58
- $lte: input.endedAt
60
+ const dataAttendance = await actions.getMany.execute(
61
+ {
62
+ model: "neu:jadwal:classAttendance",
63
+ query: query.Query.define({
64
+ fields: {
65
+ id: 1,
66
+ presenceAt: 1,
67
+ sessionType: 1
68
+ },
69
+ filter: {
70
+ studentId: input.studentId,
71
+ presenceAt: {
72
+ $gte: input.startedAt,
73
+ $lte: input.endedAt
74
+ },
75
+ deletedAt: { $exists: false },
76
+ ...input.groupId && { classSessionBranchIds: { $in: input.branchIds } }
77
+ },
78
+ sort: { createdAt: -1 }
79
+ })
59
80
  },
60
- deletedAt: { $exists: false }
61
- }).sort({ createdAt: -1 });
62
- const attendanceCount = resultAttendance.length;
63
- const attendanceOffline = resultAttendance.filter((field) => field?.sessionType === "offline");
64
- const totalAttendanceOffline = attendanceOffline.length;
65
- const attendanceOnline = resultAttendance.filter((field) => field?.sessionType === "online");
66
- const totalAttendanceOnline = attendanceOnline.length;
81
+ stream
82
+ );
83
+ const resultAttendance = dataAttendance.payload.data || [];
84
+ const attendanceCount = resultAttendance?.length;
85
+ const attendanceOffline = resultAttendance?.filter((field) => field?.sessionType === "offline");
86
+ const totalAttendanceOffline = attendanceOffline?.length;
87
+ const attendanceOnline = resultAttendance?.filter((field) => field?.sessionType === "online");
88
+ const totalAttendanceOnline = attendanceOnline?.length;
67
89
  if (resultAttendance.length > 0) {
68
90
  await dbStudent.updateOne(
69
91
  { _id: input.studentId },
@@ -122,7 +144,8 @@ const syncStudentReport = operation.Action.define({
122
144
  $gte: input.startedAt,
123
145
  $lte: input.endedAt
124
146
  },
125
- deletedAt: { $exists: false }
147
+ deletedAt: { $exists: false },
148
+ ...input.groupId && { branchIds: { $in: input.branchIds } }
126
149
  });
127
150
  const consultationCount = resultConsultation.length;
128
151
  if (resultConsultation.length > 0) {
@@ -277,7 +300,8 @@ const syncStudentReport = operation.Action.define({
277
300
  createdAt: {
278
301
  $gte: input.startedAt,
279
302
  $lte: input.endedAt
280
- }
303
+ },
304
+ ...input.groupId && { classSessionId: { $in: sessionIds } }
281
305
  },
282
306
  fields: {
283
307
  id: 1,
@@ -12,5 +12,6 @@ export declare const syncStudentReport: Action<"syncStudentReport", {
12
12
  endedAt?: string | undefined;
13
13
  startedAt?: string | undefined;
14
14
  studentId?: string | undefined;
15
+ groupId?: string | undefined;
15
16
  }, SyncStudentReportOutput, SyncStudentReportMeta>;
16
17
  export type SyncStudentReportAction = typeof syncStudentReport;
@@ -13,9 +13,15 @@ const syncStudentReport = Action.define({
13
13
  guard(stream, "streamRequired");
14
14
  guard(input, "inputRequired");
15
15
  return useTelemetry(stream, "syncStudentReport", { userId: stream.context.identitas.userId, ...input }, async () => {
16
+ const sessionIds = [];
17
+ const actions = stream.actions.data;
18
+ if (input.groupId !== null) {
19
+ const dbSession = stream.core.dbs["neu-jadwal"].models["neu:jadwal:classGroup"];
20
+ const findSession = await dbSession.find({ groupIds: { $in: [input.groupId] } }).select(["_id"]);
21
+ sessionIds.push(findSession);
22
+ }
16
23
  const dbs = stream.core.dbs;
17
24
  const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
18
- const dbAttendance = dbs["neu-jadwal"].models["neu:jadwal:classAttendance"];
19
25
  const dbConsultation = dbs["neu-jadwal"].models["neu:jadwal:classConsultation"];
20
26
  const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
21
27
  const dbCheckIn = dbs["neu-tempat"].models["neu:tempat:checkIn"];
@@ -49,19 +55,35 @@ const syncStudentReport = Action.define({
49
55
  }
50
56
  );
51
57
  }
52
- const resultAttendance = await dbAttendance.find({
53
- studentId: input.studentId,
54
- presenceAt: {
55
- $gte: input.startedAt,
56
- $lte: input.endedAt
58
+ const dataAttendance = await actions.getMany.execute(
59
+ {
60
+ model: "neu:jadwal:classAttendance",
61
+ query: Query.define({
62
+ fields: {
63
+ id: 1,
64
+ presenceAt: 1,
65
+ sessionType: 1
66
+ },
67
+ filter: {
68
+ studentId: input.studentId,
69
+ presenceAt: {
70
+ $gte: input.startedAt,
71
+ $lte: input.endedAt
72
+ },
73
+ deletedAt: { $exists: false },
74
+ ...input.groupId && { classSessionBranchIds: { $in: input.branchIds } }
75
+ },
76
+ sort: { createdAt: -1 }
77
+ })
57
78
  },
58
- deletedAt: { $exists: false }
59
- }).sort({ createdAt: -1 });
60
- const attendanceCount = resultAttendance.length;
61
- const attendanceOffline = resultAttendance.filter((field) => field?.sessionType === "offline");
62
- const totalAttendanceOffline = attendanceOffline.length;
63
- const attendanceOnline = resultAttendance.filter((field) => field?.sessionType === "online");
64
- const totalAttendanceOnline = attendanceOnline.length;
79
+ stream
80
+ );
81
+ const resultAttendance = dataAttendance.payload.data || [];
82
+ const attendanceCount = resultAttendance?.length;
83
+ const attendanceOffline = resultAttendance?.filter((field) => field?.sessionType === "offline");
84
+ const totalAttendanceOffline = attendanceOffline?.length;
85
+ const attendanceOnline = resultAttendance?.filter((field) => field?.sessionType === "online");
86
+ const totalAttendanceOnline = attendanceOnline?.length;
65
87
  if (resultAttendance.length > 0) {
66
88
  await dbStudent.updateOne(
67
89
  { _id: input.studentId },
@@ -120,7 +142,8 @@ const syncStudentReport = Action.define({
120
142
  $gte: input.startedAt,
121
143
  $lte: input.endedAt
122
144
  },
123
- deletedAt: { $exists: false }
145
+ deletedAt: { $exists: false },
146
+ ...input.groupId && { branchIds: { $in: input.branchIds } }
124
147
  });
125
148
  const consultationCount = resultConsultation.length;
126
149
  if (resultConsultation.length > 0) {
@@ -275,7 +298,8 @@ const syncStudentReport = Action.define({
275
298
  createdAt: {
276
299
  $gte: input.startedAt,
277
300
  $lte: input.endedAt
278
- }
301
+ },
302
+ ...input.groupId && { classSessionId: { $in: sessionIds } }
279
303
  },
280
304
  fields: {
281
305
  id: 1,
@@ -7,6 +7,7 @@ const StudentReportSchema = z.z.object({
7
7
  branchIds: z.z.array(z.z.string()).optional().explain({
8
8
  label: "Branch IDs"
9
9
  }),
10
+ groupId: z.z.string().optional().explain({ label: "Group ID" }),
10
11
  startedAt: z.z.string().datetime().optional().explain({ label: "Started At" }),
11
12
  endedAt: z.z.string().datetime().optional().explain({ label: "Ended At" })
12
13
  });
@@ -2,6 +2,7 @@ import { z } from '@neon.id/z';
2
2
  export declare const StudentReportSchema: z.ZodObject<{
3
3
  studentId: z.ZodOptional<z.ZodString>;
4
4
  branchIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
+ groupId: z.ZodOptional<z.ZodString>;
5
6
  startedAt: z.ZodOptional<z.ZodString>;
6
7
  endedAt: z.ZodOptional<z.ZodString>;
7
8
  }, "strip", z.ZodTypeAny, {
@@ -9,9 +10,11 @@ export declare const StudentReportSchema: z.ZodObject<{
9
10
  endedAt?: string | undefined;
10
11
  startedAt?: string | undefined;
11
12
  studentId?: string | undefined;
13
+ groupId?: string | undefined;
12
14
  }, {
13
15
  branchIds?: string[] | undefined;
14
16
  endedAt?: string | undefined;
15
17
  startedAt?: string | undefined;
16
18
  studentId?: string | undefined;
19
+ groupId?: string | undefined;
17
20
  }>;
@@ -5,6 +5,7 @@ const StudentReportSchema = z.object({
5
5
  branchIds: z.array(z.string()).optional().explain({
6
6
  label: "Branch IDs"
7
7
  }),
8
+ groupId: z.string().optional().explain({ label: "Group ID" }),
8
9
  startedAt: z.string().datetime().optional().explain({ label: "Started At" }),
9
10
  endedAt: z.string().datetime().optional().explain({ label: "Ended At" })
10
11
  });
@@ -0,0 +1,2 @@
1
+ export * from './updateReportStudent.action';
2
+ export * from './updateReportStudent.schema';
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ const core = require('@neon.id/core');
4
+ const operation = require('@neon.id/operation');
5
+ const utils = require('@neon.id/utils');
6
+ const updateReportStudent_schema = require('./updateReportStudent.schema.cjs');
7
+ const useTelemetry = require('../../../providers/useTelemetry.cjs');
8
+
9
+ const updateReportStudent = operation.Action.define({
10
+ key: "updateReportStudent",
11
+ name: "Update Report Student",
12
+ type: "command",
13
+ category: "domain",
14
+ execute: async (input, stream) => {
15
+ utils.guard(stream, "streamRequired");
16
+ utils.guard(input, "inputRequired");
17
+ console.log("masuk");
18
+ return useTelemetry.useTelemetry(stream, "updateStudentReport", {
19
+ userId: stream.context.identitas.userId,
20
+ ...input
21
+ }, async () => {
22
+ const { validate } = operation.useValidation(stream, updateReportStudent_schema.UpdateReportStudentSchema);
23
+ const data = validate(input);
24
+ const dbs = stream.core.dbs;
25
+ const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
26
+ console.log("data", data);
27
+ console.log("dbStudent", dbStudent);
28
+ await dbStudent.findOneAndUpdate(
29
+ { _id: data.studentId },
30
+ {
31
+ $set: {
32
+ reportBranchId: data.reportBranchId,
33
+ studentClassGroupId: data.studentClassGroupId,
34
+ reportType: data.reportType
35
+ }
36
+ },
37
+ { upsert: true, new: true, lean: true }
38
+ );
39
+ return core.Result.ok({
40
+ state: "updateStudentReport",
41
+ message: "Student Report Has Been Updated"
42
+ });
43
+ });
44
+ }
45
+ });
46
+
47
+ exports.updateReportStudent = updateReportStudent;
@@ -0,0 +1,16 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { UpdateReportStudentSchema } from './updateReportStudent.schema';
4
+ export type UpdateReportStudentInput = z.parse<typeof UpdateReportStudentSchema>;
5
+ export interface UpdateReportStudentOutput {
6
+ code: number;
7
+ }
8
+ export interface UpdateReportStudentMeta {
9
+ }
10
+ export declare const updateReportStudent: Action<"updateReportStudent", {
11
+ reportBranchId?: string | undefined;
12
+ reportType?: number[] | undefined;
13
+ studentClassGroupId?: string | undefined;
14
+ studentId?: string | undefined;
15
+ }, UpdateReportStudentOutput, UpdateReportStudentMeta>;
16
+ export type UpdateReportStudentAction = typeof updateReportStudent;
@@ -0,0 +1,45 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useValidation } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { UpdateReportStudentSchema } from './updateReportStudent.schema.mjs';
5
+ import { useTelemetry } from '../../../providers/useTelemetry.mjs';
6
+
7
+ const updateReportStudent = Action.define({
8
+ key: "updateReportStudent",
9
+ name: "Update Report Student",
10
+ type: "command",
11
+ category: "domain",
12
+ execute: async (input, stream) => {
13
+ guard(stream, "streamRequired");
14
+ guard(input, "inputRequired");
15
+ console.log("masuk");
16
+ return useTelemetry(stream, "updateStudentReport", {
17
+ userId: stream.context.identitas.userId,
18
+ ...input
19
+ }, async () => {
20
+ const { validate } = useValidation(stream, UpdateReportStudentSchema);
21
+ const data = validate(input);
22
+ const dbs = stream.core.dbs;
23
+ const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
24
+ console.log("data", data);
25
+ console.log("dbStudent", dbStudent);
26
+ await dbStudent.findOneAndUpdate(
27
+ { _id: data.studentId },
28
+ {
29
+ $set: {
30
+ reportBranchId: data.reportBranchId,
31
+ studentClassGroupId: data.studentClassGroupId,
32
+ reportType: data.reportType
33
+ }
34
+ },
35
+ { upsert: true, new: true, lean: true }
36
+ );
37
+ return Result.ok({
38
+ state: "updateStudentReport",
39
+ message: "Student Report Has Been Updated"
40
+ });
41
+ });
42
+ }
43
+ });
44
+
45
+ export { updateReportStudent };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const UpdateReportStudentSchema = z.z.object({
6
+ reportBranchId: z.z.string().optional().explain({ label: "Report Student ID" }),
7
+ studentClassGroupId: z.z.string().optional().explain({ label: "Student Class Group ID" }),
8
+ studentId: z.z.string().optional().explain({ label: "Student ID" }),
9
+ reportType: z.z.array(z.z.number()).optional().explain({ label: "Report Type" })
10
+ });
11
+
12
+ exports.UpdateReportStudentSchema = UpdateReportStudentSchema;
@@ -0,0 +1,17 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const UpdateReportStudentSchema: z.ZodObject<{
3
+ reportBranchId: z.ZodOptional<z.ZodString>;
4
+ studentClassGroupId: z.ZodOptional<z.ZodString>;
5
+ studentId: z.ZodOptional<z.ZodString>;
6
+ reportType: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ reportBranchId?: string | undefined;
9
+ reportType?: number[] | undefined;
10
+ studentClassGroupId?: string | undefined;
11
+ studentId?: string | undefined;
12
+ }, {
13
+ reportBranchId?: string | undefined;
14
+ reportType?: number[] | undefined;
15
+ studentClassGroupId?: string | undefined;
16
+ studentId?: string | undefined;
17
+ }>;
@@ -0,0 +1,10 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const UpdateReportStudentSchema = z.object({
4
+ reportBranchId: z.string().optional().explain({ label: "Report Student ID" }),
5
+ studentClassGroupId: z.string().optional().explain({ label: "Student Class Group ID" }),
6
+ studentId: z.string().optional().explain({ label: "Student ID" }),
7
+ reportType: z.array(z.number()).optional().explain({ label: "Report Type" })
8
+ });
9
+
10
+ export { UpdateReportStudentSchema };
@@ -10,3 +10,4 @@ export * from './getClassSessionConflicts';
10
10
  export * from './syncClassSessions';
11
11
  export * from './setTravelWageSessions';
12
12
  export * from './action.customSaveOneClassSession';
13
+ export * from './syncClassGroups';
@@ -0,0 +1,2 @@
1
+ export * from './syncClassGroups.action';
2
+ export * from './syncClassGroups.schema';
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ const core = require('@neon.id/core');
4
+ const operation = require('@neon.id/operation');
5
+ const query = require('@neon.id/query');
6
+ const utils = require('@neon.id/utils');
7
+ const useTelemetry = require('../../../providers/useTelemetry.cjs');
8
+
9
+ const syncClassGroups = operation.Action.define({
10
+ key: "syncClassGroups",
11
+ name: "sync Class Groups",
12
+ type: "command",
13
+ category: "domain",
14
+ execute: async (input, stream) => {
15
+ utils.guard(stream, "streamRequired");
16
+ utils.guard(input, "inputRequired");
17
+ return useTelemetry.useTelemetry(stream, "syncClassGroups", {
18
+ userId: "",
19
+ ...input
20
+ }, async () => {
21
+ const action = stream.actions.data;
22
+ const today = (/* @__PURE__ */ new Date()).toISOString();
23
+ const threeDaysAgo = /* @__PURE__ */ new Date();
24
+ threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);
25
+ console.log("sync class groups...");
26
+ console.log("today", today, threeDaysAgo);
27
+ const response = await action.syncMany.execute(
28
+ {
29
+ model: "neu:jadwal:classGroup",
30
+ useDry: false,
31
+ query: query.Query.define({
32
+ filter: {
33
+ endedAt: {
34
+ $gte: threeDaysAgo.toISOString(),
35
+ $lte: today
36
+ },
37
+ status: "active"
38
+ },
39
+ limit: 99999
40
+ })
41
+ },
42
+ stream
43
+ );
44
+ console.log("respone", response);
45
+ return core.Result.ok({
46
+ state: "syncClassGroupsSuccess",
47
+ message: "Sync Class Groups Success"
48
+ });
49
+ });
50
+ }
51
+ });
52
+
53
+ exports.syncClassGroups = syncClassGroups;
@@ -0,0 +1,13 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import type { SyncClassGroupsSchema } from './syncClassGroups.schema';
4
+ export type SyncClassGroupsInput = z.parse<typeof SyncClassGroupsSchema>;
5
+ export interface SyncClassGroupsOutput {
6
+ }
7
+ export interface SyncClassGroupsaMeta {
8
+ }
9
+ export declare const syncClassGroups: Action<"syncClassGroups", {
10
+ endedAt?: string | undefined;
11
+ startedAt?: string | undefined;
12
+ }, SyncClassGroupsOutput, SyncClassGroupsaMeta>;
13
+ export type syncClassGroupstAction = typeof syncClassGroups;
@@ -0,0 +1,51 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action } from '@neon.id/operation';
3
+ import { Query } from '@neon.id/query';
4
+ import { guard } from '@neon.id/utils';
5
+ import { useTelemetry } from '../../../providers/useTelemetry.mjs';
6
+
7
+ const syncClassGroups = Action.define({
8
+ key: "syncClassGroups",
9
+ name: "sync Class Groups",
10
+ type: "command",
11
+ category: "domain",
12
+ execute: async (input, stream) => {
13
+ guard(stream, "streamRequired");
14
+ guard(input, "inputRequired");
15
+ return useTelemetry(stream, "syncClassGroups", {
16
+ userId: "",
17
+ ...input
18
+ }, async () => {
19
+ const action = stream.actions.data;
20
+ const today = (/* @__PURE__ */ new Date()).toISOString();
21
+ const threeDaysAgo = /* @__PURE__ */ new Date();
22
+ threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);
23
+ console.log("sync class groups...");
24
+ console.log("today", today, threeDaysAgo);
25
+ const response = await action.syncMany.execute(
26
+ {
27
+ model: "neu:jadwal:classGroup",
28
+ useDry: false,
29
+ query: Query.define({
30
+ filter: {
31
+ endedAt: {
32
+ $gte: threeDaysAgo.toISOString(),
33
+ $lte: today
34
+ },
35
+ status: "active"
36
+ },
37
+ limit: 99999
38
+ })
39
+ },
40
+ stream
41
+ );
42
+ console.log("respone", response);
43
+ return Result.ok({
44
+ state: "syncClassGroupsSuccess",
45
+ message: "Sync Class Groups Success"
46
+ });
47
+ });
48
+ }
49
+ });
50
+
51
+ export { syncClassGroups };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const SyncClassGroupsSchema = z.z.object({
6
+ startedAt: z.z.string().datetime().optional().explain({ label: "Started At" }),
7
+ endedAt: z.z.string().datetime().optional().explain({ label: "Ended At" })
8
+ });
9
+
10
+ exports.SyncClassGroupsSchema = SyncClassGroupsSchema;
@@ -0,0 +1,11 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const SyncClassGroupsSchema: z.ZodObject<{
3
+ startedAt: z.ZodOptional<z.ZodString>;
4
+ endedAt: z.ZodOptional<z.ZodString>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ endedAt?: string | undefined;
7
+ startedAt?: string | undefined;
8
+ }, {
9
+ endedAt?: string | undefined;
10
+ startedAt?: string | undefined;
11
+ }>;
@@ -0,0 +1,8 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const SyncClassGroupsSchema = z.object({
4
+ startedAt: z.string().datetime().optional().explain({ label: "Started At" }),
5
+ endedAt: z.string().datetime().optional().explain({ label: "Ended At" })
6
+ });
7
+
8
+ export { SyncClassGroupsSchema };
@@ -18,7 +18,7 @@ const syncClassSessions = operation.Action.define({
18
18
  execute: async (input, stream) => {
19
19
  utils.guard(stream, "streamRequired");
20
20
  return useTelemetry.useTelemetry(stream, "syncClassSessions", {
21
- userId: stream.context.identitas.userId,
21
+ userId: stream.context?.identitas?.userId || "",
22
22
  ...input
23
23
  }, async () => {
24
24
  const log = util_logger.useLog("syncClassSessions", { isActive: true });
@@ -42,11 +42,14 @@ const syncClassSessions = operation.Action.define({
42
42
  };
43
43
  const data = validate(input);
44
44
  return useTelemetry.useTelemetry(stream, "syncClassSessions", {
45
- userId: stream.context.identitas.userId,
45
+ userId: stream.context?.identitas?.userId || "",
46
46
  data
47
47
  }, async () => {
48
48
  try {
49
- getActorId({ throw: true });
49
+ if (!data.isCron) {
50
+ console.log("identitas", stream.context.identitas);
51
+ getActorId({ throw: true });
52
+ }
50
53
  log.object("input", data);
51
54
  if (!data.all && !data.classSessionIds?.length && !data.startedAt && !data.endedAt) {
52
55
  return core.Result.ok({
@@ -76,6 +79,7 @@ const syncClassSessions = operation.Action.define({
76
79
  data.endedAt
77
80
  )
78
81
  },
82
+ // filter: { endedAt: { $gte: data.endedAt, $lte: data.startedAt } },
79
83
  fragment
80
84
  });
81
85
  console.timeEnd("getManyClassSessions:period");
@@ -9,6 +9,7 @@ export interface SyncClassSessionsOutput {
9
9
  export interface SyncClassSessionsMeta {
10
10
  }
11
11
  export declare const syncClassSessions: Action<"syncClassSessions", {
12
+ isCron: boolean;
12
13
  endedAt?: string | undefined;
13
14
  startedAt?: string | undefined;
14
15
  classSessionIds?: string[] | undefined;
@@ -16,7 +16,7 @@ const syncClassSessions = Action.define({
16
16
  execute: async (input, stream) => {
17
17
  guard(stream, "streamRequired");
18
18
  return useTelemetry(stream, "syncClassSessions", {
19
- userId: stream.context.identitas.userId,
19
+ userId: stream.context?.identitas?.userId || "",
20
20
  ...input
21
21
  }, async () => {
22
22
  const log = useLog("syncClassSessions", { isActive: true });
@@ -40,11 +40,14 @@ const syncClassSessions = Action.define({
40
40
  };
41
41
  const data = validate(input);
42
42
  return useTelemetry(stream, "syncClassSessions", {
43
- userId: stream.context.identitas.userId,
43
+ userId: stream.context?.identitas?.userId || "",
44
44
  data
45
45
  }, async () => {
46
46
  try {
47
- getActorId({ throw: true });
47
+ if (!data.isCron) {
48
+ console.log("identitas", stream.context.identitas);
49
+ getActorId({ throw: true });
50
+ }
48
51
  log.object("input", data);
49
52
  if (!data.all && !data.classSessionIds?.length && !data.startedAt && !data.endedAt) {
50
53
  return Result.ok({
@@ -74,6 +77,7 @@ const syncClassSessions = Action.define({
74
77
  data.endedAt
75
78
  )
76
79
  },
80
+ // filter: { endedAt: { $gte: data.endedAt, $lte: data.startedAt } },
77
81
  fragment
78
82
  });
79
83
  console.timeEnd("getManyClassSessions:period");
@@ -9,7 +9,8 @@ const SyncClassSessionsSchema = z.z.object({
9
9
  label: "Class Session IDs"
10
10
  }),
11
11
  startedAt: z.z.string().datetime().optional().explain({ label: "Started At" }),
12
- endedAt: z.z.string().datetime().optional().explain({ label: "Ended At" })
12
+ endedAt: z.z.string().datetime().optional().explain({ label: "Ended At" }),
13
+ isCron: z.z.boolean().optional().default(false).explain({ label: "Is Cron" })
13
14
  });
14
15
 
15
16
  exports.SyncClassSessionsSchema = SyncClassSessionsSchema;
@@ -5,7 +5,9 @@ export declare const SyncClassSessionsSchema: z.ZodObject<{
5
5
  classSessionIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
6
6
  startedAt: z.ZodOptional<z.ZodString>;
7
7
  endedAt: z.ZodOptional<z.ZodString>;
8
+ isCron: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
9
  }, "strip", z.ZodTypeAny, {
10
+ isCron: boolean;
9
11
  endedAt?: string | undefined;
10
12
  startedAt?: string | undefined;
11
13
  classSessionIds?: string[] | undefined;
@@ -17,4 +19,5 @@ export declare const SyncClassSessionsSchema: z.ZodObject<{
17
19
  classSessionIds?: string[] | undefined;
18
20
  all?: boolean | undefined;
19
21
  return?: boolean | undefined;
22
+ isCron?: boolean | undefined;
20
23
  }>;
@@ -7,7 +7,8 @@ const SyncClassSessionsSchema = z.object({
7
7
  label: "Class Session IDs"
8
8
  }),
9
9
  startedAt: z.string().datetime().optional().explain({ label: "Started At" }),
10
- endedAt: z.string().datetime().optional().explain({ label: "Ended At" })
10
+ endedAt: z.string().datetime().optional().explain({ label: "Ended At" }),
11
+ isCron: z.boolean().optional().default(false).explain({ label: "Is Cron" })
11
12
  });
12
13
 
13
14
  export { SyncClassSessionsSchema };
@@ -12,6 +12,7 @@ async function reminderQuestions(dbs, config) {
12
12
  const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
13
13
  const waitingQuestions = await dbQuestion.find({
14
14
  status: "waiting",
15
+ deletedAt: { $exists: false },
15
16
  createdAt: {
16
17
  $gte: /* @__PURE__ */ new Date("2025-06-11T00:00:00.000Z"),
17
18
  $lte: /* @__PURE__ */ new Date()
@@ -10,6 +10,7 @@ async function reminderQuestions(dbs, config) {
10
10
  const dbStudent = dbs["neu-akademik"].models["neu:akademik:student"];
11
11
  const waitingQuestions = await dbQuestion.find({
12
12
  status: "waiting",
13
+ deletedAt: { $exists: false },
13
14
  createdAt: {
14
15
  $gte: /* @__PURE__ */ new Date("2025-06-11T00:00:00.000Z"),
15
16
  $lte: /* @__PURE__ */ new Date()
package/build/index.cjs CHANGED
@@ -49,13 +49,17 @@ const action_sendQuestion = require('./actions/tanya/action.sendQuestion.cjs');
49
49
  const action_reminderQuestions = require('./actions/tanya/action.reminderQuestions.cjs');
50
50
  const prepareMediaScanterGradingInsert_action = require('./actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.action.cjs');
51
51
  const importData_action = require('./actions/importData/importData.action.cjs');
52
+ const updateReportStudent_action = require('./actions/akademik/updateReportStudent/updateReportStudent.action.cjs');
53
+ const syncClassGroups_action = require('./actions/jadwal/syncClassGroups/syncClassGroups.action.cjs');
52
54
  const action_clearGrading = require('./actions/rasionalisasi/action.clearGrading.cjs');
53
55
  const action_createGradingAndScores = require('./actions/rasionalisasi/action.createGradingAndScores.cjs');
54
56
  const action_updateGradingAndScores = require('./actions/rasionalisasi/action.updateGradingAndScores.cjs');
55
57
  const syncStudentReport_schema = require('./actions/akademik/studentReport/syncStudentReport.schema.cjs');
58
+ const updateReportStudent_schema = require('./actions/akademik/updateReportStudent/updateReportStudent.schema.cjs');
56
59
  const getClassSessionConflicts_schema = require('./actions/jadwal/getClassSessionConflicts/getClassSessionConflicts.schema.cjs');
57
60
  const syncClassSessions_schema = require('./actions/jadwal/syncClassSessions/syncClassSessions.schema.cjs');
58
61
  const setTravelWageSessions_schema = require('./actions/jadwal/setTravelWageSessions/setTravelWageSessions.schema.cjs');
62
+ const syncClassGroups_schema = require('./actions/jadwal/syncClassGroups/syncClassGroups.schema.cjs');
59
63
  const importData_schema = require('./actions/importData/importData.schema.cjs');
60
64
  const prepareMediaScanterGradingInsert_schema = require('./actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.schema.cjs');
61
65
  const refreshGrading_schema = require('./actions/penilaian/refreshGrading/refreshGrading.schema.cjs');
@@ -125,7 +129,11 @@ const actions = {
125
129
  // Media Scanter
126
130
  prepareMediaScanterGradingInsert: prepareMediaScanterGradingInsert_action.prepareMediaScanterGradingInsert,
127
131
  // Import Data
128
- importData: importData_action.importData
132
+ importData: importData_action.importData,
133
+ // update report student
134
+ updateReportStudent: updateReportStudent_action.updateReportStudent,
135
+ // sync
136
+ syncClassGroups: syncClassGroups_action.syncClassGroups
129
137
  };
130
138
 
131
139
  exports.prepareExperience = prepareExperience_action.prepareExperience;
@@ -179,13 +187,17 @@ exports.sendQuestion = action_sendQuestion.sendQuestion;
179
187
  exports.reminderQuestions = action_reminderQuestions.reminderQuestions;
180
188
  exports.prepareMediaScanterGradingInsert = prepareMediaScanterGradingInsert_action.prepareMediaScanterGradingInsert;
181
189
  exports.importData = importData_action.importData;
190
+ exports.updateReportStudent = updateReportStudent_action.updateReportStudent;
191
+ exports.syncClassGroups = syncClassGroups_action.syncClassGroups;
182
192
  exports.clearGrading = action_clearGrading.clearGrading;
183
193
  exports.createGradingAndScores = action_createGradingAndScores.createGradingAndScores;
184
194
  exports.updateGradingAndScores = action_updateGradingAndScores.updateGradingAndScores;
185
195
  exports.StudentReportSchema = syncStudentReport_schema.StudentReportSchema;
196
+ exports.UpdateReportStudentSchema = updateReportStudent_schema.UpdateReportStudentSchema;
186
197
  exports.GetClassSessionConflictsSchema = getClassSessionConflicts_schema.GetClassSessionConflictsSchema;
187
198
  exports.SyncClassSessionsSchema = syncClassSessions_schema.SyncClassSessionsSchema;
188
199
  exports.SetTravelWageSessionsSchema = setTravelWageSessions_schema.SetTravelWageSessionsSchema;
200
+ exports.SyncClassGroupsSchema = syncClassGroups_schema.SyncClassGroupsSchema;
189
201
  exports.ImportDataSchema = importData_schema.ImportDataSchema;
190
202
  exports.PrepareMediaScanterGradingInsertSchema = prepareMediaScanterGradingInsert_schema.PrepareMediaScanterGradingInsertSchema;
191
203
  exports.RefreshGradingSchema = refreshGrading_schema.RefreshGradingSchema;
package/build/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export declare const actions: {
18
18
  endedAt?: string | undefined;
19
19
  startedAt?: string | undefined;
20
20
  studentId?: string | undefined;
21
+ groupId?: string | undefined;
21
22
  }, import("./actions").SyncStudentReportOutput, import("./actions").SyncStudentReportMeta>;
22
23
  syncStudentInformation: import("@neon.id/operation").Action<"syncStudentInformation", import("./actions").SyncStudentInformationInput, import("./actions").SyncStudentInformationOutput, import("./actions").SyncStudentInformationMeta>;
23
24
  syncCommitment: import("@neon.id/operation").Action<"syncCommitment", import("./actions").SyncCommitmentInput, import("./actions").SyncCommitmentOutput, import("./actions").SyncCommitmentMeta>;
@@ -43,6 +44,7 @@ export declare const actions: {
43
44
  syncStudentAdmisi: import("@neon.id/operation").Action<"syncStudentAdmisi", import("./actions").SyncStudentAdmisiInput, import("./actions").SyncStudentAdmisiOutput, import("./actions").SyncStudentAdmisiMeta>;
44
45
  checkClassAttendance: import("@neon.id/operation").Action<"checkClassAttendance", import("./actions").CheckClassAttendanceInput, import("./actions").CheckClassAttendanceOutput, import("./actions").CheckClassAttendanceMeta>;
45
46
  syncClassSessions: import("@neon.id/operation").Action<"syncClassSessions", {
47
+ isCron: boolean;
46
48
  endedAt?: string | undefined;
47
49
  startedAt?: string | undefined;
48
50
  classSessionIds?: string[] | undefined;
@@ -88,4 +90,14 @@ export declare const actions: {
88
90
  importData: import("@neon.id/operation").Action<"importData", {
89
91
  csvData?: any[] | undefined;
90
92
  }, import("./actions").ImportDataOutput, import("./actions").ImportDataMeta>;
93
+ updateReportStudent: import("@neon.id/operation").Action<"updateReportStudent", {
94
+ reportBranchId?: string | undefined;
95
+ reportType?: number[] | undefined;
96
+ studentClassGroupId?: string | undefined;
97
+ studentId?: string | undefined;
98
+ }, import("./actions").UpdateReportStudentOutput, import("./actions").UpdateReportStudentMeta>;
99
+ syncClassGroups: import("@neon.id/operation").Action<"syncClassGroups", {
100
+ endedAt?: string | undefined;
101
+ startedAt?: string | undefined;
102
+ }, import("./actions").SyncClassGroupsOutput, import("./actions").SyncClassGroupsaMeta>;
91
103
  };
package/build/index.mjs CHANGED
@@ -49,13 +49,17 @@ import { sendQuestion } from './actions/tanya/action.sendQuestion.mjs';
49
49
  import { reminderQuestions } from './actions/tanya/action.reminderQuestions.mjs';
50
50
  import { prepareMediaScanterGradingInsert } from './actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.action.mjs';
51
51
  import { importData } from './actions/importData/importData.action.mjs';
52
+ import { updateReportStudent } from './actions/akademik/updateReportStudent/updateReportStudent.action.mjs';
53
+ import { syncClassGroups } from './actions/jadwal/syncClassGroups/syncClassGroups.action.mjs';
52
54
  import { clearGrading } from './actions/rasionalisasi/action.clearGrading.mjs';
53
55
  import { createGradingAndScores } from './actions/rasionalisasi/action.createGradingAndScores.mjs';
54
56
  import { updateGradingAndScores } from './actions/rasionalisasi/action.updateGradingAndScores.mjs';
55
57
  export { StudentReportSchema } from './actions/akademik/studentReport/syncStudentReport.schema.mjs';
58
+ export { UpdateReportStudentSchema } from './actions/akademik/updateReportStudent/updateReportStudent.schema.mjs';
56
59
  export { GetClassSessionConflictsSchema } from './actions/jadwal/getClassSessionConflicts/getClassSessionConflicts.schema.mjs';
57
60
  export { SyncClassSessionsSchema } from './actions/jadwal/syncClassSessions/syncClassSessions.schema.mjs';
58
61
  export { SetTravelWageSessionsSchema } from './actions/jadwal/setTravelWageSessions/setTravelWageSessions.schema.mjs';
62
+ export { SyncClassGroupsSchema } from './actions/jadwal/syncClassGroups/syncClassGroups.schema.mjs';
59
63
  export { ImportDataSchema } from './actions/importData/importData.schema.mjs';
60
64
  export { PrepareMediaScanterGradingInsertSchema } from './actions/mediaScanter/prepareMediaScanterGradingInsert/prepareMediaScanterGradingInsert.schema.mjs';
61
65
  export { RefreshGradingSchema } from './actions/penilaian/refreshGrading/refreshGrading.schema.mjs';
@@ -125,7 +129,11 @@ const actions = {
125
129
  // Media Scanter
126
130
  prepareMediaScanterGradingInsert,
127
131
  // Import Data
128
- importData
132
+ importData,
133
+ // update report student
134
+ updateReportStudent,
135
+ // sync
136
+ syncClassGroups
129
137
  };
130
138
 
131
- export { acceptQuestion, actions, addManyGradingComponent, allConflict, calculateGrading, calculateManyComparator, calculateOneComparator, checkClassAttendance, classSessionInventoryOccurs, classSessionInventoryPreparation, clearAllOverrides, clearGrading, clearOneOverrides, createGradingAndScores, createManySession, customSaveOneClassSession, deleteManySession, editAnswer, generateGrading, getClassSessionConflicts, getGradingCount, getQuestionCount, getStaffId, getStaffPoint, getStudentId, getStudentPoint, getTeacherPoint, hasUnderstand, importData, notUnderstand, prepareConflict, prepareExperience, prepareMediaScanterGradingInsert, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, refreshGrading, refreshManyGrading, refreshModuleAccess, reminderQuestions, replaceModuleAccess, sendAnswer, sendQuestion, setTravelWageSessions, syncClassSessions, syncCommitment, syncStudentAdmisi, syncStudentBranch, syncStudentInformation, syncStudentReport, updateGradingAndScores, updateMany, userCountStats };
139
+ export { acceptQuestion, actions, addManyGradingComponent, allConflict, calculateGrading, calculateManyComparator, calculateOneComparator, checkClassAttendance, classSessionInventoryOccurs, classSessionInventoryPreparation, clearAllOverrides, clearGrading, clearOneOverrides, createGradingAndScores, createManySession, customSaveOneClassSession, deleteManySession, editAnswer, generateGrading, getClassSessionConflicts, getGradingCount, getQuestionCount, getStaffId, getStaffPoint, getStudentId, getStudentPoint, getTeacherPoint, hasUnderstand, importData, notUnderstand, prepareConflict, prepareExperience, prepareMediaScanterGradingInsert, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, refreshGrading, refreshManyGrading, refreshModuleAccess, reminderQuestions, replaceModuleAccess, sendAnswer, sendQuestion, setTravelWageSessions, syncClassGroups, syncClassSessions, syncCommitment, syncStudentAdmisi, syncStudentBranch, syncStudentInformation, syncStudentReport, updateGradingAndScores, updateMany, updateReportStudent, userCountStats };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutron.co.id/pendidikan-operation",
3
- "version": "1.26.29",
3
+ "version": "1.26.31-beta.1",
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.19.17",
42
+ "@neutron.co.id/akademik-models": "^1.20.1-beta.1",
43
43
  "@neutron.co.id/jadwal-models": "^1.19.11",
44
- "@neutron.co.id/pendidikan-types": "^1.22.20",
44
+ "@neutron.co.id/pendidikan-types": "^1.22.23-beta.1",
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.19.17",
78
+ "@neutron.co.id/akademik-models": "^1.20.1-beta.1",
79
79
  "@neutron.co.id/jadwal-models": "^1.19.11",
80
- "@neutron.co.id/pendidikan-types": "^1.22.20",
80
+ "@neutron.co.id/pendidikan-types": "^1.22.23-beta.1",
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": 118
89
+ "build": 121
90
90
  }