Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Last active August 13, 2020 23:04
Show Gist options
  • Select an option

  • Save nmchenry01/c9af7895e059418b790decffdb8f27a6 to your computer and use it in GitHub Desktop.

Select an option

Save nmchenry01/c9af7895e059418b790decffdb8f27a6 to your computer and use it in GitHub Desktop.
Find customer usernames for a specific company example for "Prisma vs. TypeORM"
export const findCustomerUsernamesForCompany = async (prisma: PrismaClient) => {
return prisma.customer.findMany({
select: {
username: true,
},
orderBy: {
username: 'desc',
},
where: {
products: {
some: {
company: { name: 'Acme' },
},
},
},
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment