1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
letu/sockets/get/semesterGet.js

16 lines
464 B
JavaScript
Raw Permalink Normal View History

2020-11-24 08:47:13 +01:00
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));
}
};