chore: update post model
This commit is contained in:
parent
5d870a2e4a
commit
bd16bc4fcf
@ -2,6 +2,9 @@ import { db } from "~/utils/db.server";
|
|||||||
|
|
||||||
export const findPosts = async () => {
|
export const findPosts = async () => {
|
||||||
return db.post.findMany({
|
return db.post.findMany({
|
||||||
|
where: {
|
||||||
|
isPublic: true,
|
||||||
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
title: true,
|
title: true,
|
||||||
@ -15,9 +18,10 @@ export const findPosts = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const findPost = async (id: string) => {
|
export const findPost = async (id: string) => {
|
||||||
return db.post.findUnique({
|
return db.post.findFirst({
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
|
isPublic: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,7 @@ model Post {
|
|||||||
title String
|
title String
|
||||||
description String?
|
description String?
|
||||||
path String
|
path String
|
||||||
|
isPublic Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user