codestates / codestates/MUNADU-client
[Dev-Log] 5월 28일 금요일 / 류제천
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### 오늘은 어떻게 프로젝트에 기여했나요?
* 사형의 조언(리뷰)에 댓글 출력하는 기능 구현
* 사형의 조언(리뷰) 최신 순으로 정렬하는 기능 구현
### 오늘의 프로젝트에서 힘든 점은 무엇인가요?
* 리뷰글을 최신순으로 정렬하여 보이는 방법에는 2가지가 있었다. 클라에서 리뷰리스트를 생성날짜를 기준으로 내림차순하는 방법과 서버에서 쿼리를 보낼 때 orderby로 내림차순으로 하는 방법이다. 클라에서 sort를 쓰는 방법을 선택했고 new Data를 써서 문자열로 받아온 날짜를 date 객체로 만들어서 비교하려고 했으나 Typescript: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.ts(7009) 란 타입스크립트 에러에 봉착했고, 결국 ts7009 에러를 풀어내지 못해서 date-and-time 이란 라이브러리를 다운받아서 new없이 date 객체화에 성공해서 내림차순 구현을 완료했다.
```js
const sortedReviewList = reviewList.slice().sort((a: any, b: any) => {
const theADate = a.createdAt.slice(0, 10);
const theATime = a.createdAt.slice(11, 19);
const aDate = date.parse(`${theADate} ${theATime}`, "YYYY-MM-DD HH:mm:ss");
const theBDate = b.createdAt.slice(0, 10);
const theBTime = b.createdAt.slice(11, 19);
const bDate = date.parse(`${theBDate} ${theBTime}`, "YYYY-MM-DD HH:mm:ss");
return bDate.getTime() - aDate.getTime();
});
```
### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?
- [ ] 리뷰의 댓글을 생성/수정/삭제 하는 기능 구현
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.