added auto disconnect when changing link
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { Prisma, prisma } from "@repo/db";
|
||||
import { Router } from "express";
|
||||
import { pubClient } from "modules/redis";
|
||||
|
||||
@@ -14,4 +14,18 @@ router.get("/", async (req, res) => {
|
||||
res.json(user);
|
||||
});
|
||||
|
||||
router.patch("/:id", async (req, res) => {
|
||||
const { id } = req.params;
|
||||
const disaptcherUpdate = req.body as Prisma.ConnectedDispatcherUpdateInput;
|
||||
|
||||
const newDispatcher = await prisma.connectedDispatcher.update({
|
||||
where: { id: Number(id) },
|
||||
data: {
|
||||
...disaptcherUpdate,
|
||||
},
|
||||
});
|
||||
|
||||
res.json(newDispatcher);
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user