Skip to content

Commit

Permalink
Merge pull request #142 from premieroctet/fix/already-used-bookmark
Browse files Browse the repository at this point in the history
Fix: Prisma query for unused bookmarks
  • Loading branch information
quentingrchr authored Oct 2, 2024
2 parents d406f97 + cbde0bf commit 7d61019
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/components/bookmark/BookmarkListDnd.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Draggable, Droppable } from 'react-beautiful-dnd';
import { BookmarkItem } from './BookmarkItem';
import { getTeamBySlug } from '@/services/database/team';
import { getDigest } from '@/services/database/digest';
import { TeamLinks } from '@/services/database/link';
import { getTeamBySlug } from '@/services/database/team';
import { Draggable, Droppable } from 'react-beautiful-dnd';
import { BookmarkItem } from './BookmarkItem';

export type BookmarkListDndProps = {
digest: NonNullable<Awaited<ReturnType<typeof getDigest>>>;
Expand All @@ -23,7 +23,7 @@ const BookmarkListDnd = ({ teamLinks, team, digest }: BookmarkListDndProps) => {
return (
<Draggable
key={teamLink.id}
draggableId={teamLink.bookmark[0].id}
draggableId={teamLink?.bookmark[0]?.id}
index={index}
>
{(provided) => (
Expand Down
14 changes: 5 additions & 9 deletions src/services/database/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export const getTeamLinks = async (
bookmark: {
some: {
teamId,
...(options.onlyNotInDigest && {
digestBlocks: {
none: {},
},
}),
},
...(options.onlyNotInDigest && {
every: {
digestBlocks: { none: {} },
},
}),
},
},
],
Expand Down Expand Up @@ -101,14 +101,10 @@ export const getTeamLinks = async (
},
where: {
teamId,
...(options.onlyNotInDigest && {
digestBlocks: { none: {} },
}),
},
},
},
});

return {
teamLinks,
linksCount,
Expand Down

0 comments on commit 7d61019

Please sign in to comment.