feat: add posts

This commit is contained in:
Andrea
2023-03-01 20:39:41 +01:00
parent 18e1c1e2e6
commit 806ef1ec90
18 changed files with 3810 additions and 858 deletions

View File

@@ -0,0 +1,23 @@
import { db } from "~/utils/db.server";
export const findPosts = async () => {
return db.post.findMany({
select: {
id: true,
title: true,
description: true,
createdAt: true,
},
orderBy: {
createdAt: "desc",
},
});
};
export const findPost = async (id: string) => {
return db.post.findUnique({
where: {
id,
},
});
};