export type ModifyKeys<T, R> = Record<keyof T, R>;
export const findFirstPost = cache(db.query.posts.findFirst);
//this function returns Promise<{} | undefined> for some reason
export const getPostFromSlug = async (
slug: string,
columns: Partial<ModifyKeys<Post, boolean>> = {
slug: false,
publishedAt: false
}
) => {
return await findFirstPost({
columns,
where: eq(posts.slug, slug)
});
};
export type ModifyKeys<T, R> = Record<keyof T, R>;
export const findFirstPost = cache(db.query.posts.findFirst);
//this function returns Promise<{} | undefined> for some reason
export const getPostFromSlug = async (
slug: string,
columns: Partial<ModifyKeys<Post, boolean>> = {
slug: false,
publishedAt: false
}
) => {
return await findFirstPost({
columns,
where: eq(posts.slug, slug)
});
};