text: const {Student, Class, Teacher} = require('../models/models');
  const ApiError = require('../error/ApiError');
  
  class TeacherController {
      async getAll(req, res) {
          const teachers = await Teacher.findAll();
          return res.json(teachers);
      }
  
      async getStudents(req, res) {
          const {teacherEmail} = req.params;
          const students = await Student.findAll({
              where: {
                  'idstudent': [{
                      model: Class,
                      where: { 'teacherEmail': teacherEmail }
                  }]
              },
              attributes: ['email', 'test_score', 'max_percent', 'min_percent', 'middle_percent'],
              include: {
                  model: Test_List,
                  attributes: ['id', 'scores', 'dates', 'scores', 'answers', 'testId'],
                  required: true
              }
          });
          return res.json(students);
      }
  }
  
  module.exports = new TeacherController();
  