Add forking graphQL resolvers

This commit is contained in:
Kurt Hutten
2021-09-27 18:51:26 +10:00
parent 2d7fb91f92
commit dd152709ff

View File

@@ -267,6 +267,10 @@ export const deleteProject = async ({ id }: Prisma.ProjectWhereUniqueInput) => {
}
export const Project = {
forkedFrom: (_obj, { root }) =>
root.forkedFromId && db.project.findUnique({where: { id: root.forkedFromId}}),
childForks: (_obj, { root }) =>
db.project.findMany({where: { forkedFromId: root.id}}),
user: (_obj, { root }: ResolverArgs<ReturnType<typeof project>>) =>
db.project.findUnique({ where: { id: root.id } }).user(),
socialCard: (_obj, { root }: ResolverArgs<ReturnType<typeof project>>) =>