@neutron.co.id/pendidikan-operation 1.4.0-beta.1 → 1.4.0-beta.3
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/index.cjs +239 -135
- package/build/index.d.ts +48 -2
- package/build/index.mjs +238 -136
- package/package.json +25 -24
package/build/index.cjs
CHANGED
|
@@ -4,7 +4,6 @@ const core = require('@neon.id/core');
|
|
|
4
4
|
const operation = require('@neon.id/operation');
|
|
5
5
|
const query = require('@neon.id/query');
|
|
6
6
|
const value = require('@neon.id/utils/value');
|
|
7
|
-
const nanoid = require('nanoid');
|
|
8
7
|
|
|
9
8
|
const setSomething = operation.Action.define({
|
|
10
9
|
key: "setSomething",
|
|
@@ -137,6 +136,97 @@ const syncCommitment = operation.Action.define({
|
|
|
137
136
|
}
|
|
138
137
|
});
|
|
139
138
|
|
|
139
|
+
const prepareConflict = operation.Action.define({
|
|
140
|
+
key: "prepareConflict",
|
|
141
|
+
name: "Prepare Conflict",
|
|
142
|
+
type: "command",
|
|
143
|
+
category: "domain",
|
|
144
|
+
execute: async ({ userId, startedAt, endedAt }, stream) => {
|
|
145
|
+
if (!userId)
|
|
146
|
+
throw core.Result.fail("userIdRequired");
|
|
147
|
+
if (!startedAt)
|
|
148
|
+
throw core.Result.fail("startedAtRequired");
|
|
149
|
+
if (!endedAt)
|
|
150
|
+
throw core.Result.fail("endedAtRequired");
|
|
151
|
+
const staff = await _getStaff(stream, userId);
|
|
152
|
+
if (!staff) {
|
|
153
|
+
return core.Result.ok({
|
|
154
|
+
state: "staffNotFound",
|
|
155
|
+
data: { id: void 0, sessionConflict: {} }
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const conflict = await _getSessionConflict(stream, {
|
|
159
|
+
userId,
|
|
160
|
+
startedAt,
|
|
161
|
+
endedAt,
|
|
162
|
+
staff
|
|
163
|
+
});
|
|
164
|
+
return core.Result.ok({
|
|
165
|
+
state: "success",
|
|
166
|
+
message: "Success get class conflict",
|
|
167
|
+
data: conflict
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
async function _getStaff(stream, userId) {
|
|
172
|
+
const result = await stream.actions.data.getMany.execute(
|
|
173
|
+
{
|
|
174
|
+
model: "neu:personalia:staff",
|
|
175
|
+
query: query.Query.define({
|
|
176
|
+
filter: {
|
|
177
|
+
userId
|
|
178
|
+
},
|
|
179
|
+
fields: {
|
|
180
|
+
id: 1,
|
|
181
|
+
branchIds: 1
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
},
|
|
185
|
+
stream
|
|
186
|
+
);
|
|
187
|
+
if (result.isFailure)
|
|
188
|
+
throw result;
|
|
189
|
+
return result.value[0];
|
|
190
|
+
}
|
|
191
|
+
async function _getSessionConflict(stream, input) {
|
|
192
|
+
const db = stream.core.dbs["neu-jadwal"];
|
|
193
|
+
const model = db.models["neu:jadwal:classSessionConflict"];
|
|
194
|
+
const item = await model.findOneAndUpdate(
|
|
195
|
+
{ userId: input.userId },
|
|
196
|
+
{
|
|
197
|
+
$set: {
|
|
198
|
+
userId: input.userId,
|
|
199
|
+
startedAt: input.startedAt,
|
|
200
|
+
endedAt: input.endedAt,
|
|
201
|
+
branchIds: input.staff.branchIds,
|
|
202
|
+
updatedAt: new Date(),
|
|
203
|
+
updatedBy: input.userId
|
|
204
|
+
},
|
|
205
|
+
$setOnInsert: {
|
|
206
|
+
createdAt: new Date(),
|
|
207
|
+
createdBy: input.userId
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{ upsert: true, new: true, lean: true }
|
|
211
|
+
);
|
|
212
|
+
const result = await stream.actions.data.syncOne.execute(
|
|
213
|
+
{
|
|
214
|
+
model: "neu:jadwal:classSessionConflict",
|
|
215
|
+
id: item._id,
|
|
216
|
+
query: query.Query.define({
|
|
217
|
+
fields: {
|
|
218
|
+
id: 1,
|
|
219
|
+
sessionConflict: 1
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
},
|
|
223
|
+
stream
|
|
224
|
+
);
|
|
225
|
+
if (result.isFailure)
|
|
226
|
+
throw result;
|
|
227
|
+
return result.value;
|
|
228
|
+
}
|
|
229
|
+
|
|
140
230
|
const generateGrading = operation.Action.define({
|
|
141
231
|
key: "generateGrading",
|
|
142
232
|
name: "Create Penilaian dan Score",
|
|
@@ -836,36 +926,25 @@ const acceptQuestion = operation.Action.define({
|
|
|
836
926
|
category: "domain",
|
|
837
927
|
execute: async (input, stream) => {
|
|
838
928
|
const dbs = stream.core.dbs;
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
await dbQuestion.updateOne(
|
|
859
|
-
{ _id: question._id },
|
|
860
|
-
{
|
|
861
|
-
$set: {
|
|
862
|
-
status: "answering",
|
|
863
|
-
teacherIds: pengajar.id,
|
|
864
|
-
acceptedAt: new Date()
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
);
|
|
868
|
-
}
|
|
929
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
930
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
931
|
+
await dbQuestion.updateOne(
|
|
932
|
+
{
|
|
933
|
+
_id: input.questionId
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
status: "answering"
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
await dbAnswer.updateOne(
|
|
940
|
+
{
|
|
941
|
+
_id: input.answerId
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
status: "answering",
|
|
945
|
+
acceptedAt: new Date()
|
|
946
|
+
}
|
|
947
|
+
);
|
|
869
948
|
return core.Result.ok({
|
|
870
949
|
state: "acceptQuestion",
|
|
871
950
|
message: "Pertanyaan berhasil diterima"
|
|
@@ -919,115 +998,136 @@ const sendAnswer = operation.Action.define({
|
|
|
919
998
|
category: "domain",
|
|
920
999
|
execute: async (input, stream) => {
|
|
921
1000
|
const dbs = stream.core.dbs;
|
|
922
|
-
const
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
name: 1
|
|
937
|
-
},
|
|
938
|
-
answeredDetail: 1,
|
|
939
|
-
answeredImages: 1,
|
|
940
|
-
finalAnswerId: 1,
|
|
941
|
-
updatedAt: 1,
|
|
942
|
-
updatedBy: 1,
|
|
943
|
-
answeredAt: 1
|
|
944
|
-
}
|
|
945
|
-
})
|
|
946
|
-
});
|
|
947
|
-
const question = questionResult.value;
|
|
948
|
-
const dbQuestion = dbs.tanya.models.Question;
|
|
949
|
-
const dbAnswer = dbs.tanya.models.Answer;
|
|
950
|
-
const dbTeacher = dbs.talenta.models.Teacher;
|
|
951
|
-
const userId = stream.context.identitas.userId;
|
|
952
|
-
const pengajar = await dbTeacher.findOne({
|
|
953
|
-
userId
|
|
954
|
-
});
|
|
955
|
-
const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
956
|
-
const id = nanoid.customAlphabet(alphabet, 10);
|
|
957
|
-
function getCode(prefix) {
|
|
958
|
-
if (!prefix)
|
|
959
|
-
return id();
|
|
960
|
-
return `${prefix}-${id()}`;
|
|
961
|
-
}
|
|
962
|
-
const codeGenerator = getCode();
|
|
963
|
-
if (!question.answeredAt && question.status == "answering") {
|
|
964
|
-
await dbAnswer.create({
|
|
965
|
-
code: codeGenerator,
|
|
966
|
-
detail: question.answeredDetail,
|
|
967
|
-
images: question.answeredImages,
|
|
968
|
-
questionDetail: question.detail,
|
|
969
|
-
questionImage: question.images,
|
|
970
|
-
teacherId: pengajar.id,
|
|
971
|
-
questionId: question._id,
|
|
972
|
-
studentQuestionerId: question.studentId,
|
|
973
|
-
acceptedAt: new Date(),
|
|
974
|
-
answeredAt: new Date(),
|
|
975
|
-
createdAt: new Date(),
|
|
976
|
-
updatedAt: new Date(),
|
|
977
|
-
createdBy: userId,
|
|
978
|
-
updatedBy: userId
|
|
979
|
-
});
|
|
980
|
-
const jawaban = await dbAnswer.findOne({ code: codeGenerator });
|
|
981
|
-
await dbQuestion.updateOne(
|
|
982
|
-
{ _id: question._id },
|
|
983
|
-
{
|
|
984
|
-
$set: {
|
|
985
|
-
totalQuestions: question.totalQuestions,
|
|
986
|
-
status: "answered",
|
|
987
|
-
type: question.type,
|
|
988
|
-
difficulty: question.difficulty,
|
|
989
|
-
subjectIds: question.subjects,
|
|
990
|
-
stageIds: question.stages,
|
|
991
|
-
topicIds: question.topics,
|
|
992
|
-
finalAnswerId: jawaban.id,
|
|
993
|
-
answeredAt: new Date(),
|
|
994
|
-
updatedAt: new Date(),
|
|
995
|
-
updatedBy: userId
|
|
1001
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
1002
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
1003
|
+
const resultAnswer = await stream.actions.data.getOne.execute(
|
|
1004
|
+
{
|
|
1005
|
+
model: "neu:tanya:answer",
|
|
1006
|
+
id: input.answerId,
|
|
1007
|
+
query: query.Query.define({
|
|
1008
|
+
fields: {
|
|
1009
|
+
id: 1,
|
|
1010
|
+
questionId: 1,
|
|
1011
|
+
teacher: { id: 1 },
|
|
1012
|
+
detail: 1,
|
|
1013
|
+
images: 1,
|
|
1014
|
+
acceptedAt: 1
|
|
996
1015
|
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1016
|
+
})
|
|
1017
|
+
},
|
|
1018
|
+
stream
|
|
1019
|
+
);
|
|
1020
|
+
const dataAnswer = resultAnswer.payload.data;
|
|
1021
|
+
console.log(dataAnswer);
|
|
1022
|
+
const acceptedAt = new Date(dataAnswer.acceptedAt).getTime();
|
|
1023
|
+
const answeredAt = new Date().getTime();
|
|
1024
|
+
const durationResult = (answeredAt - acceptedAt) / 1e3;
|
|
1025
|
+
await dbQuestion.updateOne(
|
|
1026
|
+
{
|
|
1027
|
+
_id: dataAnswer.questionId
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
status: "answered",
|
|
1031
|
+
teacherIds: dataAnswer.teacher.id,
|
|
1032
|
+
answeredDetail: dataAnswer.detail,
|
|
1033
|
+
answeredImages: dataAnswer.images
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
await dbAnswer.updateOne(
|
|
1037
|
+
{
|
|
1038
|
+
_id: dataAnswer.id
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
status: "answered",
|
|
1042
|
+
answeredAt: new Date(),
|
|
1043
|
+
duration: Math.round(durationResult)
|
|
1044
|
+
}
|
|
1045
|
+
);
|
|
1046
|
+
return core.Result.ok({
|
|
1047
|
+
state: "sendAnswer",
|
|
1048
|
+
message: "Jawaban berhasil dikirim"
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
const sendQuestion = operation.Action.define({
|
|
1054
|
+
key: "sendQuestion",
|
|
1055
|
+
name: "Send Question",
|
|
1056
|
+
type: "command",
|
|
1057
|
+
category: "domain",
|
|
1058
|
+
execute: async (input, stream) => {
|
|
1059
|
+
const dbs = stream.core.dbs;
|
|
1060
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
1061
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
1062
|
+
await dbQuestion.updateOne(
|
|
1063
|
+
{
|
|
1064
|
+
_id: input.questionId
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
status: "waiting",
|
|
1068
|
+
askedAt: new Date()
|
|
1069
|
+
}
|
|
1070
|
+
);
|
|
1071
|
+
const result = await stream.actions.data.getOne.execute(
|
|
1072
|
+
{
|
|
1073
|
+
model: "neu:tanya:question",
|
|
1074
|
+
id: input.questionId,
|
|
1075
|
+
query: query.Query.define({
|
|
1076
|
+
fields: {
|
|
1077
|
+
code: 1,
|
|
1078
|
+
studentId: 1,
|
|
1079
|
+
detail: 1,
|
|
1080
|
+
images: 1,
|
|
1081
|
+
askedAt: 1,
|
|
1082
|
+
subjectId: 1
|
|
1009
1083
|
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
updatedAt: new Date(),
|
|
1023
|
-
updatedBy: userId
|
|
1084
|
+
})
|
|
1085
|
+
},
|
|
1086
|
+
stream
|
|
1087
|
+
);
|
|
1088
|
+
const data = result.payload.data;
|
|
1089
|
+
const resultStudent = await stream.actions.data.getOne.execute(
|
|
1090
|
+
{
|
|
1091
|
+
model: "neu:akademik:student",
|
|
1092
|
+
id: data.studentId,
|
|
1093
|
+
query: query.Query.define({
|
|
1094
|
+
fields: {
|
|
1095
|
+
branchIds: 1
|
|
1024
1096
|
}
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1097
|
+
})
|
|
1098
|
+
},
|
|
1099
|
+
stream
|
|
1100
|
+
);
|
|
1101
|
+
if (data.images) {
|
|
1102
|
+
await dbAnswer.create({
|
|
1103
|
+
questionId: data.id,
|
|
1104
|
+
questionCode: data.code,
|
|
1105
|
+
status: "waiting",
|
|
1106
|
+
studentQuestionerId: data.studentId ? data.studentId : null,
|
|
1107
|
+
questionDetail: data.detail,
|
|
1108
|
+
questionImages: data.images,
|
|
1109
|
+
questionAskedAt: data.askedAt,
|
|
1110
|
+
subjectId: data.subjectId,
|
|
1111
|
+
studentBranchIds: resultStudent.payload.data.branchIds ? resultStudent.payload.data.branchIds : []
|
|
1112
|
+
});
|
|
1113
|
+
} else {
|
|
1114
|
+
await dbAnswer.create({
|
|
1115
|
+
questionId: data.id,
|
|
1116
|
+
questionCode: data.code,
|
|
1117
|
+
status: "waiting",
|
|
1118
|
+
studentQuestionerId: data.studentId ? data.studentId : null,
|
|
1119
|
+
questionDetail: data.detail,
|
|
1120
|
+
questionAskedAt: data.askedAt,
|
|
1121
|
+
subjectId: data.subjectId,
|
|
1122
|
+
studentBranchIds: resultStudent.payload.data.branchIds ? resultStudent.payload.data.branchIds : []
|
|
1123
|
+
});
|
|
1027
1124
|
}
|
|
1028
1125
|
return core.Result.ok({
|
|
1029
|
-
state: "
|
|
1030
|
-
message: "
|
|
1126
|
+
state: "questionSend",
|
|
1127
|
+
message: "Question has been send.",
|
|
1128
|
+
data: {
|
|
1129
|
+
code: 1
|
|
1130
|
+
}
|
|
1031
1131
|
});
|
|
1032
1132
|
}
|
|
1033
1133
|
});
|
|
@@ -1044,10 +1144,12 @@ const index = {
|
|
|
1044
1144
|
createGradingAndScores: createGradingAndScores,
|
|
1045
1145
|
editAnswer: editAnswer,
|
|
1046
1146
|
generateGrading: generateGrading,
|
|
1147
|
+
prepareConflict: prepareConflict,
|
|
1047
1148
|
presenceSessionStudent: presenceSessionStudent,
|
|
1048
1149
|
presenceSessionTeacher: presenceSessionTeacher,
|
|
1049
1150
|
rasionalizeGrading: rasionalizeGrading,
|
|
1050
1151
|
sendAnswer: sendAnswer,
|
|
1152
|
+
sendQuestion: sendQuestion,
|
|
1051
1153
|
setSomething: setSomething,
|
|
1052
1154
|
syncCommitment: syncCommitment,
|
|
1053
1155
|
updateGradingAndScores: updateGradingAndScores
|
|
@@ -1064,10 +1166,12 @@ exports.clearGrading = clearGrading;
|
|
|
1064
1166
|
exports.createGradingAndScores = createGradingAndScores;
|
|
1065
1167
|
exports.editAnswer = editAnswer;
|
|
1066
1168
|
exports.generateGrading = generateGrading;
|
|
1169
|
+
exports.prepareConflict = prepareConflict;
|
|
1067
1170
|
exports.presenceSessionStudent = presenceSessionStudent;
|
|
1068
1171
|
exports.presenceSessionTeacher = presenceSessionTeacher;
|
|
1069
1172
|
exports.rasionalizeGrading = rasionalizeGrading;
|
|
1070
1173
|
exports.sendAnswer = sendAnswer;
|
|
1174
|
+
exports.sendQuestion = sendQuestion;
|
|
1071
1175
|
exports.setSomething = setSomething;
|
|
1072
1176
|
exports.syncCommitment = syncCommitment;
|
|
1073
1177
|
exports.updateGradingAndScores = updateGradingAndScores;
|
package/build/index.d.ts
CHANGED
|
@@ -43,6 +43,20 @@ interface SyncCommitmentMeta {
|
|
|
43
43
|
declare const syncCommitment: Action<"syncCommitment", SyncCommitmentInput, SyncCommitmentOutput, SyncCommitmentMeta>;
|
|
44
44
|
type SyncCommitmentAction = typeof syncCommitment;
|
|
45
45
|
|
|
46
|
+
interface PrepareConflictInput {
|
|
47
|
+
userId: string;
|
|
48
|
+
startedAt: string;
|
|
49
|
+
endedAt: string;
|
|
50
|
+
}
|
|
51
|
+
interface PrepareConflictOutput {
|
|
52
|
+
id: string | undefined;
|
|
53
|
+
sessionConflict: any;
|
|
54
|
+
}
|
|
55
|
+
interface PrepareConflictMeta {
|
|
56
|
+
}
|
|
57
|
+
declare const prepareConflict: Action<"prepareConflict", PrepareConflictInput, PrepareConflictOutput, PrepareConflictMeta>;
|
|
58
|
+
type PrepareConflictAction = typeof prepareConflict;
|
|
59
|
+
|
|
46
60
|
interface CalculateGradingInput {
|
|
47
61
|
gradingInsertId: string;
|
|
48
62
|
gradingContextIds: string[];
|
|
@@ -161,6 +175,7 @@ type UpdateGradingAndScoresAction = typeof updateGradingAndScores;
|
|
|
161
175
|
|
|
162
176
|
interface AcceptQuestionInput {
|
|
163
177
|
questionId: string;
|
|
178
|
+
answerId: string;
|
|
164
179
|
}
|
|
165
180
|
interface AcceptQuestionOutput {
|
|
166
181
|
code: number;
|
|
@@ -182,7 +197,7 @@ declare const editAnswer: Action<"editAnswer", EditAnswerInput, EditAnswerOutput
|
|
|
182
197
|
type EditAnswerAction = typeof editAnswer;
|
|
183
198
|
|
|
184
199
|
interface SendAnswerInput {
|
|
185
|
-
|
|
200
|
+
answerId: string;
|
|
186
201
|
}
|
|
187
202
|
interface SendAnswerOutput {
|
|
188
203
|
code: number;
|
|
@@ -192,6 +207,17 @@ interface SendAnswerMeta {
|
|
|
192
207
|
declare const sendAnswer: Action<"sendAnswer", SendAnswerInput, SendAnswerOutput, SendAnswerMeta>;
|
|
193
208
|
type SendAnswerAction = typeof sendAnswer;
|
|
194
209
|
|
|
210
|
+
interface SendQuestionInput {
|
|
211
|
+
questionId: string;
|
|
212
|
+
}
|
|
213
|
+
interface SendQuestionOutput {
|
|
214
|
+
code: number;
|
|
215
|
+
}
|
|
216
|
+
interface SendQuestionMeta {
|
|
217
|
+
}
|
|
218
|
+
declare const sendQuestion: Action<"sendQuestion", SendQuestionInput, SendQuestionOutput, SendQuestionMeta>;
|
|
219
|
+
type SendQuestionAction = typeof sendQuestion;
|
|
220
|
+
|
|
195
221
|
type index_AcceptQuestionAction = AcceptQuestionAction;
|
|
196
222
|
type index_AcceptQuestionInput = AcceptQuestionInput;
|
|
197
223
|
type index_AcceptQuestionMeta = AcceptQuestionMeta;
|
|
@@ -230,6 +256,10 @@ type index_GenerateGradingMeta = GenerateGradingMeta;
|
|
|
230
256
|
type index_GenerateGradingOutput = GenerateGradingOutput;
|
|
231
257
|
type index_GradingComparator = GradingComparator;
|
|
232
258
|
type index_GradingComparatorComparison = GradingComparatorComparison;
|
|
259
|
+
type index_PrepareConflictAction = PrepareConflictAction;
|
|
260
|
+
type index_PrepareConflictInput = PrepareConflictInput;
|
|
261
|
+
type index_PrepareConflictMeta = PrepareConflictMeta;
|
|
262
|
+
type index_PrepareConflictOutput = PrepareConflictOutput;
|
|
233
263
|
type index_PresenceSessionStudentAction = PresenceSessionStudentAction;
|
|
234
264
|
type index_PresenceSessionStudentInput = PresenceSessionStudentInput;
|
|
235
265
|
type index_PresenceSessionStudentMeta = PresenceSessionStudentMeta;
|
|
@@ -246,6 +276,10 @@ type index_SendAnswerAction = SendAnswerAction;
|
|
|
246
276
|
type index_SendAnswerInput = SendAnswerInput;
|
|
247
277
|
type index_SendAnswerMeta = SendAnswerMeta;
|
|
248
278
|
type index_SendAnswerOutput = SendAnswerOutput;
|
|
279
|
+
type index_SendQuestionAction = SendQuestionAction;
|
|
280
|
+
type index_SendQuestionInput = SendQuestionInput;
|
|
281
|
+
type index_SendQuestionMeta = SendQuestionMeta;
|
|
282
|
+
type index_SendQuestionOutput = SendQuestionOutput;
|
|
249
283
|
type index_SetSomethingAction = SetSomethingAction;
|
|
250
284
|
type index_SetSomethingInput = SetSomethingInput;
|
|
251
285
|
type index_SetSomethingMeta = SetSomethingMeta;
|
|
@@ -268,10 +302,12 @@ declare const index_clearGrading: typeof clearGrading;
|
|
|
268
302
|
declare const index_createGradingAndScores: typeof createGradingAndScores;
|
|
269
303
|
declare const index_editAnswer: typeof editAnswer;
|
|
270
304
|
declare const index_generateGrading: typeof generateGrading;
|
|
305
|
+
declare const index_prepareConflict: typeof prepareConflict;
|
|
271
306
|
declare const index_presenceSessionStudent: typeof presenceSessionStudent;
|
|
272
307
|
declare const index_presenceSessionTeacher: typeof presenceSessionTeacher;
|
|
273
308
|
declare const index_rasionalizeGrading: typeof rasionalizeGrading;
|
|
274
309
|
declare const index_sendAnswer: typeof sendAnswer;
|
|
310
|
+
declare const index_sendQuestion: typeof sendQuestion;
|
|
275
311
|
declare const index_setSomething: typeof setSomething;
|
|
276
312
|
declare const index_syncCommitment: typeof syncCommitment;
|
|
277
313
|
declare const index_updateGradingAndScores: typeof updateGradingAndScores;
|
|
@@ -315,6 +351,10 @@ declare namespace index {
|
|
|
315
351
|
index_GenerateGradingOutput as GenerateGradingOutput,
|
|
316
352
|
index_GradingComparator as GradingComparator,
|
|
317
353
|
index_GradingComparatorComparison as GradingComparatorComparison,
|
|
354
|
+
index_PrepareConflictAction as PrepareConflictAction,
|
|
355
|
+
index_PrepareConflictInput as PrepareConflictInput,
|
|
356
|
+
index_PrepareConflictMeta as PrepareConflictMeta,
|
|
357
|
+
index_PrepareConflictOutput as PrepareConflictOutput,
|
|
318
358
|
index_PresenceSessionStudentAction as PresenceSessionStudentAction,
|
|
319
359
|
index_PresenceSessionStudentInput as PresenceSessionStudentInput,
|
|
320
360
|
index_PresenceSessionStudentMeta as PresenceSessionStudentMeta,
|
|
@@ -331,6 +371,10 @@ declare namespace index {
|
|
|
331
371
|
index_SendAnswerInput as SendAnswerInput,
|
|
332
372
|
index_SendAnswerMeta as SendAnswerMeta,
|
|
333
373
|
index_SendAnswerOutput as SendAnswerOutput,
|
|
374
|
+
index_SendQuestionAction as SendQuestionAction,
|
|
375
|
+
index_SendQuestionInput as SendQuestionInput,
|
|
376
|
+
index_SendQuestionMeta as SendQuestionMeta,
|
|
377
|
+
index_SendQuestionOutput as SendQuestionOutput,
|
|
334
378
|
index_SetSomethingAction as SetSomethingAction,
|
|
335
379
|
index_SetSomethingInput as SetSomethingInput,
|
|
336
380
|
index_SetSomethingMeta as SetSomethingMeta,
|
|
@@ -353,14 +397,16 @@ declare namespace index {
|
|
|
353
397
|
index_createGradingAndScores as createGradingAndScores,
|
|
354
398
|
index_editAnswer as editAnswer,
|
|
355
399
|
index_generateGrading as generateGrading,
|
|
400
|
+
index_prepareConflict as prepareConflict,
|
|
356
401
|
index_presenceSessionStudent as presenceSessionStudent,
|
|
357
402
|
index_presenceSessionTeacher as presenceSessionTeacher,
|
|
358
403
|
index_rasionalizeGrading as rasionalizeGrading,
|
|
359
404
|
index_sendAnswer as sendAnswer,
|
|
405
|
+
index_sendQuestion as sendQuestion,
|
|
360
406
|
index_setSomething as setSomething,
|
|
361
407
|
index_syncCommitment as syncCommitment,
|
|
362
408
|
index_updateGradingAndScores as updateGradingAndScores,
|
|
363
409
|
};
|
|
364
410
|
}
|
|
365
411
|
|
|
366
|
-
export { AcceptQuestionAction, AcceptQuestionInput, AcceptQuestionMeta, AcceptQuestionOutput, CalculateGradingAction, CalculateGradingInput, CalculateGradingMeta, CalculateGradingOutput, CalculateManyComparatorAction, CalculateManyComparatorInput, CalculateManyComparatorMeta, CalculateManyComparatorOutput, CalculateOneComparatorAction, CalculateOneComparatorInput, CalculateOneComparatorMeta, CalculateOneComparatorOutput, ClearAllOverridesAction, ClearAllOverridesInput, ClearAllOverridesMeta, ClearAllOverridesOutput, ClearGradingAction, ClearGradingInput, ClearGradingMeta, ClearGradingOutput, CreateGradingAndScoresAction, CreateGradingAndScoresInput, CreateGradingAndScoresMeta, CreateGradingAndScoresOutput, EditAnswerAction, EditAnswerInput, EditAnswerMeta, EditAnswerOutput, GenerateGradingAction, GenerateGradingInput, GenerateGradingMeta, GenerateGradingOutput, GradingComparator, GradingComparatorComparison, PresenceSessionStudentAction, PresenceSessionStudentInput, PresenceSessionStudentMeta, PresenceSessionStudentOutput, PresenceSessionTeacherAction, PresenceSessionTeacherInput, PresenceSessionTeacherMeta, PresenceSessionTeacherOutput, RasionalizeGradingAction, RasionalizeGradingInput, RasionalizeGradingMeta, RasionalizeGradingOutput, SendAnswerAction, SendAnswerInput, SendAnswerMeta, SendAnswerOutput, SetSomethingAction, SetSomethingInput, SetSomethingMeta, SetSomethingOutput, SyncCommitmentAction, SyncCommitmentInput, SyncCommitmentMeta, SyncCommitmentOutput, UpdateGradingAndScoresAction, UpdateGradingAndScoresInput, UpdateGradingAndScoresMeta, UpdateGradingAndScoresOutput, _calculateComparison, acceptQuestion, index as actions, calculateGrading, calculateManyComparator, calculateOneComparator, clearAllOverrides, clearGrading, createGradingAndScores, editAnswer, generateGrading, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, sendAnswer, setSomething, syncCommitment, updateGradingAndScores };
|
|
412
|
+
export { AcceptQuestionAction, AcceptQuestionInput, AcceptQuestionMeta, AcceptQuestionOutput, CalculateGradingAction, CalculateGradingInput, CalculateGradingMeta, CalculateGradingOutput, CalculateManyComparatorAction, CalculateManyComparatorInput, CalculateManyComparatorMeta, CalculateManyComparatorOutput, CalculateOneComparatorAction, CalculateOneComparatorInput, CalculateOneComparatorMeta, CalculateOneComparatorOutput, ClearAllOverridesAction, ClearAllOverridesInput, ClearAllOverridesMeta, ClearAllOverridesOutput, ClearGradingAction, ClearGradingInput, ClearGradingMeta, ClearGradingOutput, CreateGradingAndScoresAction, CreateGradingAndScoresInput, CreateGradingAndScoresMeta, CreateGradingAndScoresOutput, EditAnswerAction, EditAnswerInput, EditAnswerMeta, EditAnswerOutput, GenerateGradingAction, GenerateGradingInput, GenerateGradingMeta, GenerateGradingOutput, GradingComparator, GradingComparatorComparison, PrepareConflictAction, PrepareConflictInput, PrepareConflictMeta, PrepareConflictOutput, PresenceSessionStudentAction, PresenceSessionStudentInput, PresenceSessionStudentMeta, PresenceSessionStudentOutput, PresenceSessionTeacherAction, PresenceSessionTeacherInput, PresenceSessionTeacherMeta, PresenceSessionTeacherOutput, RasionalizeGradingAction, RasionalizeGradingInput, RasionalizeGradingMeta, RasionalizeGradingOutput, SendAnswerAction, SendAnswerInput, SendAnswerMeta, SendAnswerOutput, SendQuestionAction, SendQuestionInput, SendQuestionMeta, SendQuestionOutput, SetSomethingAction, SetSomethingInput, SetSomethingMeta, SetSomethingOutput, SyncCommitmentAction, SyncCommitmentInput, SyncCommitmentMeta, SyncCommitmentOutput, UpdateGradingAndScoresAction, UpdateGradingAndScoresInput, UpdateGradingAndScoresMeta, UpdateGradingAndScoresOutput, _calculateComparison, acceptQuestion, index as actions, calculateGrading, calculateManyComparator, calculateOneComparator, clearAllOverrides, clearGrading, createGradingAndScores, editAnswer, generateGrading, prepareConflict, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, sendAnswer, sendQuestion, setSomething, syncCommitment, updateGradingAndScores };
|
package/build/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { Result } from '@neon.id/core';
|
|
|
2
2
|
import { Action } from '@neon.id/operation';
|
|
3
3
|
import { Query } from '@neon.id/query';
|
|
4
4
|
import { ValueUtil } from '@neon.id/utils/value';
|
|
5
|
-
import { customAlphabet } from 'nanoid';
|
|
6
5
|
|
|
7
6
|
const setSomething = Action.define({
|
|
8
7
|
key: "setSomething",
|
|
@@ -135,6 +134,97 @@ const syncCommitment = Action.define({
|
|
|
135
134
|
}
|
|
136
135
|
});
|
|
137
136
|
|
|
137
|
+
const prepareConflict = Action.define({
|
|
138
|
+
key: "prepareConflict",
|
|
139
|
+
name: "Prepare Conflict",
|
|
140
|
+
type: "command",
|
|
141
|
+
category: "domain",
|
|
142
|
+
execute: async ({ userId, startedAt, endedAt }, stream) => {
|
|
143
|
+
if (!userId)
|
|
144
|
+
throw Result.fail("userIdRequired");
|
|
145
|
+
if (!startedAt)
|
|
146
|
+
throw Result.fail("startedAtRequired");
|
|
147
|
+
if (!endedAt)
|
|
148
|
+
throw Result.fail("endedAtRequired");
|
|
149
|
+
const staff = await _getStaff(stream, userId);
|
|
150
|
+
if (!staff) {
|
|
151
|
+
return Result.ok({
|
|
152
|
+
state: "staffNotFound",
|
|
153
|
+
data: { id: void 0, sessionConflict: {} }
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const conflict = await _getSessionConflict(stream, {
|
|
157
|
+
userId,
|
|
158
|
+
startedAt,
|
|
159
|
+
endedAt,
|
|
160
|
+
staff
|
|
161
|
+
});
|
|
162
|
+
return Result.ok({
|
|
163
|
+
state: "success",
|
|
164
|
+
message: "Success get class conflict",
|
|
165
|
+
data: conflict
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
async function _getStaff(stream, userId) {
|
|
170
|
+
const result = await stream.actions.data.getMany.execute(
|
|
171
|
+
{
|
|
172
|
+
model: "neu:personalia:staff",
|
|
173
|
+
query: Query.define({
|
|
174
|
+
filter: {
|
|
175
|
+
userId
|
|
176
|
+
},
|
|
177
|
+
fields: {
|
|
178
|
+
id: 1,
|
|
179
|
+
branchIds: 1
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
},
|
|
183
|
+
stream
|
|
184
|
+
);
|
|
185
|
+
if (result.isFailure)
|
|
186
|
+
throw result;
|
|
187
|
+
return result.value[0];
|
|
188
|
+
}
|
|
189
|
+
async function _getSessionConflict(stream, input) {
|
|
190
|
+
const db = stream.core.dbs["neu-jadwal"];
|
|
191
|
+
const model = db.models["neu:jadwal:classSessionConflict"];
|
|
192
|
+
const item = await model.findOneAndUpdate(
|
|
193
|
+
{ userId: input.userId },
|
|
194
|
+
{
|
|
195
|
+
$set: {
|
|
196
|
+
userId: input.userId,
|
|
197
|
+
startedAt: input.startedAt,
|
|
198
|
+
endedAt: input.endedAt,
|
|
199
|
+
branchIds: input.staff.branchIds,
|
|
200
|
+
updatedAt: new Date(),
|
|
201
|
+
updatedBy: input.userId
|
|
202
|
+
},
|
|
203
|
+
$setOnInsert: {
|
|
204
|
+
createdAt: new Date(),
|
|
205
|
+
createdBy: input.userId
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{ upsert: true, new: true, lean: true }
|
|
209
|
+
);
|
|
210
|
+
const result = await stream.actions.data.syncOne.execute(
|
|
211
|
+
{
|
|
212
|
+
model: "neu:jadwal:classSessionConflict",
|
|
213
|
+
id: item._id,
|
|
214
|
+
query: Query.define({
|
|
215
|
+
fields: {
|
|
216
|
+
id: 1,
|
|
217
|
+
sessionConflict: 1
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
},
|
|
221
|
+
stream
|
|
222
|
+
);
|
|
223
|
+
if (result.isFailure)
|
|
224
|
+
throw result;
|
|
225
|
+
return result.value;
|
|
226
|
+
}
|
|
227
|
+
|
|
138
228
|
const generateGrading = Action.define({
|
|
139
229
|
key: "generateGrading",
|
|
140
230
|
name: "Create Penilaian dan Score",
|
|
@@ -834,36 +924,25 @@ const acceptQuestion = Action.define({
|
|
|
834
924
|
category: "domain",
|
|
835
925
|
execute: async (input, stream) => {
|
|
836
926
|
const dbs = stream.core.dbs;
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
await dbQuestion.updateOne(
|
|
857
|
-
{ _id: question._id },
|
|
858
|
-
{
|
|
859
|
-
$set: {
|
|
860
|
-
status: "answering",
|
|
861
|
-
teacherIds: pengajar.id,
|
|
862
|
-
acceptedAt: new Date()
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
);
|
|
866
|
-
}
|
|
927
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
928
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
929
|
+
await dbQuestion.updateOne(
|
|
930
|
+
{
|
|
931
|
+
_id: input.questionId
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
status: "answering"
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
await dbAnswer.updateOne(
|
|
938
|
+
{
|
|
939
|
+
_id: input.answerId
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
status: "answering",
|
|
943
|
+
acceptedAt: new Date()
|
|
944
|
+
}
|
|
945
|
+
);
|
|
867
946
|
return Result.ok({
|
|
868
947
|
state: "acceptQuestion",
|
|
869
948
|
message: "Pertanyaan berhasil diterima"
|
|
@@ -917,115 +996,136 @@ const sendAnswer = Action.define({
|
|
|
917
996
|
category: "domain",
|
|
918
997
|
execute: async (input, stream) => {
|
|
919
998
|
const dbs = stream.core.dbs;
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
name: 1
|
|
935
|
-
},
|
|
936
|
-
answeredDetail: 1,
|
|
937
|
-
answeredImages: 1,
|
|
938
|
-
finalAnswerId: 1,
|
|
939
|
-
updatedAt: 1,
|
|
940
|
-
updatedBy: 1,
|
|
941
|
-
answeredAt: 1
|
|
942
|
-
}
|
|
943
|
-
})
|
|
944
|
-
});
|
|
945
|
-
const question = questionResult.value;
|
|
946
|
-
const dbQuestion = dbs.tanya.models.Question;
|
|
947
|
-
const dbAnswer = dbs.tanya.models.Answer;
|
|
948
|
-
const dbTeacher = dbs.talenta.models.Teacher;
|
|
949
|
-
const userId = stream.context.identitas.userId;
|
|
950
|
-
const pengajar = await dbTeacher.findOne({
|
|
951
|
-
userId
|
|
952
|
-
});
|
|
953
|
-
const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
954
|
-
const id = customAlphabet(alphabet, 10);
|
|
955
|
-
function getCode(prefix) {
|
|
956
|
-
if (!prefix)
|
|
957
|
-
return id();
|
|
958
|
-
return `${prefix}-${id()}`;
|
|
959
|
-
}
|
|
960
|
-
const codeGenerator = getCode();
|
|
961
|
-
if (!question.answeredAt && question.status == "answering") {
|
|
962
|
-
await dbAnswer.create({
|
|
963
|
-
code: codeGenerator,
|
|
964
|
-
detail: question.answeredDetail,
|
|
965
|
-
images: question.answeredImages,
|
|
966
|
-
questionDetail: question.detail,
|
|
967
|
-
questionImage: question.images,
|
|
968
|
-
teacherId: pengajar.id,
|
|
969
|
-
questionId: question._id,
|
|
970
|
-
studentQuestionerId: question.studentId,
|
|
971
|
-
acceptedAt: new Date(),
|
|
972
|
-
answeredAt: new Date(),
|
|
973
|
-
createdAt: new Date(),
|
|
974
|
-
updatedAt: new Date(),
|
|
975
|
-
createdBy: userId,
|
|
976
|
-
updatedBy: userId
|
|
977
|
-
});
|
|
978
|
-
const jawaban = await dbAnswer.findOne({ code: codeGenerator });
|
|
979
|
-
await dbQuestion.updateOne(
|
|
980
|
-
{ _id: question._id },
|
|
981
|
-
{
|
|
982
|
-
$set: {
|
|
983
|
-
totalQuestions: question.totalQuestions,
|
|
984
|
-
status: "answered",
|
|
985
|
-
type: question.type,
|
|
986
|
-
difficulty: question.difficulty,
|
|
987
|
-
subjectIds: question.subjects,
|
|
988
|
-
stageIds: question.stages,
|
|
989
|
-
topicIds: question.topics,
|
|
990
|
-
finalAnswerId: jawaban.id,
|
|
991
|
-
answeredAt: new Date(),
|
|
992
|
-
updatedAt: new Date(),
|
|
993
|
-
updatedBy: userId
|
|
999
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
1000
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
1001
|
+
const resultAnswer = await stream.actions.data.getOne.execute(
|
|
1002
|
+
{
|
|
1003
|
+
model: "neu:tanya:answer",
|
|
1004
|
+
id: input.answerId,
|
|
1005
|
+
query: Query.define({
|
|
1006
|
+
fields: {
|
|
1007
|
+
id: 1,
|
|
1008
|
+
questionId: 1,
|
|
1009
|
+
teacher: { id: 1 },
|
|
1010
|
+
detail: 1,
|
|
1011
|
+
images: 1,
|
|
1012
|
+
acceptedAt: 1
|
|
994
1013
|
}
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1014
|
+
})
|
|
1015
|
+
},
|
|
1016
|
+
stream
|
|
1017
|
+
);
|
|
1018
|
+
const dataAnswer = resultAnswer.payload.data;
|
|
1019
|
+
console.log(dataAnswer);
|
|
1020
|
+
const acceptedAt = new Date(dataAnswer.acceptedAt).getTime();
|
|
1021
|
+
const answeredAt = new Date().getTime();
|
|
1022
|
+
const durationResult = (answeredAt - acceptedAt) / 1e3;
|
|
1023
|
+
await dbQuestion.updateOne(
|
|
1024
|
+
{
|
|
1025
|
+
_id: dataAnswer.questionId
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
status: "answered",
|
|
1029
|
+
teacherIds: dataAnswer.teacher.id,
|
|
1030
|
+
answeredDetail: dataAnswer.detail,
|
|
1031
|
+
answeredImages: dataAnswer.images
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
await dbAnswer.updateOne(
|
|
1035
|
+
{
|
|
1036
|
+
_id: dataAnswer.id
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
status: "answered",
|
|
1040
|
+
answeredAt: new Date(),
|
|
1041
|
+
duration: Math.round(durationResult)
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
return Result.ok({
|
|
1045
|
+
state: "sendAnswer",
|
|
1046
|
+
message: "Jawaban berhasil dikirim"
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
const sendQuestion = Action.define({
|
|
1052
|
+
key: "sendQuestion",
|
|
1053
|
+
name: "Send Question",
|
|
1054
|
+
type: "command",
|
|
1055
|
+
category: "domain",
|
|
1056
|
+
execute: async (input, stream) => {
|
|
1057
|
+
const dbs = stream.core.dbs;
|
|
1058
|
+
const dbQuestion = dbs["neu-tanya"].models["neu:tanya:question"];
|
|
1059
|
+
const dbAnswer = dbs["neu-tanya"].models["neu:tanya:answer"];
|
|
1060
|
+
await dbQuestion.updateOne(
|
|
1061
|
+
{
|
|
1062
|
+
_id: input.questionId
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
status: "waiting",
|
|
1066
|
+
askedAt: new Date()
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1069
|
+
const result = await stream.actions.data.getOne.execute(
|
|
1070
|
+
{
|
|
1071
|
+
model: "neu:tanya:question",
|
|
1072
|
+
id: input.questionId,
|
|
1073
|
+
query: Query.define({
|
|
1074
|
+
fields: {
|
|
1075
|
+
code: 1,
|
|
1076
|
+
studentId: 1,
|
|
1077
|
+
detail: 1,
|
|
1078
|
+
images: 1,
|
|
1079
|
+
askedAt: 1,
|
|
1080
|
+
subjectId: 1
|
|
1007
1081
|
}
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
updatedAt: new Date(),
|
|
1021
|
-
updatedBy: userId
|
|
1082
|
+
})
|
|
1083
|
+
},
|
|
1084
|
+
stream
|
|
1085
|
+
);
|
|
1086
|
+
const data = result.payload.data;
|
|
1087
|
+
const resultStudent = await stream.actions.data.getOne.execute(
|
|
1088
|
+
{
|
|
1089
|
+
model: "neu:akademik:student",
|
|
1090
|
+
id: data.studentId,
|
|
1091
|
+
query: Query.define({
|
|
1092
|
+
fields: {
|
|
1093
|
+
branchIds: 1
|
|
1022
1094
|
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1095
|
+
})
|
|
1096
|
+
},
|
|
1097
|
+
stream
|
|
1098
|
+
);
|
|
1099
|
+
if (data.images) {
|
|
1100
|
+
await dbAnswer.create({
|
|
1101
|
+
questionId: data.id,
|
|
1102
|
+
questionCode: data.code,
|
|
1103
|
+
status: "waiting",
|
|
1104
|
+
studentQuestionerId: data.studentId ? data.studentId : null,
|
|
1105
|
+
questionDetail: data.detail,
|
|
1106
|
+
questionImages: data.images,
|
|
1107
|
+
questionAskedAt: data.askedAt,
|
|
1108
|
+
subjectId: data.subjectId,
|
|
1109
|
+
studentBranchIds: resultStudent.payload.data.branchIds ? resultStudent.payload.data.branchIds : []
|
|
1110
|
+
});
|
|
1111
|
+
} else {
|
|
1112
|
+
await dbAnswer.create({
|
|
1113
|
+
questionId: data.id,
|
|
1114
|
+
questionCode: data.code,
|
|
1115
|
+
status: "waiting",
|
|
1116
|
+
studentQuestionerId: data.studentId ? data.studentId : null,
|
|
1117
|
+
questionDetail: data.detail,
|
|
1118
|
+
questionAskedAt: data.askedAt,
|
|
1119
|
+
subjectId: data.subjectId,
|
|
1120
|
+
studentBranchIds: resultStudent.payload.data.branchIds ? resultStudent.payload.data.branchIds : []
|
|
1121
|
+
});
|
|
1025
1122
|
}
|
|
1026
1123
|
return Result.ok({
|
|
1027
|
-
state: "
|
|
1028
|
-
message: "
|
|
1124
|
+
state: "questionSend",
|
|
1125
|
+
message: "Question has been send.",
|
|
1126
|
+
data: {
|
|
1127
|
+
code: 1
|
|
1128
|
+
}
|
|
1029
1129
|
});
|
|
1030
1130
|
}
|
|
1031
1131
|
});
|
|
@@ -1042,13 +1142,15 @@ const index = {
|
|
|
1042
1142
|
createGradingAndScores: createGradingAndScores,
|
|
1043
1143
|
editAnswer: editAnswer,
|
|
1044
1144
|
generateGrading: generateGrading,
|
|
1145
|
+
prepareConflict: prepareConflict,
|
|
1045
1146
|
presenceSessionStudent: presenceSessionStudent,
|
|
1046
1147
|
presenceSessionTeacher: presenceSessionTeacher,
|
|
1047
1148
|
rasionalizeGrading: rasionalizeGrading,
|
|
1048
1149
|
sendAnswer: sendAnswer,
|
|
1150
|
+
sendQuestion: sendQuestion,
|
|
1049
1151
|
setSomething: setSomething,
|
|
1050
1152
|
syncCommitment: syncCommitment,
|
|
1051
1153
|
updateGradingAndScores: updateGradingAndScores
|
|
1052
1154
|
};
|
|
1053
1155
|
|
|
1054
|
-
export { _calculateComparison, acceptQuestion, index as actions, calculateGrading, calculateManyComparator, calculateOneComparator, clearAllOverrides, clearGrading, createGradingAndScores, editAnswer, generateGrading, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, sendAnswer, setSomething, syncCommitment, updateGradingAndScores };
|
|
1156
|
+
export { _calculateComparison, acceptQuestion, index as actions, calculateGrading, calculateManyComparator, calculateOneComparator, clearAllOverrides, clearGrading, createGradingAndScores, editAnswer, generateGrading, prepareConflict, presenceSessionStudent, presenceSessionTeacher, rasionalizeGrading, sendAnswer, sendQuestion, setSomething, syncCommitment, updateGradingAndScores };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neutron.co.id/pendidikan-operation",
|
|
3
|
-
"version": "1.4.0-beta.
|
|
3
|
+
"version": "1.4.0-beta.3",
|
|
4
4
|
"description": "Operation package of Neutron Pendidikan.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"contributors": [
|
|
@@ -29,52 +29,53 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bluelibs/nova": "1.4.2",
|
|
32
|
-
"@neon.id/core": "1.
|
|
32
|
+
"@neon.id/core": "1.25.0",
|
|
33
33
|
"@neon.id/gerbang-js": "0.6.2",
|
|
34
|
-
"@neon.id/model": "0.
|
|
35
|
-
"@neon.id/operation": "0.
|
|
36
|
-
"@neon.id/permit": "0.
|
|
37
|
-
"@neon.id/query": "0.
|
|
38
|
-
"@neon.id/types": "1.36.
|
|
39
|
-
"@neon.id/utils": "0.
|
|
34
|
+
"@neon.id/model": "0.56.3",
|
|
35
|
+
"@neon.id/operation": "0.32.1",
|
|
36
|
+
"@neon.id/permit": "0.16.0",
|
|
37
|
+
"@neon.id/query": "0.39.0",
|
|
38
|
+
"@neon.id/types": "1.36.3",
|
|
39
|
+
"@neon.id/utils": "0.36.0",
|
|
40
40
|
"@neutron.co.id/akademik-models": "1.2.0",
|
|
41
|
-
"@neutron.co.id/jadwal-models": "1.2.
|
|
41
|
+
"@neutron.co.id/jadwal-models": "1.2.1-beta.1",
|
|
42
42
|
"@neutron.co.id/penilaian-models": "1.4.0-beta.1",
|
|
43
|
-
"@neutron.co.id/
|
|
43
|
+
"@neutron.co.id/personalia-models": "1.1.0",
|
|
44
|
+
"@neutron.co.id/tanya-models": "1.1.1-beta.1",
|
|
44
45
|
"mongoose": "6.9.1",
|
|
45
46
|
"nanoid": "4.0.1",
|
|
46
47
|
"ofetch": "1.0.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@types/node": "18.
|
|
50
|
-
"@vitest/coverage-c8": "0.28.
|
|
51
|
-
"@vitest/ui": "0.28.
|
|
50
|
+
"@types/node": "18.13.0",
|
|
51
|
+
"@vitest/coverage-c8": "0.28.5",
|
|
52
|
+
"@vitest/ui": "0.28.5",
|
|
52
53
|
"@vortex.so/eslint-plugin": "0.7.0",
|
|
53
54
|
"tsx": "3.12.3",
|
|
54
55
|
"typescript": "4.9.5",
|
|
55
56
|
"unbuild": "1.1.1",
|
|
56
57
|
"vite": "4.1.1",
|
|
57
|
-
"vitest": "0.28.
|
|
58
|
+
"vitest": "0.28.5"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
60
61
|
"@bluelibs/nova": "1.4.2",
|
|
61
|
-
"@neon.id/core": "^1.
|
|
62
|
+
"@neon.id/core": "^1.25.0",
|
|
62
63
|
"@neon.id/gerbang-js": "^0.6.2",
|
|
63
|
-
"@neon.id/model": "^0.
|
|
64
|
-
"@neon.id/operation": "^0.
|
|
65
|
-
"@neon.id/permit": "^0.
|
|
66
|
-
"@neon.id/query": "^0.
|
|
67
|
-
"@neon.id/types": "^1.36.
|
|
68
|
-
"@neon.id/utils": "^0.
|
|
64
|
+
"@neon.id/model": "^0.56.3",
|
|
65
|
+
"@neon.id/operation": "^0.32.1",
|
|
66
|
+
"@neon.id/permit": "^0.16.0",
|
|
67
|
+
"@neon.id/query": "^0.39.0",
|
|
68
|
+
"@neon.id/types": "^1.36.3",
|
|
69
|
+
"@neon.id/utils": "^0.36.0",
|
|
69
70
|
"@neutron.co.id/akademik-models": "^1.2.0",
|
|
70
|
-
"@neutron.co.id/jadwal-models": "^1.2.
|
|
71
|
+
"@neutron.co.id/jadwal-models": "^1.2.1-beta.1",
|
|
71
72
|
"@neutron.co.id/penilaian-models": "^1.4.0-beta.1",
|
|
72
|
-
"@neutron.co.id/tanya-models": "^1.1.
|
|
73
|
+
"@neutron.co.id/tanya-models": "^1.1.1-beta.1",
|
|
73
74
|
"mongoose": "^6.9.1",
|
|
74
75
|
"ofetch": "^1.0.0"
|
|
75
76
|
},
|
|
76
77
|
"publishConfig": {
|
|
77
78
|
"access": "public"
|
|
78
79
|
},
|
|
79
|
-
"build":
|
|
80
|
+
"build": 18
|
|
80
81
|
}
|