diff --git a/src/api/controller/blog/commentBlog.ts b/src/api/controller/blog/commentBlog.ts index f1afa02..82a7a89 100644 --- a/src/api/controller/blog/commentBlog.ts +++ b/src/api/controller/blog/commentBlog.ts @@ -4,6 +4,7 @@ import { BadRequestException } from "@constants/exceptions"; import { rateLimit } from "elysia-rate-limit"; import { createElysia } from "@libs/elysia"; import blogModel from "@models/blog.model"; +import { redis } from "@libs/redisClient"; export default createElysia() .use(blogModel) @@ -26,6 +27,8 @@ export default createElysia() throw new BadRequestException("Blog not found."); } + await redis.del(`blog.${blog.slug}`); + return { status: 200, data: await prismaClient.blogComment.create({ diff --git a/src/api/controller/blog/reactionBlog.ts b/src/api/controller/blog/reactionBlog.ts index a13f36d..70e1bc2 100644 --- a/src/api/controller/blog/reactionBlog.ts +++ b/src/api/controller/blog/reactionBlog.ts @@ -3,6 +3,7 @@ import { prismaClient } from "@libs/prismaDatabase"; import { BadRequestException } from "@constants/exceptions"; import { createElysia } from "@libs/elysia"; import blogModel from "@models/blog.model"; +import { redis } from "@libs/redisClient"; export default createElysia() .use(blogModel) @@ -20,6 +21,8 @@ export default createElysia() throw new BadRequestException("Blog not found."); } + await redis.del(`blog.${blog.slug}`); + const existingReaction = await prismaClient.blogReaction.findFirst({ where: { blogId: blog.id,