Skip to content

Commit

Permalink
feat: Allow verified publishers override codemods (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohebifar authored Dec 28, 2024
1 parent b8d809b commit 41c5bee
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions apps/backend/src/publishHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,23 @@ export const publishHandler: RouteHandler<{
arguments: codemodRc.arguments,
};

// Check if a codemod with the name already exists from other author
const existingCodemod = await prisma.codemod.findUnique({
where: {
name,
author: {
not: author,
if (!isVerified) {
// Check if a codemod with the name already exists from other author
const existingCodemod = await prisma.codemod.findUnique({
where: {
name,
author: {
not: author,
},
},
},
});

if (existingCodemod !== null) {
return reply.code(400).send({
error: CODEMOD_NAME_TAKEN,
errorText: `Codemod name \`${name}\` is already taken.`,
});

if (existingCodemod !== null) {
return reply.code(400).send({
error: CODEMOD_NAME_TAKEN,
errorText: `Codemod name \`${name}\` is already taken.`,
});
}
}

let createdAtTimestamp: number;
Expand Down

0 comments on commit 41c5bee

Please sign in to comment.