0.3.19 • Published 14 days ago

@sobtid/fastify-exambank v0.3.19

Weekly downloads
26
License
MIT
Repository
github
Last release
14 days ago

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: String

List 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: String

Update 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: String

Total 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: String

Bundle relate

fastify.exambank.getBundleRelate(bundleId)
bundleId: String

List of video

fastify.exambank.getVideos(params)
// Optional

params = {
  "gradeId": String,
  "subjectId": String,
  "classId": String,
  "publisherId: String",
  "createdBy": String
}
0.3.19

14 days ago

0.3.18

2 months ago

0.3.17

3 months ago

0.3.8

7 months ago

0.3.7

7 months ago

0.3.9

7 months ago

0.3.16

6 months ago

0.3.15

6 months ago

0.3.14

6 months ago

0.3.13

7 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.2

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.1

2 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago