@neutron.co.id/pendidikan-operation 1.29.6 → 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.
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.cjs +65 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.d.ts +13 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.action.mjs +63 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.cjs +10 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.d.ts +11 -0
- package/build/actions/checkStudentProgramExistance/checkStudentProgramExistance.schema.mjs +8 -0
- package/build/actions/checkStudentProgramExistance/index.d.ts +2 -0
- package/build/actions/index.d.ts +1 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.cjs +49 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.d.ts +14 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.mjs +47 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.cjs +11 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.d.ts +14 -0
- package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.mjs +9 -0
- package/build/actions/penilaian/getGradingComponentByType/index.d.ts +2 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.cjs +63 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.d.ts +16 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.action.mjs +61 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.cjs +13 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.d.ts +20 -0
- package/build/actions/penilaian/getGradingStudent/getGradingStudent.schema.mjs +11 -0
- package/build/actions/penilaian/getGradingStudent/index.d.ts +2 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.cjs +50 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.d.ts +14 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.action.mjs +48 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.cjs +11 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.d.ts +14 -0
- package/build/actions/penilaian/getGradingTypeByYear/getGradingTypeByYear.schema.mjs +9 -0
- package/build/actions/penilaian/getGradingTypeByYear/index.d.ts +2 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.cjs +58 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.d.ts +13 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.action.mjs +56 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.cjs +10 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.d.ts +11 -0
- package/build/actions/penilaian/getScoreStudent/getScoreStudent.schema.mjs +8 -0
- package/build/actions/penilaian/getScoreStudent/index.d.ts +2 -0
- package/build/actions/penilaian/index.d.ts +4 -0
- package/build/index.cjs +26 -1
- package/build/index.d.ts +25 -0
- package/build/index.mjs +17 -2
- package/build/providers/penilaian/usePenilaian.cjs +225 -43
- package/build/providers/penilaian/usePenilaian.d.ts +24 -0
- package/build/providers/penilaian/usePenilaian.mjs +225 -43
- package/package.json +4 -4
|
@@ -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
|
+
}>;
|
package/build/actions/index.d.ts
CHANGED
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.cjs
ADDED
|
@@ -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;
|
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.d.ts
ADDED
|
@@ -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;
|
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.action.mjs
ADDED
|
@@ -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 };
|
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.cjs
ADDED
|
@@ -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;
|
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.d.ts
ADDED
|
@@ -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
|
+
}>;
|
package/build/actions/penilaian/getGradingComponentByType/getGradingComponentByType.schema.mjs
ADDED
|
@@ -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,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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const z = require('@neon.id/z');
|
|
4
|
+
|
|
5
|
+
const GetGradingStudentSchema = z.z.object({
|
|
6
|
+
studentId: z.z.string().explain({ label: "studentId" }),
|
|
7
|
+
gradingTypeId: z.z.string().explain({ label: "gradingTypeId" }),
|
|
8
|
+
branchId: z.z.string().explain({ label: "branchId" }),
|
|
9
|
+
limit: z.z.number().default(20).explain({ label: "Limit" }),
|
|
10
|
+
page: z.z.number().default(1).explain({ label: "Page" })
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.GetGradingStudentSchema = GetGradingStudentSchema;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from '@neon.id/z';
|
|
2
|
+
export declare const GetGradingStudentSchema: z.ZodObject<{
|
|
3
|
+
studentId: z.ZodString;
|
|
4
|
+
gradingTypeId: z.ZodString;
|
|
5
|
+
branchId: z.ZodString;
|
|
6
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
branchId: string;
|
|
10
|
+
studentId: string;
|
|
11
|
+
gradingTypeId: string;
|
|
12
|
+
limit: number;
|
|
13
|
+
page: number;
|
|
14
|
+
}, {
|
|
15
|
+
branchId: string;
|
|
16
|
+
studentId: string;
|
|
17
|
+
gradingTypeId: string;
|
|
18
|
+
limit?: number | undefined;
|
|
19
|
+
page?: number | undefined;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from '@neon.id/z';
|
|
2
|
+
|
|
3
|
+
const GetGradingStudentSchema = z.object({
|
|
4
|
+
studentId: z.string().explain({ label: "studentId" }),
|
|
5
|
+
gradingTypeId: z.string().explain({ label: "gradingTypeId" }),
|
|
6
|
+
branchId: z.string().explain({ label: "branchId" }),
|
|
7
|
+
limit: z.number().default(20).explain({ label: "Limit" }),
|
|
8
|
+
page: z.number().default(1).explain({ label: "Page" })
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { GetGradingStudentSchema };
|
|
@@ -0,0 +1,50 @@
|
|
|
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 getGradingTypeByYear_schema = require('./getGradingTypeByYear.schema.cjs');
|
|
7
|
+
const useTelemetry = require('../../../providers/useTelemetry.cjs');
|
|
8
|
+
const usePenilaian = require('../../../providers/penilaian/usePenilaian.cjs');
|
|
9
|
+
|
|
10
|
+
const getGradingTypeByYear = operation.Action.define({
|
|
11
|
+
key: "getGradingTypeByYear",
|
|
12
|
+
name: "Get Grading Type By Year",
|
|
13
|
+
type: "command",
|
|
14
|
+
category: "domain",
|
|
15
|
+
execute: async (input, stream) => {
|
|
16
|
+
utils.guard(stream, "streamRequired");
|
|
17
|
+
const { validate } = operation.useValidation(stream, getGradingTypeByYear_schema.GetGradingTypeByYearSchema);
|
|
18
|
+
const data = validate(input);
|
|
19
|
+
return useTelemetry.useTelemetry(stream, "getGradingTypeByYear", {
|
|
20
|
+
userId: stream?.context?.identitas?.userId,
|
|
21
|
+
data
|
|
22
|
+
}, async () => {
|
|
23
|
+
try {
|
|
24
|
+
const { getManyGradingTypes } = usePenilaian.usePenilaian(stream);
|
|
25
|
+
console.log("data", data);
|
|
26
|
+
utils.guard(data.year, "yearRequired");
|
|
27
|
+
const { items, meta } = await getManyGradingTypes(stream, data.year, data.limit, data.page);
|
|
28
|
+
return core.Result.ok({
|
|
29
|
+
state: "getGradingTypeByYearSuccess",
|
|
30
|
+
message: "getGradingTypeByYear has been sucessfully executed.",
|
|
31
|
+
data: {
|
|
32
|
+
gradingType: items,
|
|
33
|
+
meta
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error?.isFailure)
|
|
38
|
+
throw error;
|
|
39
|
+
console.error(error);
|
|
40
|
+
return core.Result.fail({
|
|
41
|
+
state: `getGradingTypeByYearFailed`,
|
|
42
|
+
message: `Failed to getGradingTypeByYear.`,
|
|
43
|
+
error: error?.toString()
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
exports.getGradingTypeByYear = getGradingTypeByYear;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '@neon.id/operation';
|
|
2
|
+
import type { z } from '@neon.id/z';
|
|
3
|
+
import { GetGradingTypeByYearSchema } from './getGradingTypeByYear.schema';
|
|
4
|
+
export type getGradingTypeByYearInput = z.parse<typeof GetGradingTypeByYearSchema>;
|
|
5
|
+
export interface getGradingTypeByYearOutput {
|
|
6
|
+
}
|
|
7
|
+
export interface getGradingTypeByYearMeta {
|
|
8
|
+
}
|
|
9
|
+
export declare const getGradingTypeByYear: Action<"getGradingTypeByYear", {
|
|
10
|
+
year: string;
|
|
11
|
+
limit: number;
|
|
12
|
+
page: number;
|
|
13
|
+
}, getGradingTypeByYearOutput, getGradingTypeByYearMeta>;
|
|
14
|
+
export type GetGradingTypeByYearAction = typeof getGradingTypeByYear;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Result } from '@neon.id/core';
|
|
2
|
+
import { Action, useValidation } from '@neon.id/operation';
|
|
3
|
+
import { guard } from '@neon.id/utils';
|
|
4
|
+
import { GetGradingTypeByYearSchema } from './getGradingTypeByYear.schema.mjs';
|
|
5
|
+
import { useTelemetry } from '../../../providers/useTelemetry.mjs';
|
|
6
|
+
import { usePenilaian } from '../../../providers/penilaian/usePenilaian.mjs';
|
|
7
|
+
|
|
8
|
+
const getGradingTypeByYear = Action.define({
|
|
9
|
+
key: "getGradingTypeByYear",
|
|
10
|
+
name: "Get Grading Type By Year",
|
|
11
|
+
type: "command",
|
|
12
|
+
category: "domain",
|
|
13
|
+
execute: async (input, stream) => {
|
|
14
|
+
guard(stream, "streamRequired");
|
|
15
|
+
const { validate } = useValidation(stream, GetGradingTypeByYearSchema);
|
|
16
|
+
const data = validate(input);
|
|
17
|
+
return useTelemetry(stream, "getGradingTypeByYear", {
|
|
18
|
+
userId: stream?.context?.identitas?.userId,
|
|
19
|
+
data
|
|
20
|
+
}, async () => {
|
|
21
|
+
try {
|
|
22
|
+
const { getManyGradingTypes } = usePenilaian(stream);
|
|
23
|
+
console.log("data", data);
|
|
24
|
+
guard(data.year, "yearRequired");
|
|
25
|
+
const { items, meta } = await getManyGradingTypes(stream, data.year, data.limit, data.page);
|
|
26
|
+
return Result.ok({
|
|
27
|
+
state: "getGradingTypeByYearSuccess",
|
|
28
|
+
message: "getGradingTypeByYear has been sucessfully executed.",
|
|
29
|
+
data: {
|
|
30
|
+
gradingType: items,
|
|
31
|
+
meta
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error?.isFailure)
|
|
36
|
+
throw error;
|
|
37
|
+
console.error(error);
|
|
38
|
+
return Result.fail({
|
|
39
|
+
state: `getGradingTypeByYearFailed`,
|
|
40
|
+
message: `Failed to getGradingTypeByYear.`,
|
|
41
|
+
error: error?.toString()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { getGradingTypeByYear };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const z = require('@neon.id/z');
|
|
4
|
+
|
|
5
|
+
const GetGradingTypeByYearSchema = z.z.object({
|
|
6
|
+
year: z.z.string().explain({ label: "Year" }),
|
|
7
|
+
limit: z.z.number().default(20).explain({ label: "Limit" }),
|
|
8
|
+
page: z.z.number().default(1).explain({ label: "Page" })
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.GetGradingTypeByYearSchema = GetGradingTypeByYearSchema;
|