Updated userSchema to store flair by reference
This commit is contained in:
parent
108290de2d
commit
279640a7e7
7 changed files with 73 additions and 54 deletions
|
|
@ -58,13 +58,12 @@ module.exports = class{
|
|||
if(userDB){
|
||||
try{
|
||||
//We can take this data raw since our schema checks it against existing flairs, and mongoose sanatizes queries
|
||||
userDB.flair = data.flair;
|
||||
userDB = await userDB.save();
|
||||
const flairDB = await userDB.setFlair(data.flair);
|
||||
|
||||
const connections = this.server.getConnections(socket.user.user);
|
||||
|
||||
connections.forEach((conn) => {
|
||||
conn.updateFlair(userDB.flair);
|
||||
conn.updateFlair(flairDB.name);
|
||||
});
|
||||
}catch(err){
|
||||
return loggerUtils.socketExceptionHandler(socket, err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue