Skip to content

Commit

Permalink
Merge pull request #562 from OneCommunityGlobal/Roberto_Fix_Badge_App…
Browse files Browse the repository at this point in the history
…earance_Delay

Roberto-Fixes assign badge delay
  • Loading branch information
one-community authored Nov 10, 2023
2 parents d8a2a11 + 3d56ee0 commit 8c9eaf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/controllers/badgeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const mongoose = require('mongoose');
const UserProfile = require('../models/userProfile');
const { hasPermission } = require('../utilities/permissions');
const escapeRegex = require('../utilities/escapeRegex');
const cache = require('../utilities/nodeCache')();

const badgeController = function (Badge) {
const getAllBadges = async function (req, res) {
Expand Down Expand Up @@ -47,6 +48,8 @@ const badgeController = function (Badge) {
if (result) {
record.badgeCollection = req.body.badgeCollection;

if (cache.hasCache(`user-${userToBeAssigned}`)) cache.removeCache(`user-${userToBeAssigned}`);

record.save()
.then(results => res.status(201).send(results._id))
.catch(errors => res.status(500).send(errors));
Expand Down

0 comments on commit 8c9eaf0

Please sign in to comment.