mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
feat(wip): create models to access db data
This commit is contained in:
14
src/lib/link/getUserLink.ts
Normal file
14
src/lib/link/getUserLink.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Link, User } from "@prisma/client";
|
||||
import prisma from "utils/prisma";
|
||||
|
||||
export default async function getUserLink(user: User, id: Link["id"]) {
|
||||
return await prisma.link.findFirst({
|
||||
where: {
|
||||
id,
|
||||
authorId: user.id,
|
||||
},
|
||||
include: {
|
||||
category: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user