From 3880cbd078743bba65e66fb0730e0c808bf8a5ba Mon Sep 17 00:00:00 2001 From: DucHuy2801 Date: Fri, 17 May 2024 22:05:44 +0700 Subject: [PATCH] delete cache when duplicateTour --- server/src/controllers/tour.controller.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/server/src/controllers/tour.controller.js b/server/src/controllers/tour.controller.js index 3b84b87..1e6ab57 100644 --- a/server/src/controllers/tour.controller.js +++ b/server/src/controllers/tour.controller.js @@ -18,16 +18,6 @@ const UserTour = require("../models/user_tour.model") const User = require("../models/user.model") const redis = require("redis") -const slugify = (text) => { - return text.toString().toLowerCase() - .replace(/\s+/g, '-') - .replace(/[^\w\-]+/g, '') - - .replace(/\-\-+/g, '-') - .replace(/^-+/, '') - .replace(/-+$/, ''); -}; - let redisClient; (async () => { redisClient = redis.createClient(); @@ -155,6 +145,8 @@ class TourController { try { const newTour = await duplicateTour(tour_id) if (!newTour) return res.status(400).json({ message: "Failed to copy tour!" }) + + redisClient.delete("waiting_tours") return res.status(201).json({ message: "Copy tour successfully!", data: newTour