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

Feature/user page #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Feature/user page #76

wants to merge 3 commits into from

Conversation

hywook4
Copy link
Contributor

@hywook4 hywook4 commented Aug 18, 2021

resolves #75

Copy link
Collaborator

@zych1751 zych1751 left a comment

Choose a reason for hiding this comment

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

  1. 물론 코드를 읽어보면 알겠지만, 이슈를 해결한 것이면 간단하게라도 뭐가 문제였는지 + 어떻게 해결했는지를 알려주시면 좋을것 같아요 :)
  2. api 수정이 생기면 우선은 swagger처럼 따로 관리하고 있는게 없으니 doc에 정리해주세요.

@@ -139,10 +139,10 @@ router.get('/', async (request: express.Request, response: express.Response) =>
}

const follows = result.map(data => data.dataValues[target]);

Copy link
Collaborator

Choose a reason for hiding this comment

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

필요없는 공백이 들어갔네요.

response.json({
follows: follows,
pageToken: follows.length > 0 ? follows[follows.length - 1].id : null
pageToken: follows.length > 0 ? result[result.length-1].dataValues.id : parseInt(request.query.pageToken as string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pageToken: follows.length > 0 ? result[result.length-1].dataValues.id : parseInt(request.query.pageToken as string)
pageToken: follows.length > 0 ? result[result.length-1].dataValues.id : lastFollowId

위 코드가 깔끔할 것 같긴한데, null에서 바꾼 이유가 있을까요? parseInt의 결과가 NaN이 나올 수 도 있을것 같아서요.

const videoListResponse: VideoListResponse = {
videoList: videos.map((video) => video.toVideoResponse()),
pageToken: videos.length > 0 ? videos[videos.length - 1].id : null
pageToken: videos.length > 0 ? videos[videos.length - 1].id : parseInt(request.query.pageToken as string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

위와 동일

Comment on lines +48 to +50

response.json(videoListResponse);

Copy link
Collaborator

Choose a reason for hiding this comment

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

다 띄워 적는것 보다는 관련되어있는 부분은 같이쓰면 좋을 것 같아요.

@@ -40,11 +40,14 @@ router.get('/recent-videos', async (request: express.Request, response: express.
return;
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

특별한 이유가 있는게 아니면 newline은 1개가 좋을 것 같아요.

const userId = request.body.userInfo ? request.body.userInfo.userId : null;

Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서도 마찬가지로 관련있는 단위끼리는 newline없이 묶어주세요.

@@ -90,9 +90,39 @@ router.put('/profile-image', async (request: express.Request, response: express.
});


router.get('/user-info', async (request: express.Request, response: express.Response) => {
router.get('/login-user-info', async (request: express.Request, response: express.Response) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이건 수정 안해도 되는데, my-user-info가 직관적일것 같긴해요.

Comment on lines +108 to +114
response.json({
id: userInfo.id,
email: userInfo.email,
nickname: userInfo.nickname,
imagePath: userInfo.imagePath,
aboutMe: userInfo.aboutMe
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
response.json({
id: userInfo.id,
email: userInfo.email,
nickname: userInfo.nickname,
imagePath: userInfo.imagePath,
aboutMe: userInfo.aboutMe
});
response.json(userInfo.toUserInfoResponse());

이렇게 진행하되, userInfo를 user으로 전체적으로 바꿔도 좋을듯 하네요.

Comment on lines +122 to +124
if(userId == null){
userId = request.body.userInfo ? request.body.userInfo.userId : null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 요청에서 userId가 없다고 본인의 정보를 내려주는 건 이상한 것 같아요. 차라리 400 에러를 주고, 프론트에서 처리를 하는게 맞을 것 같아요.

});


router.get('/user-info/:userId', async (request: express.Request, response: express.Response) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 API는 로그인을 하지 않은 상태에서도 볼 수 있어야 하지 않을까요? 의견 부탁드릴게요.
만약 로그인을 안한 상태에서도 볼 수 있게 하려면, /v1/user에서 middleware를 통해 로그인 검사를 하고 있는 구조를 좀 바꿔줘야 할 것 같아요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow 추가로 가져올 시, pageToken이 이상하게 내려오는 버그
2 participants