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/userGet.js

18 lines
533 B
JavaScript
Raw Normal View History

2020-11-24 08:47:13 +01:00
const models = require("../../models");
module.exports = socket => {
return async (data) => {
let options = {where: {}};
if (data.email)
options.where.email = data.email;
if (data.firstName && data.lastName) {
options.where.firstName = data.firstName;
options.where.lastName = data.lastName;
}
if (data.permissions)
options.where.permissions = data.permissions;
socket.emit("userGet", await models.User.findAll(options));
}
};