Conversation
zych1751
left a comment
There was a problem hiding this comment.
- 물론 코드를 읽어보면 알겠지만, 이슈를 해결한 것이면 간단하게라도 뭐가 문제였는지 + 어떻게 해결했는지를 알려주시면 좋을것 같아요 :)
- api 수정이 생기면 우선은 swagger처럼 따로 관리하고 있는게 없으니 doc에 정리해주세요.
|
|
||
| const follows = result.map(data => data.dataValues[target]); | ||
|
|
||
| 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.
| 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) |
|
|
||
| response.json(videoListResponse); | ||
|
|
There was a problem hiding this comment.
다 띄워 적는것 보다는 관련되어있는 부분은 같이쓰면 좋을 것 같아요.
| return; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
특별한 이유가 있는게 아니면 newline은 1개가 좋을 것 같아요.
| router.get('/user-info', async (request: express.Request, response: express.Response) => { | ||
| router.get('/login-user-info', async (request: express.Request, response: express.Response) => { | ||
| const userId = request.body.userInfo ? request.body.userInfo.userId : null; | ||
|
|
There was a problem hiding this comment.
여기서도 마찬가지로 관련있는 단위끼리는 newline없이 묶어주세요.
|
|
||
|
|
||
| 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.
이건 수정 안해도 되는데, 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.
| 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.
해당 요청에서 userId가 없다고 본인의 정보를 내려주는 건 이상한 것 같아요. 차라리 400 에러를 주고, 프론트에서 처리를 하는게 맞을 것 같아요.
| }); | ||
|
|
||
|
|
||
| router.get('/user-info/:userId', async (request: express.Request, response: express.Response) => { |
There was a problem hiding this comment.
이 API는 로그인을 하지 않은 상태에서도 볼 수 있어야 하지 않을까요? 의견 부탁드릴게요.
만약 로그인을 안한 상태에서도 볼 수 있게 하려면, /v1/user에서 middleware를 통해 로그인 검사를 하고 있는 구조를 좀 바꿔줘야 할 것 같아요.
resolves #75