Skip to content

Commit

Permalink
feature: Change archived meaning to only mean removed from homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Apr 5, 2024
1 parent 91b088d commit a81c394
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 16 deletions.
1 change: 0 additions & 1 deletion apps/mobile/app/dashboard/favourites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default function Favourites() {
<CustomSafeAreaView>
<UpdatingBookmarkList
query={{
archived: false,
favourited: true,
}}
header={<PageTitle title="⭐️ Favourites" />}
Expand Down
1 change: 0 additions & 1 deletion apps/mobile/app/dashboard/lists/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default function ListView() {
<View>
<UpdatingBookmarkList
query={{
archived: false,
listId: list.id,
}}
header={<PageTitle title={`${list.icon} ${list.name}`} />}
Expand Down
1 change: 0 additions & 1 deletion apps/mobile/app/dashboard/tags/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default function TagView() {
<View>
<UpdatingBookmarkList
query={{
archived: false,
tagId: tag.id,
}}
header={<PageTitle title={tag.name} />}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard/favourites/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default async function FavouritesBookmarkPage() {
return (
<Bookmarks
header={<p className="text-2xl">⭐️ Favourites</p>}
query={{ favourited: true, archived: false }}
query={{ favourited: true }}
showDivider={true}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard/lists/[listId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function ListPage({
return (
<BookmarkListContextProvider listId={list.id}>
<Bookmarks
query={{ listId: list.id, archived: false }}
query={{ listId: list.id }}
showDivider={true}
header={
<div className="flex justify-between">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/dashboard/tags/[tagName]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function TagPage({
<DeleteTagButton tagName={tag.name} tagId={tag.id} />
</div>
}
query={{ archived: false, tagId: tag.id }}
query={{ tagId: tag.id }}
/>
);
}
12 changes: 2 additions & 10 deletions packages/trpc/routers/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { experimental_trpcMiddleware, TRPCError } from "@trpc/server";
import { and, count, eq } from "drizzle-orm";
import { z } from "zod";

import { bookmarks, bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema";
import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema";

import type { Context } from "../index";
import type { ZAttachedByEnum } from "../types/tags";
Expand Down Expand Up @@ -88,12 +88,10 @@ export const tagsAppRouter = router({
})
.from(bookmarkTags)
.leftJoin(tagsOnBookmarks, eq(bookmarkTags.id, tagsOnBookmarks.tagId))
.leftJoin(bookmarks, eq(tagsOnBookmarks.bookmarkId, bookmarks.id))
.where(
and(
conditionFromInput(input, ctx.user.id),
eq(bookmarkTags.userId, ctx.user.id),
eq(bookmarks.archived, false),
),
);

Expand Down Expand Up @@ -161,13 +159,7 @@ export const tagsAppRouter = router({
.from(tagsOnBookmarks)
.groupBy(tagsOnBookmarks.tagId, tagsOnBookmarks.attachedBy)
.innerJoin(bookmarkTags, eq(bookmarkTags.id, tagsOnBookmarks.tagId))
.leftJoin(bookmarks, eq(tagsOnBookmarks.bookmarkId, bookmarks.id))
.where(
and(
eq(bookmarkTags.userId, ctx.user.id),
eq(bookmarks.archived, false),
),
);
.where(eq(bookmarkTags.userId, ctx.user.id));

const tags = res.reduce<Record<string, z.infer<typeof zTagSchema>>>(
(acc, row) => {
Expand Down

0 comments on commit a81c394

Please sign in to comment.