fix/cant-create-team-name-taken (#5911)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/5913/head
Sumedh 2022-12-07 20:20:54 +05:30 committed by GitHub
parent cc9b49131e
commit c3122c82e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -85,7 +85,9 @@ export const viewerTeamsRouter = router({
const { slug, name, logo } = input;
const nameCollisions = await ctx.prisma.team.findFirst({
where: { OR: [{ name }, { slug }] },
where: {
slug: slug,
},
});
if (nameCollisions) throw new TRPCError({ code: "BAD_REQUEST", message: "Team name already taken." });