@neutron.co.id/pendidikan-operation 1.29.5 → 1.29.7

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 (51) hide show
  1. package/build/actions/checkProgramExistance/checkProgramExistance.action.cjs +64 -0
  2. package/build/actions/checkProgramExistance/checkProgramExistance.action.d.ts +13 -0
  3. package/build/actions/checkProgramExistance/checkProgramExistance.action.mjs +62 -0
  4. package/build/actions/checkProgramExistance/checkProgramExistance.schema.cjs +10 -0
  5. package/build/actions/checkProgramExistance/checkProgramExistance.schema.d.ts +11 -0
  6. package/build/actions/checkProgramExistance/checkProgramExistance.schema.mjs +8 -0
  7. package/build/actions/checkProgramExistance/index.d.ts +2 -0
  8. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.cjs +65 -0
  9. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.d.ts +13 -0
  10. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.mjs +63 -0
  11. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.cjs +10 -0
  12. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.d.ts +11 -0
  13. package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.mjs +8 -0
  14. package/build/actions/checkStudentProgramExistance/index.d.ts +2 -0
  15. package/build/actions/index.d.ts +2 -0
  16. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.cjs +49 -0
  17. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.d.ts +14 -0
  18. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.mjs +47 -0
  19. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.cjs +11 -0
  20. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.d.ts +14 -0
  21. package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.mjs +9 -0
  22. package/build/actions/penilaian/getGradingComponentByType/index.d.ts +2 -0
  23. package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.cjs +63 -0
  24. package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.d.ts +16 -0
  25. package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.mjs +61 -0
  26. package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.cjs +13 -0
  27. package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.d.ts +20 -0
  28. package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.mjs +11 -0
  29. package/build/actions/penilaian/getGradingStudent/index.d.ts +2 -0
  30. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.cjs +50 -0
  31. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.d.ts +14 -0
  32. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.mjs +48 -0
  33. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.cjs +11 -0
  34. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.d.ts +14 -0
  35. package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.mjs +9 -0
  36. package/build/actions/penilaian/getGradingTypeByYear/index.d.ts +2 -0
  37. package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.cjs +58 -0
  38. package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.d.ts +13 -0
  39. package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.mjs +56 -0
  40. package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.cjs +10 -0
  41. package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.d.ts +11 -0
  42. package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.mjs +8 -0
  43. package/build/actions/penilaian/getScoreStudent/index.d.ts +2 -0
  44. package/build/actions/penilaian/index.d.ts +4 -0
  45. package/build/index.cjs +31 -1
  46. package/build/index.d.ts +29 -0
  47. package/build/index.mjs +20 -2
  48. package/build/providers/penilaian/usePenilaian.cjs +225 -43
  49. package/build/providers/penilaian/usePenilaian.d.ts +24 -0
  50. package/build/providers/penilaian/usePenilaian.mjs +225 -43
  51. package/package.json +6 -6
