Skip to content

Instantly share code, notes, and snippets.

@schickling
Created December 4, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schickling/ecb598d27585d7f14ac8b190565785ed to your computer and use it in GitHub Desktop.
Save schickling/ecb598d27585d7f14ac8b190565785ed to your computer and use it in GitHub Desktop.
import type { Context } from '../../';
type EditReleaseInput = {
data: {
releaseId: string,
title?: string,
},
};
export default async (
_: void,
{ data }: EditReleaseInput,
{ prisma, viewerId }: Context
) => {
const hasAccess = await prisma.organization({
projects_some: {
releases_some: {
id: data.releaseId,
},
},
users_some: {
id: viewerId,
},
}).$exists();
if (!hasAccess)
throw new Error("This release does not exist or you don't have access.");
return await prisma.release({ id: data.releaseId }).$update({ title: data.title })
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment