feat: add feed channel count

This commit is contained in:
moonrailgun 2024-06-27 20:34:01 +08:00
parent 926ea980ff
commit a7688f02af
2 changed files with 36 additions and 28 deletions

View File

@ -106,7 +106,7 @@ export const DesktopLayout: React.FC<LayoutProps> = React.memo((props) => {
},
{
title: t('Feed'),
label: '',
label: String(serviceCount?.feed ?? ''),
icon: LuActivitySquare,
to: '/feed',
},

View File

@ -51,38 +51,45 @@ export const workspaceRouter = router({
telemetry: z.number(),
page: z.number(),
survey: z.number(),
feed: z.number(),
})
)
.query(async ({ input }) => {
const { workspaceId } = input;
const [website, monitor, telemetry, page, survey] = await Promise.all([
prisma.website.count({
where: {
workspaceId,
},
}),
prisma.monitor.count({
where: {
workspaceId,
},
}),
prisma.telemetry.count({
where: {
workspaceId,
},
}),
prisma.monitorStatusPage.count({
where: {
workspaceId,
},
}),
prisma.survey.count({
where: {
workspaceId,
},
}),
]);
const [website, monitor, telemetry, page, survey, feed] =
await Promise.all([
prisma.website.count({
where: {
workspaceId,
},
}),
prisma.monitor.count({
where: {
workspaceId,
},
}),
prisma.telemetry.count({
where: {
workspaceId,
},
}),
prisma.monitorStatusPage.count({
where: {
workspaceId,
},
}),
prisma.survey.count({
where: {
workspaceId,
},
}),
prisma.feedChannel.count({
where: {
workspaceId,
},
}),
]);
const server = getServerCount(workspaceId);
@ -93,6 +100,7 @@ export const workspaceRouter = router({
telemetry,
page,
survey,
feed,
};
}),
updateDashboardOrder: workspaceOwnerProcedure