0.3.22 • Published 1 year ago
@sobtid/fastify-exambank v0.3.22
fastify-exambank
Exam bank service
Usage
const fastify = require('fastify')()
fastify.register(require('@sobtid/fastify-exambank'), {
hostUrl: // exanbank.hosturl,
appId: // exanbank.appid
})
fastify.post('/grades', (req, reply) => {
// some code api
const grades = fastify.exambank.getGrades()
reply.send(grades)
})
fastify.listen(3000, err => {
if (err) throw err
})Data Source
Exam
{
"id": String,
"applicationId": String,
"gradeId": String,
"subjectId": String,
"classId": String,
"subClassId": Array<String>,
"questions": Array<Question>,
"categories": Array<{
"id": String,
"name": String,
"amount": Number,
"gradeId": String,
"classId": String,
"subjectId": String,
"isActive": Boolean,
"createdAt": Timestamp
}>,
"publisher": Object<{
"id": String,
"name": String,
"logo": String<URL>
"createdAt": Timestamp
}>
"name": String,
"createdBy": Object<{
"id": String,
"displayName": String
}>,
"totalScore": Number,
"isActive": Boolean,
"tesingTime": Number,
"testingLimit": Number,
"testingDurationEnable": Boolean,
"testingDuration": Object<{
"start": Timestamp,
"end": Timestamp
}>,
"displaySolution": Object<{
"score": Boolean,
"answer": Boolean
}>,
"shuffling": Object<{
"question": Boolean,
"answer": Boolean
}>,
"createdAt": Timestamp,
"updatedAt": Timestamp
}Video
{
"id": String,
"name": String,
"publisherId": Object<{
"id": String,
"name": String,
"logo": String<URL>
}>,
"gradeId": Object<{
"id": String,
"name": String
}>,
"subjectId": Object<{
"id": String,
"name": String
}>,
"classId": Object<{
"id": String,
"name": String
}>,
"subClassId": Object<{
"id": String,
"name": String
}>,
"previewImage": Object<{
"smallSize": String,
"largeSize": String
}>,
"file": Object<{
"md": String,
"hls": String,
"hd": String
}>,
"createdBy": String
}API List
List grade
fastify.exambank.getGrades()List subject
fastify.exambank.getSubjects(params)params = {
gradeId: String
}List class
fastify.exambank.getClass(params) params = {
subjectId: String
}List subclass
fastify.exambank.getSubClass(params)params = {
"gradeId": String,
"subjectId": String,
"classId": String
}Update subclass
fastify.exambank.updateSubClass(subclassId, data)subclassId: String
data = {
"name": String,
"isActive": Boolean
}List Publisher
fastify.exambank.getPublishers()Create Publisher
fastify.exambank.createPublisher(params)params = {
"name": String,
"logo": String // Base64 encode
}Update Publisher
fastify.exambank.updatePublisher(publisherId, params)publisherId: String
params = {
"name": String,
"logo": String // Base64 encode
}Delate Publisher
fastify.exambank.removePublisher(publisherId)publisherId: StringList Exam
fastify.exambank.getExams(params)// Optional
params = {
"gradeId": String,
"subjectId": String,
"classId": String,
"publisherId": String,
"createdBy": String,
"id": [String] // List examId
}Exam detail
fastify.exambank.getExamDetail(examId)examId: StringUpdate Exam Stat
fastify.exambank.sendExamTestingStats(examId, totalScore, testingStatsData)examId: String
totalScore: Number // total score of user got from testing
testingStatsData: [
{
"type": 'MC',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [String] // Array of choice id
},
{
"type": 'ST',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": String
},
{
"type": 'MA',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String, // Left choice id
"match": String // Right choice id
}
]
},
{
"type": 'SQMC',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String,
"answer": [String] // Array of choice id
}
]
},
{
"type": 'SQST',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String,
"answer": String
}
]
}
]Update Questions Stat
fastify.exambank.sendQuestionTestingStats(params)params: [
{
"type": 'MC',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [String] // Array of choice id
},
{
"type": 'ST',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": String
},
{
"type": 'MA',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String, // Left choice id
"match": String // Right choice id
}
]
},
{
"type": 'SQMC',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String,
"answer": [String] // Array of choice id
}
]
},
{
"type": 'SQST',
"questionId": String,
"isCorrect": Boolean,
"timeUsed": Number,
"answer": [
{
"id": String,
"answer": String
}
]
}
]Create user
fastify.exambank.createUser(params)// Optiona
params = {
"displayName": String,
"email": String,
"password": String,
"role": String,
"avatar": String, // Base64 encode
"publisherId": String
}Update user
fastify.exambank.editUser(userId, params)// Optional
userId: String
params = {
"displayName": String,
"email": String,
"password": {
"old": String,
"new": String
},
"avatar": String, // Base64 encode
"publisherId": String
}Question detail
fastify.exambank.getQuestionDetail(questionId)questionId: StringTotal question by type
fastify.exambank.getQuestionStats(type)type: Enum { grade, type, status }List random question
fastify.exambank.randomQuestions(params)// Optional
params = {
"gradeId": String,
"subjectId": String,
"classId": String,
"subClassIds": String,
"limit": Number
}List Bundle
fastify.exambank.getBundles(params)// Optional
params = {
"level": String,
"gradeId": String,
"subjectId": String,
"id": [String] // List bundleId
}Bundle detail
fastify.exambank.getBundleDetail(bundleId)bundleId: StringBundle relate
fastify.exambank.getBundleRelate(bundleId)bundleId: StringList of video
fastify.exambank.getVideos(params)// Optional
params = {
"gradeId": String,
"subjectId": String,
"classId": String,
"publisherId: String",
"createdBy": String
}0.3.22
1 year ago
0.3.20
1 year ago
0.3.21
1 year ago
0.3.19
2 years ago
0.3.18
2 years ago
0.3.17
2 years ago
0.3.8
2 years ago
0.3.7
2 years ago
0.3.9
2 years ago
0.3.16
2 years ago
0.3.15
2 years ago
0.3.14
2 years ago
0.3.13
2 years ago
0.3.12
2 years ago
0.3.11
2 years ago
0.3.10
2 years ago
0.3.6
3 years ago
0.3.5
3 years ago
0.3.2
3 years ago
0.3.4
3 years ago
0.3.3
3 years ago
0.3.1
3 years ago
0.3.0
4 years ago
0.2.0
4 years ago
0.1.2
4 years ago
0.1.0
5 years ago
0.1.1
5 years ago
0.0.26
5 years ago
0.0.25
5 years ago
0.0.24
5 years ago
0.0.23
5 years ago
0.0.22
5 years ago
0.0.21
5 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.16
5 years ago
0.0.15
5 years ago
0.0.14
5 years ago
0.0.13
5 years ago
0.0.10
5 years ago
0.0.11
5 years ago
0.0.12
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago