-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/login api #15
Feat/login api #15
Conversation
const postLoginController = async (req: Request, res: Response) => { | ||
try { | ||
const { email, password } = req.body; | ||
const data = await authService.postLoginService(email, password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resData로 통일하는 것 어떨까요?
const postLoginController = async (req: Request, res: Response) => { | ||
try { | ||
const { email, password } = req.body; | ||
const data = await authService.postLoginService(email, password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터로 req.body 한번에 보내도록 통일하겠습니다!
"비밀번호가 일치하지 않습니다." | ||
); | ||
} else { | ||
const { nickname, token } = data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
변수 선언부는 불필요하니 지워주는게 좋을것 같아요
} | ||
}; | ||
const authController = { | ||
postSignupController, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프리티어 적용 확인해 주시면 감사합니다
@@ -0,0 +1,8 @@ | |||
import express from "express"; | |||
import authController from "../controller/auth"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import 시엔 항상 주석으로 description을 달아주세요!
import index from "../config"; | ||
import constant from "../library/constant"; | ||
import isEmail from "validator/lib/isEmail"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import 주석 확인!
const emailExist = await User.findAll({ | ||
where: { | ||
email, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find 쿼리시에는 항상 is_delete 를 포함하여 where절을 걸어주세요
|
||
// nickname이 이미 존재할 때 | ||
const nicknameExist = await User.findAll({ | ||
where: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where절에 is_delete 걸어주세요!
} | ||
|
||
// 존재하지 않는 이메일 | ||
const user = await User.findOne({ where: { email: email } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where절 is_delete 걸어주세요!
// 존재하지 않는 이메일 | ||
const user = await User.findOne({ where: { email: email } }); | ||
if (!user) { | ||
return -2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant library 적용!
✅ PR check list
🌈 PR 요약
📌 변경 사항
constant.ts
Linked Issue
close #10
close #11