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] POST /room 습관 방 생성 API 구현 #3

Merged
merged 10 commits into from
Jan 11, 2022
Merged

Conversation

youngkwon02
Copy link
Member

✅ Default Checklist

  • check branch

  • set Labels

  • set Reviewers


📕 Task

  • POST /room 습관방 생성 api 작성 완료

💡TODO

  • Access Token을 해석하여 creator 설정 필요 ( 임시로 1번 사용자가 방장으로 임명되게 구현 )

* @route POST /room
* @body roomName:string, fromStart:boolean
* @error
* 1. 습관방 이름이 전달되지 않음
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 습관방 이름 / 습관방 타입이 전달되지 않음
  • (차후의 처리지만) userId의 유저가 userDB에 존재하지 않는 경우
  • 추가하면 좋을 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

@xxeol2
정상적인 fromStart 값이 true 또는 false인데, falsy한 방법으로 체크하기 까다로워서 넘겨두고 까먹었네요ㅜㅜ
typeof 함수로 boolean type인지 체크하는 방식으로 타입 체크 진행하겠습니다!
감사합니다~~🙂

const { roomName, fromStart } = req.body;

console.log(roomName, fromStart);

Copy link
Contributor

Choose a reason for hiding this comment

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

여기에
// 1. 습관방 이름이 전달되지 않음 (코드 상단 주석의 @error 에 해당되는 내용)
이렇게 주석 적어두면, 나중에 확인할 때 편할 것 같아요!!

Copy link
Member Author

Choose a reason for hiding this comment

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

@xxeol2
아아,, 맞당 ㅋㅋㅋㅋㅋ
어제 설명 듣구 아직 적응이 안돼서 빼먹었네요 ㅜㅜ
수정하겠습니다~~ 감사합니다!

Comment on lines 23 to 31
// error 2. 습관방 이름이 전달되지 않음
if (!roomName) {
return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, responseMessage.NULL_VALUE));
}

// error 2. 습관방 타입이 전달되지 않음
if (typeof fromStart !== 'boolean') {
return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, responseMessage.NULL_VALUE));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

if문 한 번에 조건 두개 다 넣어서 처리해도 좋을 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

@xxeol2
맞네여~~~ 역싀~~~ 든든합니당☺️

Copy link
Contributor

@xxeol2 xxeol2 left a comment

Choose a reason for hiding this comment

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

LGTM !! 😀

Comment on lines 46 to 50
// error 1. 요청 권한이 없음 (회원가입 되지 않은 사용자)
// let hasAuth = userDB.checkExistById(userId);
// if (!hasAuth) {
// // 등록된 회원이 아니라는 Response
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

user Check부분 제가 checkUser middleware단에 추가했어요..! 착오드려서 죄송해요!!!

Copy link
Member Author

Choose a reason for hiding this comment

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

@xxeol2
아니에요~~~ㅎㅎㅎ
설희님 코드 아직 안합쳐졌지만, 미들웨어 있다고 가정하고 적용까지 완료해서 리팩터링 했습니다!!
감사합니당 👍

Copy link
Contributor

@junghyun-jacky junghyun-jacky left a comment

Choose a reason for hiding this comment

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

확인완료~ 고생하셨습니다!

@xxeol2 xxeol2 merged commit 1988747 into develop Jan 11, 2022
xxeol2 added a commit that referenced this pull request Jan 11, 2022
xxeol2 added a commit that referenced this pull request Jan 11, 2022
[FEAT] GET /room/code/:code 참여코드로 대기방 조회 API 구현
@xxeol2 xxeol2 deleted the feature/#1 branch January 11, 2022 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ New feature or request 🦋 영권
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants