fix: fix no workspace problem when fetch all monitor events

This commit is contained in:
moonrailgun 2023-11-09 14:56:24 +08:00
parent a20cd8dff9
commit b050a56d4a

View File

@ -355,11 +355,14 @@ export const monitorRouter = router({
) )
.output(z.array(monitorEventSchema)) .output(z.array(monitorEventSchema))
.query(async ({ input }) => { .query(async ({ input }) => {
const { monitorId } = input; const { workspaceId, monitorId } = input;
const list = await prisma.monitorEvent.findMany({ const list = await prisma.monitorEvent.findMany({
where: { where: {
monitorId, monitorId,
monitor: {
workspaceId: workspaceId,
},
}, },
orderBy: { orderBy: {
createdAt: 'desc', createdAt: 'desc',