Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ocitocit committed Oct 16, 2023
1 parent 4c9e472 commit 984d7f9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion actions/getListings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import prisma from '@/libs/prismadb';

export default async function getListings() {
export interface IListingParams{
userId?:string
}

export default async function getListings(
params:IListingParams
) {

const {userId}= params

let query:any={}

if (userId){
query.userId=userId
}

try {
const listings = await prisma.listing.findMany({
where:query,
orderBy: {
createdAt: 'desc'
}
Expand Down

0 comments on commit 984d7f9

Please sign in to comment.