chore: lint
This commit is contained in:
parent
817a12fffb
commit
9a811e85b5
2 changed files with 12 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { startTransition, Suspense, useEffect, useState } from "react"
|
import { startTransition, Suspense, useState } from "react"
|
||||||
import styles from "./auth.module.css"
|
import styles from "./auth.module.css"
|
||||||
import Link from "../../components/link"
|
import Link from "../../components/link"
|
||||||
import { signIn } from "next-auth/react"
|
import { signIn } from "next-auth/react"
|
||||||
|
|
|
@ -6,6 +6,7 @@ declare global {
|
||||||
import config from "@lib/config"
|
import config from "@lib/config"
|
||||||
import { Post, PrismaClient, User, Prisma } from "@prisma/client"
|
import { Post, PrismaClient, User, Prisma } from "@prisma/client"
|
||||||
import * as crypto from "crypto"
|
import * as crypto from "crypto"
|
||||||
|
import { cache } from "react"
|
||||||
export type { User, File, Post } from "@prisma/client"
|
export type { User, File, Post } from "@prisma/client"
|
||||||
|
|
||||||
export const prisma =
|
export const prisma =
|
||||||
|
@ -209,12 +210,16 @@ export const getPostById = async (
|
||||||
return post
|
return post
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getAllPosts = async (
|
export const getAllPosts = cache(
|
||||||
|
async (
|
||||||
options?: Prisma.PostFindManyArgs
|
options?: Prisma.PostFindManyArgs
|
||||||
): Promise<Post[] | ServerPostWithFiles[] | ServerPostWithFilesAndAuthor[]> => {
|
): Promise<
|
||||||
|
Post[] | ServerPostWithFiles[] | ServerPostWithFilesAndAuthor[]
|
||||||
|
> => {
|
||||||
const posts = await prisma.post.findMany(options)
|
const posts = await prisma.post.findMany(options)
|
||||||
return posts
|
return posts
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
export const userWithPosts = Prisma.validator<Prisma.UserArgs>()({
|
export const userWithPosts = Prisma.validator<Prisma.UserArgs>()({
|
||||||
include: {
|
include: {
|
||||||
|
|
Loading…
Reference in a new issue