@@ -0,0 +1,64 @@
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 query = require('@neon.id/query');
7
+ const checkProgramExistance_schema = require('./checkProgramExistance.schema.cjs');
8
+ const useTelemetry = require('../../providers/useTelemetry.cjs');
9
+
10
+ const checkProgramExistance = operation.Action.define({
11
+ key: "checkProgramExistance",
12
+ name: "Import Data",
13
+ type: "command",
14
+ category: "domain",
15
+ execute: async (input, stream) => {
16
+ utils.guard(stream, "streamRequired");
17
+ const { validate } = operation.useValidation(stream, checkProgramExistance_schema.CheckProgramExistanceSchema);
18
+ const actions = stream.actions.data;
19
+ const data = validate(input);
20
+ return useTelemetry.useTelemetry(stream, "importData", {
21
+ userId: stream.context.identitas.userId,
22
+ data
23
+ }, async () => {
24
+ const { getActorId } = operation.useStream(stream);
25
+ try {
26
+ getActorId({ throw: true });
27
+ console.log("data", data);
28
+ const programs = await actions.getMany.execute({
29
+ model: "neu:akademik:program",
30
+ query: query.Query.define({
31
+ filter: {
32
+ $or: [
33
+ { name: data.name },
34
+ { code: data.code }
35
+ ]
36
+ },
37
+ fields: {
38
+ id: 1
39
+ }
40
+ })
41
+ }, stream);
42
+ const isExist = programs?.value?.length > 0;
43
+ return core.Result.ok({
44
+ state: "checkProgramExistance",
45
+ message: "Check Program Existance",
46
+ data: {
47
+ isExist
48
+ }
49
+ });
50
+ } catch (error) {
51
+ if (error?.isFailure)
52
+ throw error;
53
+ console.error(error);
54
+ return core.Result.fail({
55
+ state: `checkProgramExistanceFailed`,
56
+ message: `Failed to check existance program.`,
57
+ error: error?.toString()
58
+ });
59
+ }
60
+ });
61
+ }
62
+ });
63
+
64
+ exports.checkProgramExistance = checkProgramExistance;
@@ -0,0 +1,13 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { CheckProgramExistanceSchema } from './checkProgramExistance.schema';
4
+ export type CheckProgramExistanceInput = z.parse<typeof CheckProgramExistanceSchema>;
5
+ export interface CheckProgramExistanceOutput {
6
+ }
7
+ export interface CheckProgramExistanceMeta {
8
+ }
9
+ export declare const checkProgramExistance: Action<"checkProgramExistance", {
10
+ name: string;
11
+ code: string;
12
+ }, CheckProgramExistanceOutput, CheckProgramExistanceMeta>;
13
+ export type CheckProgramExistanceAction = typeof checkProgramExistance;
@@ -0,0 +1,62 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useValidation, useStream } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { Query } from '@neon.id/query';
5
+ import { CheckProgramExistanceSchema } from './checkProgramExistance.schema.mjs';
6
+ import { useTelemetry } from '../../providers/useTelemetry.mjs';
7
+
8
+ const checkProgramExistance = Action.define({
9
+ key: "checkProgramExistance",
10
+ name: "Import Data",
11
+ type: "command",
12
+ category: "domain",
13
+ execute: async (input, stream) => {
14
+ guard(stream, "streamRequired");
15
+ const { validate } = useValidation(stream, CheckProgramExistanceSchema);
16
+ const actions = stream.actions.data;
17
+ const data = validate(input);
18
+ return useTelemetry(stream, "importData", {
19
+ userId: stream.context.identitas.userId,
20
+ data
21
+ }, async () => {
22
+ const { getActorId } = useStream(stream);
23
+ try {
24
+ getActorId({ throw: true });
25
+ console.log("data", data);
26
+ const programs = await actions.getMany.execute({
27
+ model: "neu:akademik:program",
28
+ query: Query.define({
29
+ filter: {
30
+ $or: [
31
+ { name: data.name },
32
+ { code: data.code }
33
+ ]
34
+ },
35
+ fields: {
36
+ id: 1
37
+ }
38
+ })
39
+ }, stream);
40
+ const isExist = programs?.value?.length > 0;
41
+ return Result.ok({
42
+ state: "checkProgramExistance",
43
+ message: "Check Program Existance",
44
+ data: {
45
+ isExist
46
+ }
47
+ });
48
+ } catch (error) {
49
+ if (error?.isFailure)
50
+ throw error;
51
+ console.error(error);
52
+ return Result.fail({
53
+ state: `checkProgramExistanceFailed`,
54
+ message: `Failed to check existance program.`,
55
+ error: error?.toString()
56
+ });
57
+ }
58
+ });
59
+ }
60
+ });
61
+
62
+ export { checkProgramExistance };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const CheckProgramExistanceSchema = z.z.object({
6
+ name: z.z.string().explain({ label: "Program Name" }),
7
+ code: z.z.string().explain({ label: "Program Code" })
8
+ });
9
+
10
+ exports.CheckProgramExistanceSchema = CheckProgramExistanceSchema;
@@ -0,0 +1,11 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const CheckProgramExistanceSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ code: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ name: string;
7
+ code: string;
8
+ }, {
9
+ name: string;
10
+ code: string;
11
+ }>;
@@ -0,0 +1,8 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const CheckProgramExistanceSchema = z.object({
4
+ name: z.string().explain({ label: "Program Name" }),
5
+ code: z.string().explain({ label: "Program Code" })
6
+ });
7
+
8
+ export { CheckProgramExistanceSchema };
@@ -0,0 +1,2 @@
1
+ export * from './checkProgramExistance.action';
2
+ export * from './checkProgramExistance.schema';
@@ -0,0 +1,65 @@
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 query = require('@neon.id/query');
7
+ const checkStudentProgramExistance_schema = require('./checkStudentProgramExistance.schema.cjs');
8
+ const useTelemetry = require('../../providers/useTelemetry.cjs');
9
+
10
+ const checkStudentProgramExistance = operation.Action.define({
11
+ key: "checkStudentProgramExistance",
12
+ name: "Check Student Program Data",
13
+ type: "command",
14
+ category: "domain",
15
+ execute: async (input, stream) => {
16
+ utils.guard(stream, "streamRequired");
17
+ const { validate } = operation.useValidation(stream, checkStudentProgramExistance_schema.CheckStudentProgramExistanceSchema);
18
+ const actions = stream.actions.data;
19
+ const data = validate(input);
20
+ return useTelemetry.useTelemetry(stream, "checkStudentProgramExistance", {
21
+ userId: stream.context.identitas.userId,
22
+ data
23
+ }, async () => {
24
+ const { getActorId } = operation.useStream(stream);
25
+ try {
26
+ getActorId({ throw: true });
27
+ console.log("data", data);
28
+ const studentPrograms = await actions.getMany.execute({
29
+ model: "neu:akademik:studentProgram",
30
+ query: query.Query.define({
31
+ filter: {
32
+ $and: [
33
+ { studentId: data.studentId },
34
+ { programId: data.programId },
35
+ { deletedAt: { $exists: false } }
36
+ ]
37
+ },
38
+ fields: {
39
+ id: 1
40
+ }
41
+ })
42
+ }, stream);
43
+ const isExist = studentPrograms?.value?.length > 0;
44
+ return core.Result.ok({
45
+ state: "checkStudentProgramExistance",
46
+ message: "Check Student Program Existance",
47
+ data: {
48
+ isExist
49
+ }
50
+ });
51
+ } catch (error) {
52
+ if (error?.isFailure)
53
+ throw error;
54
+ console.error(error);
55
+ return core.Result.fail({
56
+ state: `checkStudentProgramExistanceFailed`,
57
+ message: `Failed to check existance Student program.`,
58
+ error: error?.toString()
59
+ });
60
+ }
61
+ });
62
+ }
63
+ });
64
+
65
+ exports.checkStudentProgramExistance = checkStudentProgramExistance;
@@ -0,0 +1,13 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { CheckStudentProgramExistanceSchema } from './checkStudentProgramExistance.schema';
4
+ export type CheckStudentProgramExistanceInput = z.parse<typeof CheckStudentProgramExistanceSchema>;
5
+ export interface CheckStudentProgramExistanceOutput {
6
+ }
7
+ export interface CheckStudentProgramExistanceMeta {
8
+ }
9
+ export declare const checkStudentProgramExistance: Action<"checkStudentProgramExistance", {
10
+ studentId: string;
11
+ programId: string;
12
+ }, CheckStudentProgramExistanceOutput, CheckStudentProgramExistanceMeta>;
13
+ export type CheckStudentProgramExistanceAction = typeof checkStudentProgramExistance;
@@ -0,0 +1,63 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useValidation, useStream } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { Query } from '@neon.id/query';
5
+ import { CheckStudentProgramExistanceSchema } from './checkStudentProgramExistance.schema.mjs';
6
+ import { useTelemetry } from '../../providers/useTelemetry.mjs';
7
+
8
+ const checkStudentProgramExistance = Action.define({
9
+ key: "checkStudentProgramExistance",
10
+ name: "Check Student Program Data",
11
+ type: "command",
12
+ category: "domain",
13
+ execute: async (input, stream) => {
14
+ guard(stream, "streamRequired");
15
+ const { validate } = useValidation(stream, CheckStudentProgramExistanceSchema);
16
+ const actions = stream.actions.data;
17
+ const data = validate(input);
18
+ return useTelemetry(stream, "checkStudentProgramExistance", {
19
+ userId: stream.context.identitas.userId,
20
+ data
21
+ }, async () => {
22
+ const { getActorId } = useStream(stream);
23
+ try {
24
+ getActorId({ throw: true });
25
+ console.log("data", data);
26
+ const studentPrograms = await actions.getMany.execute({
27
+ model: "neu:akademik:studentProgram",
28
+ query: Query.define({
29
+ filter: {
30
+ $and: [
31
+ { studentId: data.studentId },
32
+ { programId: data.programId },
33
+ { deletedAt: { $exists: false } }
34
+ ]
35
+ },
36
+ fields: {
37
+ id: 1
38
+ }
39
+ })
40
+ }, stream);
41
+ const isExist = studentPrograms?.value?.length > 0;
42
+ return Result.ok({
43
+ state: "checkStudentProgramExistance",
44
+ message: "Check Student Program Existance",
45
+ data: {
46
+ isExist
47
+ }
48
+ });
49
+ } catch (error) {
50
+ if (error?.isFailure)
51
+ throw error;
52
+ console.error(error);
53
+ return Result.fail({
54
+ state: `checkStudentProgramExistanceFailed`,
55
+ message: `Failed to check existance Student program.`,
56
+ error: error?.toString()
57
+ });
58
+ }
59
+ });
60
+ }
61
+ });
62
+
63
+ export { checkStudentProgramExistance };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const CheckStudentProgramExistanceSchema = z.z.object({
6
+ studentId: z.z.string().explain({ label: "Student ID" }),
7
+ programId: z.z.string().explain({ label: "Program Id" })
8
+ });
9
+
10
+ exports.CheckStudentProgramExistanceSchema = CheckStudentProgramExistanceSchema;
@@ -0,0 +1,11 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const CheckStudentProgramExistanceSchema: z.ZodObject<{
3
+ studentId: z.ZodString;
4
+ programId: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ studentId: string;
7
+ programId: string;
8
+ }, {
9
+ studentId: string;
10
+ programId: string;
11
+ }>;
@@ -0,0 +1,8 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const CheckStudentProgramExistanceSchema = z.object({
4
+ studentId: z.string().explain({ label: "Student ID" }),
5
+ programId: z.string().explain({ label: "Program Id" })
6
+ });
7
+
8
+ export { CheckStudentProgramExistanceSchema };
@@ -0,0 +1,2 @@
1
+ export * from './checkStudentProgramExistance.action';
2
+ export * from './checkStudentProgramExistance.schema';
@@ -10,3 +10,5 @@ export * from './replaceModuleAccessManyStudent';
10
10
  export * from './rasionalisasi';
