Skip to content
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

Merged
merged 4 commits into from
Jan 12, 2022
Merged

Feat/login api #15

merged 4 commits into from
Jan 12, 2022

Conversation

seohyun-106
Copy link
Contributor

@seohyun-106 seohyun-106 commented Jan 11, 2022

✅ PR check list

  • commit message가 적절한지 확인해주세요.
  • 마지막으로 Coding Convention을 준수했는지 확인해주세요.
  • 적절한 branch로 요청했는지 확인해주세요.
  • Assignees, Label을 붙여주세요.
  • 가능한 이슈를 Link 해주세요.
  • PR이 승인된 경우 해당 브랜치는 삭제 부탁드립니다.

🌈 PR 요약

  • 회원가입 api를 완성했습니다
  • 로그인 api를 완성했습니다
  • 지옥의 conflict를 해결했습니다

📌 변경 사항

  • 회원가입 관련 상수 추가 constant.ts
  • postSignup Controller, Service 추가
  • PostLogin Controller, Service 추가
  • /auth/signup 라우팅

Linked Issue

close #10
close #11

@seohyun-106 seohyun-106 added 🍀 feature 새로운 기능 추가 🔨 fix 오작동 코드 바로잡기 1️⃣ priority: high 우선순위 높음 labels Jan 11, 2022
const postLoginController = async (req: Request, res: Response) => {
try {
const { email, password } = req.body;
const data = await authService.postLoginService(email, password);
Copy link
Member

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);
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변수 선언부는 불필요하니 지워주는게 좋을것 같아요

}
};
const authController = {
postSignupController,
Copy link
Member

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";
Copy link
Member

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";

Copy link
Member

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,
},
Copy link
Member

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: {
Copy link
Member

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 } });
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant library 적용!

@seohyun-106 seohyun-106 merged commit 95844a9 into develop Jan 12, 2022
@seohyun-106 seohyun-106 deleted the feat/login-api branch January 12, 2022 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️⃣ priority: high 우선순위 높음 🍀 feature 새로운 기능 추가 🔨 fix 오작동 코드 바로잡기
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] sign up api 생성 [feat] login api 생성
3 participants