const getUser = require('./getUser/index')
const createUser = require('./createUser/index')
const questionBank = require('./questionBank/index')
const createQuestionRecord = require('./createQuestionRecord/index')
const getQuestionRecord = require('./getQuestionRecord/index')

const { init } = require("./config/database")

// 云函数入口函数
exports.main = async (event, context) => {
  await init();
  switch (event.type) {
    case 'getUser':
      // 获取用户信息
      return await getUser.main(event, context)
    case 'createUser':
      // 生成用户信息
      return await createUser.main(event, context)
    case 'questionBankList':
      // 获得题库
      return await questionBank.main(event, context)
    case 'createQuestionRecord':
      return await createQuestionRecord.main(event, context)
    case 'getQuestionRecord':
      return await getQuestionRecord.main(event, context)
  }
}
