const models = require("../../models"); module.exports = socket => { return async (data) => { let options = {where: {}, include: []}; if (data.name) options.where.name = data.name; if (data.year) options.where.year = data.year; if (data.groups) options.include.push({model: models.Group, require: true}); socket.emit("semesterGet", await models.Semester.findAll(options)); } };