-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
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.
- 물론 코드를 읽어보면 알겠지만, 이슈를 해결한 것이면 간단하게라도 뭐가 문제였는지 + 어떻게 해결했는지를 알려주시면 좋을것 같아요 :)
- api 수정이 생기면 우선은 swagger처럼 따로 관리하고 있는게 없으니 doc에 정리해주세요.
@@ -139,10 +139,10 @@ router.get('/', async (request: express.Request, response: express.Response) => | |||
} | |||
|
|||
const follows = result.map(data => data.dataValues[target]); | |||
|
|||
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.
필요없는 공백이 들어갔네요.
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) |
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.
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) |
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.
위와 동일
|
||
response.json(videoListResponse); | ||
|
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.
다 띄워 적는것 보다는 관련되어있는 부분은 같이쓰면 좋을 것 같아요.
@@ -40,11 +40,14 @@ router.get('/recent-videos', async (request: express.Request, response: express. | |||
return; | |||
} | |||
|
|||
|
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.
특별한 이유가 있는게 아니면 newline은 1개가 좋을 것 같아요.
const userId = request.body.userInfo ? request.body.userInfo.userId : null; | ||
|
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.
여기서도 마찬가지로 관련있는 단위끼리는 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) => { |
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.
이건 수정 안해도 되는데, my-user-info
가 직관적일것 같긴해요.
response.json({ | ||
id: userInfo.id, | ||
email: userInfo.email, | ||
nickname: userInfo.nickname, | ||
imagePath: userInfo.imagePath, | ||
aboutMe: userInfo.aboutMe | ||
}); |
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.
response.json({ | |
id: userInfo.id, | |
email: userInfo.email, | |
nickname: userInfo.nickname, | |
imagePath: userInfo.imagePath, | |
aboutMe: userInfo.aboutMe | |
}); | |
response.json(userInfo.toUserInfoResponse()); |
이렇게 진행하되, userInfo를 user으로 전체적으로 바꿔도 좋을듯 하네요.
if(userId == null){ | ||
userId = request.body.userInfo ? request.body.userInfo.userId : null; | ||
} |
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.
해당 요청에서 userId가 없다고 본인의 정보를 내려주는 건 이상한 것 같아요. 차라리 400 에러를 주고, 프론트에서 처리를 하는게 맞을 것 같아요.
}); | ||
|
||
|
||
router.get('/user-info/:userId', async (request: express.Request, response: express.Response) => { |
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.
이 API는 로그인을 하지 않은 상태에서도 볼 수 있어야 하지 않을까요? 의견 부탁드릴게요.
만약 로그인을 안한 상태에서도 볼 수 있게 하려면, /v1/user
에서 middleware를 통해 로그인 검사를 하고 있는 구조를 좀 바꿔줘야 할 것 같아요.
resolves #75