Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

refactor(dashboard): remove hasUnIndexedLinks from getDashboardData response

daniel31x13f13c5e1cfc30
diff --git a/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts b/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts
index 94269f0f..3288dba6 100644
--- a/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts
+++ b/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts
@@ -1,42 +1,24 @@
import { prisma } from "@linkwarden/prisma";
import { Order } from "@linkwarden/types/global";
-import { MEILI_INDEX_VERSION } from "@linkwarden/lib/constants";
export default async function getDashboardData(userId: number) {
const order: Order = { id: "desc" };
- const [dashboardSections, numberOfPinnedLinks, hasUnIndexedLinks] =
- await Promise.all([
- prisma.dashboardSection.findMany({ where: { userId } }),
- prisma.link.count({
- where: {
- AND: [
- {
- collection: {
- OR: [{ ownerId: userId }, { members: { some: { userId } } }],
- },
- },
- { pinnedBy: { some: { id: userId } } },
- ],
- },
- }),
- prisma.link.findFirst({
- where: {
- AND: [
- {
- collection: {
- OR: [{ ownerId: userId }, { members: { some: { userId } } }],
- },
- },
- {
- NOT: {
- indexVersion: MEILI_INDEX_VERSION,
- },
+ const [dashboardSections, numberOfPinnedLinks] = await Promise.all([
+ prisma.dashboardSection.findMany({ where: { userId } }),
+ prisma.link.count({
+ where: {
+ AND: [
+ {
+ collection: {
+ OR: [{ ownerId: userId }, { members: { some: { userId } } }],
},
- ],
- },
- }),
- ]);
+ },
+ { pinnedBy: { some: { id: userId } } },
+ ],
+ },
+ }),
+ ]);
const viewPinned = dashboardSections.some(
(section) => section.type === "PINNED_LINKS"
@@ -50,7 +32,7 @@ export default async function getDashboardData(userId: number) {
if (!viewRecent && !viewPinned && collectionSections.length === 0) {
return {
- data: { links: [], numberOfPinnedLinks, hasUnIndexedLinks },
+ data: { links: [], numberOfPinnedLinks },
message: "Dashboard data fetched successfully.",
statusCode: 200,
success: true,
@@ -161,7 +143,6 @@ export default async function getDashboardData(userId: number) {
links: uniqueLinks,
collectionLinks,
numberOfPinnedLinks,
- hasUnIndexedLinks,
},
message: "Dashboard data fetched successfully.",
statusCode: 200,