Skip to content

Commit

Permalink
Refactor getListings function to use Prisma model and add type annota…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
GithmiHashara committed Sep 22, 2024
1 parent 76ce061 commit a839e7a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/actions/getListings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import prisma from "@/app/libs/prismadb";

// types.ts
export interface Listing {
id: string;
createdAt: Date;
// Add other fields you expect from the listing
}


export interface IListingsParams {
userId?: string;
guestCount?: number;
Expand Down Expand Up @@ -84,7 +92,7 @@ export default async function getListings(
}
});

const safeListings = listings.map((listing) => ({
const safeListings = listings.map((listing: Listing) => ({
...listing,
createdAt: listing.createdAt.toISOString(),
}));
Expand Down

0 comments on commit a839e7a

Please sign in to comment.