Skip to content

Commit

Permalink
refactor: Modularize NicknameCheck (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: nusuy <[email protected]>
Co-authored-by: jiyunBae007 <[email protected]>
  • Loading branch information
3 people committed Jan 28, 2023
1 parent 43995d9 commit aa67cc9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions util/NicknameCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();

// 닉네임 중복확인 함수
async function nicknameOverlapCheck(nickname) {
const result = await prisma.users.findFirst({
where: {
nickname: nickname,
},
select: {
nickname: true,
},
});

// result === null가 true이면 사용 가능, false면 사용 불가
return result === null;
}

module.exports = { nicknameOverlapCheck };

0 comments on commit aa67cc9

Please sign in to comment.