11
11
  export * from './tanya';
12
12
  export * from './updateMany';
13
+ export * from './checkProgramExistance';
14
+ export * from './checkStudentProgramExistance';
@@ -0,0 +1,49 @@
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 getGradingComponentByType_schema = require('./getGradingComponentByType.schema.cjs');
7
+ const useTelemetry = require('../../../providers/useTelemetry.cjs');
8
+ const usePenilaian = require('../../../providers/penilaian/usePenilaian.cjs');
9
+
10
+ const getGradingComponentByType = operation.Action.define({
11
+ key: "getGradingComponentByType",
12
+ name: "Get Grading Component By Type",
13
+ type: "command",
14
+ category: "domain",
15
+ execute: async (input, stream) => {
16
+ utils.guard(stream, "streamRequired");
17
+ const { validate } = operation.useValidation(stream, getGradingComponentByType_schema.GetGradingComponentByTypeSchema);
18
+ const data = validate(input);
19
+ return useTelemetry.useTelemetry(stream, "getGradingComponentByType", {
20
+ userId: stream?.context?.identitas?.userId,
21
+ data
22
+ }, async () => {
23
+ try {
24
+ const { getManyGradingComponent } = usePenilaian.usePenilaian(stream);
25
+ utils.guard(data.gradingTypeId, "gradingTypeIdRequired");
26
+ const { items, meta } = await getManyGradingComponent(stream, data.gradingTypeId, data.limit, data.page);
27
+ return core.Result.ok({
28
+ state: "getGradingComponentByTypeSuccess",
29
+ message: "getGradingComponentByType has been sucessfully executed.",
30
+ data: {
31
+ gradingComponent: items,
32
+ meta
33
+ }
34
+ });
35
+ } catch (error) {
36
+ if (error?.isFailure)
37
+ throw error;
38
+ console.error(error);
39
+ return core.Result.fail({
40
+ state: `getGradingComponentByTypeFailed`,
41
+ message: `Failed to getGradingComponentByType.`,
42
+ error: error?.toString()
43
+ });
44
+ }
45
+ });
46
+ }
47
+ });
48
+
49
+ exports.getGradingComponentByType = getGradingComponentByType;
@@ -0,0 +1,14 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { GetGradingComponentByTypeSchema } from './getGradingComponentByType.schema';
4
+ export type getGradingComponentByTypeInput = z.parse<typeof GetGradingComponentByTypeSchema>;
5
+ export interface getGradingComponentByTypeOutput {
6
+ }
7
+ export interface getGradingComponentByTypeMeta {
8
+ }
9
+ export declare const getGradingComponentByType: Action<"getGradingComponentByType", {
10
+ gradingTypeId: string;
11
+ limit: number;
12
+ page: number;
13
+ }, getGradingComponentByTypeOutput, getGradingComponentByTypeMeta>;
14
+ export type GetGradingComponentByTypeAction = typeof getGradingComponentByType;
@@ -0,0 +1,47 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useValidation } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { GetGradingComponentByTypeSchema } from './getGradingComponentByType.schema.mjs';
5
+ import { useTelemetry } from '../../../providers/useTelemetry.mjs';
6
+ import { usePenilaian } from '../../../providers/penilaian/usePenilaian.mjs';
7
+
8
+ const getGradingComponentByType = Action.define({
9
+ key: "getGradingComponentByType",
10
+ name: "Get Grading Component By Type",
11
+ type: "command",
12
+ category: "domain",
13
+ execute: async (input, stream) => {
14
+ guard(stream, "streamRequired");
15
+ const { validate } = useValidation(stream, GetGradingComponentByTypeSchema);
16
+ const data = validate(input);
17
+ return useTelemetry(stream, "getGradingComponentByType", {
18
+ userId: stream?.context?.identitas?.userId,
19
+ data
20
+ }, async () => {
21
+ try {
22
+ const { getManyGradingComponent } = usePenilaian(stream);
23
+ guard(data.gradingTypeId, "gradingTypeIdRequired");
24
+ const { items, meta } = await getManyGradingComponent(stream, data.gradingTypeId, data.limit, data.page);
25
+ return Result.ok({
26
+ state: "getGradingComponentByTypeSuccess",
27
+ message: "getGradingComponentByType has been sucessfully executed.",
28
+ data: {
29
+ gradingComponent: items,
30
+ meta
31
+ }
32
+ });
33
+ } catch (error) {
34
+ if (error?.isFailure)
35
+ throw error;
36
+ console.error(error);
37
+ return Result.fail({
38
+ state: `getGradingComponentByTypeFailed`,
39
+ message: `Failed to getGradingComponentByType.`,
40
+ error: error?.toString()
41
+ });
42
+ }
43
+ });
44
+ }
45
+ });
46
+
47
+ export { getGradingComponentByType };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const z = require('@neon.id/z');
4
+
5
+ const GetGradingComponentByTypeSchema = z.z.object({
6
+ gradingTypeId: z.z.string().explain({ label: "gradingTypeId" }),
7
+ limit: z.z.number().default(20).explain({ label: "Limit" }),
8
+ page: z.z.number().default(1).explain({ label: "Page" })
9
+ });
10
+
11
+ exports.GetGradingComponentByTypeSchema = GetGradingComponentByTypeSchema;
@@ -0,0 +1,14 @@
1
+ import { z } from '@neon.id/z';
2
+ export declare const GetGradingComponentByTypeSchema: z.ZodObject<{
3
+ gradingTypeId: z.ZodString;
4
+ limit: z.ZodDefault<z.ZodNumber>;
5
+ page: z.ZodDefault<z.ZodNumber>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ gradingTypeId: string;
8
+ limit: number;
9
+ page: number;
10
+ }, {
11
+ gradingTypeId: string;
12
+ limit?: number | undefined;
13
+ page?: number | undefined;
14
+ }>;
@@ -0,0 +1,9 @@
1
+ import { z } from '@neon.id/z';
2
+
3
+ const GetGradingComponentByTypeSchema = z.object({
4
+ gradingTypeId: z.string().explain({ label: "gradingTypeId" }),
5
+ limit: z.number().default(20).explain({ label: "Limit" }),
6
+ page: z.number().default(1).explain({ label: "Page" })
7
+ });
8
+
9
+ export { GetGradingComponentByTypeSchema };
@@ -0,0 +1,2 @@
1
+ export * from './getGradingComponentByType.action';
2
+ export * from './getGradingComponentByType.schema';
@@ -0,0 +1,63 @@
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 getGradingStudent_schema = require('./getGradingStudent.schema.cjs');
7
+ const useTelemetry = require('../../../providers/useTelemetry.cjs');
8
+ const usePenilaian = require('../../../providers/penilaian/usePenilaian.cjs');
9
+
10
+ const getGradingStudent = operation.Action.define({
11
+ key: "getGradingStudent",
12
+ name: "Get Grading Student",
13
+ type: "command",
14
+ category: "domain",
15
+ execute: async (input, stream) => {
16
+ utils.guard(stream, "streamRequired");
17
+ const { validate } = operation.useValidation(stream, getGradingStudent_schema.GetGradingStudentSchema);
18
+ const data = validate(input);
19
+ return useTelemetry.useTelemetry(
20
+ stream,
21
+ "getGradingStudent",
22
+ {
23
+ userId: stream?.context?.identitas?.userId,
24
+ data
25
+ },
26
+ async () => {
27
+ try {
28
+ const { getManyGradingByStudent } = usePenilaian.usePenilaian(stream);
29
+ utils.guard(data.studentId, "studentIdRequired");
30
+ utils.guard(data.gradingTypeId, "gradingTypeIdRequired");
31
+ utils.guard(data.branchId, "branchIdRequired");
32
+ const { items, meta } = await getManyGradingByStudent(
33
+ stream,
34
+ data.studentId,
35
+ data.gradingTypeId,
36
+ data.branchId,
37
+ data.limit,
38
+ data.page
39
+ );
40
+ return core.Result.ok({
41
+ state: "getGradingStudentSuccess",
42
+ message: "getGradingStudent has been sucessfully executed.",
43
+ data: {
44
+ grading: items,
45
+ meta
46
+ }
47
+ });
48
+ } catch (error) {
49
+ if (error?.isFailure)
50
+ throw error;
51
+ console.error(error);
52
+ return core.Result.fail({
53
+ state: `getGradingStudentFailed`,
54
+ message: `Failed to getGradingStudent.`,
55
+ error: error?.toString()
56
+ });
57
+ }
58
+ }
59
+ );
60
+ }
61
+ });
62
+
63
+ exports.getGradingStudent = getGradingStudent;
@@ -0,0 +1,16 @@
1
+ import { Action } from '@neon.id/operation';
2
+ import type { z } from '@neon.id/z';
3
+ import { GetGradingStudentSchema } from './getGradingStudent.schema';
4
+ export type getGradingStudentInput = z.parse<typeof GetGradingStudentSchema>;
5
+ export interface getGradingStudentOutput {
6
+ }
7
+ export interface getGradingStudentMeta {
8
+ }
9
+ export declare const getGradingStudent: Action<"getGradingStudent", {
10
+ branchId: string;
11
+ studentId: string;
12
+ gradingTypeId: string;
13
+ limit: number;
14
+ page: number;
15
+ }, getGradingStudentOutput, getGradingStudentMeta>;
16
+ export type GetGradingStudentAction = typeof getGradingStudent;
@@ -0,0 +1,61 @@
1
+ import { Result } from '@neon.id/core';
2
+ import { Action, useValidation } from '@neon.id/operation';
3
+ import { guard } from '@neon.id/utils';
4
+ import { GetGradingStudentSchema } from './getGradingStudent.schema.mjs';
5
+ import { useTelemetry } from '../../../providers/useTelemetry.mjs';
6
+ import { usePenilaian } from '../../../providers/penilaian/usePenilaian.mjs';
7
+
8
+ const getGradingStudent = Action.define({
9
+ key: "getGradingStudent",
10
+ name: "Get Grading Student",
11
+ type: "command",
12
+ category: "domain",
13
+ execute: async (input, stream) => {
14
+ guard(stream, "streamRequired");
15
+ const { validate } = useValidation(stream, GetGradingStudentSchema);
16
+ const data = validate(input);
17
+ return useTelemetry(
18
+ stream,
19
+ "getGradingStudent",
20
+ {
21
+ userId: stream?.context?.identitas?.userId,
22
+ data
23
+ },
24
+ async () => {
25
+ try {
26
+ const { getManyGradingByStudent } = usePenilaian(stream);
27
+ guard(data.studentId, "studentIdRequired");
28
+ guard(data.gradingTypeId, "gradingTypeIdRequired");
29
+ guard(data.branchId, "branchIdRequired");
30
+ const { items, meta } = await getManyGradingByStudent(
31
+ stream,
32
+ data.studentId,
33
+ data.gradingTypeId,
34
+ data.branchId,
35
+ data.limit,
36
+ data.page
37
+ );
38
+ return Result.ok({
39
+ state: "getGradingStudentSuccess",
40
+ message: "getGradingStudent has been sucessfully executed.",
41
+ data: {
42
+ grading: items,
43
+ meta
44
+ }
45
+ });
46
+ } catch (error) {
47
+ if (error?.isFailure)
48
+ throw error;
49
+ console.error(error);
50
+ return Result.fail({
51
+ state: `getGradingStudentFailed`,
52
+ message: `Failed to getGradingStudent.`,
53
+ error: error?.toString()
54
+ });
55
+ }
56
+ }
57
+ );
58
+ }
59
+ });
60
+
61
+ export { getGradingStudent };