Archived
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.
kfet/sockets/listUser.js

17 lines
416 B
JavaScript

const models = require("../models");
module.exports = socket => {
return async data => {
let users = []
for (let u of await models.User.findAll({
where: {
username: {
[models.Sequelize.Op.like]: data + "%"
}
}
})) {
users.push(u.username);
}
socket.emit("list user", users);
}
}