Skip to content

Commit

Permalink
Refactor getFavoriteListings to use Prisma model and add type annotat…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
GithmiHashara committed Sep 17, 2024
1 parent a30e63d commit 810febf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/actions/getFavoriteListings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
// app/actions/getFavoriteListings.ts



import prisma from '@/app/libs/prismadb'
import getCurrentUser from './getCurrentUser'
import { Listing } from '@prisma/client' // Import the Listing type
// import { Prisma } from '@prisma/client'
import { Prisma } from '@/prisma/generated/client'

export default async function getFavoriteListings() {
try {
Expand All @@ -80,7 +80,7 @@ export default async function getFavoriteListings() {
}

// Fetch listings that match the user's favorite IDs
const favorites: Listing[] = await prisma.listing.findMany({
const favorites: Prisma.ListingGetPayload<{}>[] = await prisma.listing.findMany({
where: {
id: {
in: [...(currentUser.favoriteIds || [])]
Expand Down

0 comments on commit 810febf

Please sign in to comment.