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

fix: 시,분,초가 같은 메시지를 조회하는 경우 정렬 순서가 바뀌는 현상 #528

Merged
merged 3 commits into from
Sep 22, 2022

Conversation

yeon-06
Copy link
Collaborator

@yeon-06 yeon-06 commented Sep 21, 2022

요약

시,분,초가 같은 메시지를 조회하는 경우 정렬 순서가 바뀌는 현상



작업 내용

  • 메시지 등록 시간에 nanoseconds 값 추가
  • message 테이블의 postedDate 타입 변경 (timestamp -> timestamp(6))



관련 이슈



@yeon-06 yeon-06 added 🐛 BUG 기능상 버그 🎉 BE 백엔드 관련 labels Sep 21, 2022
@yeon-06 yeon-06 self-assigned this Sep 21, 2022
@yeon-06 yeon-06 added this to In progress in 5차 스프린트 via automation Sep 21, 2022
@github-actions
Copy link

github-actions bot commented Sep 21, 2022

Unit Test Results

  51 files    51 suites   15s ⏱️
189 tests 189 ✔️ 0 💤 0
192 runs  192 ✔️ 0 💤 0

Results for commit d7cda29.

♻️ This comment has been updated with latest results.

@yeon-06 yeon-06 marked this pull request as draft September 21, 2022 09:35
@yeon-06 yeon-06 marked this pull request as ready for review September 21, 2022 09:52
@pickpick-sonarqube
Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (91.00% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.00% Estimated after merge)

Project ID: woowacourse-teams_2022-pickpick_AYKprLeNXDQxKhlck1fc

View in SonarQube

Copy link
Collaborator

@JangBomi JangBomi left a comment

Choose a reason for hiding this comment

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

연로그 정말 감사해요 ㅠㅠ
그냥 사소하게 궁금한것만 코멘트로 남겨놨어요! approve 하겠습니다 👍

@@ -37,7 +37,7 @@ public class Message {
@JoinColumn(name = "member_id", nullable = false)
private Member member;

@Column(name = "posted_date", nullable = false)
@Column(name = "posted_date", nullable = false, columnDefinition = "timestamp(6)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

timestamp의 기본값이 6자리인걸로 아는데 뒤에 (6)을 붙여준 이유가 궁금해요!! :)

Copy link
Collaborator Author

@yeon-06 yeon-06 Sep 21, 2022

Choose a reason for hiding this comment

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

기본값이 6자리인게 혹시 어떤 의미일까요?
기존에는 timestamp 타입이었는데 밀리초를 저장하기 위해 timestamp(6)으로 지정해주었습니다😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

앗 이건 제가 착각했네요ㅜㅜ
https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html 문서에서 If omitted, the default precision is 0. (This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.) 라고 되어있네요. mysql에서는 기본값이 0인가봐요,,!! 👍

@@ -40,16 +40,16 @@ class MessageCreatedServiceTest {
"메시지 전송!",
SAMPLE_MEMBER,
SAMPLE_CHANNEL,
TimeUtils.toLocalDateTime("1234567890"),
TimeUtils.toLocalDateTime("1234567890")
TimeUtils.toLocalDateTime("1656919966.864259"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

요건 정말 사소한건데 1656919966.864259 이 숫자는 무슨 의미인가요??ㅋㅋㅋ 그냥 궁금합니다!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

2022년 7월 4일 16시 32분... 저희가 최초로 슬랙 메시지 전송 테스트해보던 시간이에요 ㅋㅋㅋㅋ
(노션에 샘플 데이터가 있길래 가져왔습니다ㅇ.<)
1234567890은 아무 숫자나 입력했던건데 해당 값은 유효한 날짜입니다ㅎㅎㅎ

Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 상수화 하면 좋지 않을까요? 😁

Copy link
Collaborator

@hyewoncc hyewoncc left a comment

Choose a reason for hiding this comment

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

꼼꼼한 테스트 수정까지 수고많으셨어요!!! 😁
이제 와르르 보내도 제대로 정렬된 메시지를 볼 수 있겠군요 ㅎㅎ

@@ -40,16 +40,16 @@ class MessageCreatedServiceTest {
"메시지 전송!",
SAMPLE_MEMBER,
SAMPLE_CHANNEL,
TimeUtils.toLocalDateTime("1234567890"),
TimeUtils.toLocalDateTime("1234567890")
TimeUtils.toLocalDateTime("1656919966.864259"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 상수화 하면 좋지 않을까요? 😁

String eventTimeStamp = "1657087057.056339";
LocalDateTime expected = LocalDateTime.of(2022, 7, 6, 14, 57, 37);
String eventTimeStamp = "1663748574.680000";
LocalDateTime expected = LocalDateTime.of(2022, 9, 21, 17, 22, 54, 680000000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

마지막 밀리초를 왜 길게 넣은걸까 했는데 직접 돌려보니 680000000680000이 되는군요 🤧
연로그 덕에 좋은 거 알아갑니다 👍

@hyewoncc hyewoncc merged commit 65086fd into develop Sep 22, 2022
5차 스프린트 automation moved this from In progress to Done Sep 22, 2022
@hyewoncc hyewoncc deleted the feature/add-nanoseconds branch September 22, 2022 01:24
yeon-06 added a commit that referenced this pull request Sep 22, 2022
* feat: postedDate의 컬럼 타입 변경

* feat: LocalDateTime 변환 시 milliSecond 단위로 변경

* test: 올바른 테스트 데이터 세팅
moonheekim0118 added a commit that referenced this pull request Sep 22, 2022
* refactor: 리액트 쿼리 로직 커스텀 훅 분리 (#482)

* refactor: 불필요하게 Feed 페이지와 SpecificPage 에서 훅 실행하는 것 제거

* refactor: useEffect 실행구문에 Early Return 추가

* refactor: useMutateChannel 훅 분리
- 채널 구독 관련 Muatation 로직 훅으로 분리
- Settle 이후 동작 (refetch)은 Props 로 받도록 구현

* refactor: 전체 채널 가져오는 useQuery 훅으로 분리

* refactor: useMutateBookmark 훅 작성 및 적용

* refactor: useGetInfiniteBookmarks 훅 작성 및 적용

* refactor: useGetInfiniteMessages 훅 작성 및 적용
- 기존의 메시지 무한 스크롤 요청하던 페이지에서 일괄적으로 사용하도록 적용
- channelId, keyword, date 를 옵셔널 프롭스로 받도록 함

* refactor: useGetInfiniteReminders 훅 작성 및 적용

* refactor: useGetCertification 훅 작성 및 적용

* refactor: useSetTargetMessage -> useSetReminderTargetMessage 네이밍 수정

* refactor: slack login url 상수화

* refactor: hasNavBar 함수 한줄로 리팩터링

* refactor: channelId 쿼리 파람 구하는 유틸함수 리팩터링

* chore: 오타수정

* refactor: 불필요한getPageParam util 함수 제거
- 훅으로 분리하여 재사용 될 일이 없기 때문에, 각 훅에서 직접 함수를 정의하여 사용하도록 수정

* refactor: @disabled 지정한 테스트 제거 (#487)

* chore: 운영용 slack app 추가 및 yml 설정 정리 (#493)

* chore: test용 submodule 제거

* chore: submodule 업데이트 변경

- yml 파일 통일
- local profile의 DB 정보 변경
- prod용 slack app 정보 추가

* refactor: 슬랙에서 오는 예외를 프로젝트 예외인 SlackApiCallException으로 변환 (#492)

* chore: profile 설정 오류 업데이트 (#496)

* refactor: 서비스 테스트에 DatabaseCleaner 도입 (#479)

* refactor: 사용하지 않는 @AutoConfigureMockMvc 어노테이션 제거

* refactor: ServiceTest에서 DatabaseCleaner 도입

* refactor: 테스트에서 @transactional 어노테이션 제거

* optimization: 프론트엔드 성능 최적화 (#499)

* chore: package.json 수정

- scripts에 build-dev 모드 설정
- 불필요한 @babel dependencies 제거
- webpack-bundle-analyzer 설치

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: ts config module: esnext로 수정

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: webpack config 수정 및 babelrc 제거

- bundle analyzer dev mode에 추가
- babel loader 제거

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: Routes.tsx import문 수정

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: file-loader 제거 후 webpack asset 설정 적용

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: assets 파일 정리

- 불필요한 italic font 제거
- woff2, ttf 폰트 추가
- svg 파일 제거

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: 파일 확장자 설정 (웹팩, d.ts)

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: prettier ignore 설정

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: tway air 폰트 preload 설정

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* chore: 변경된 폰트 포맷 적용

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* refactor: svgIcon 컴포넌트 생성 및 적용

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* refactor: 메시지 조회 테스트 리팩토링   (#421)

* refactor: 메시지 조회 테스트 개선

* refactor: 코드리뷰 반영 및 코드 비교용 테스트 클래스 추가

* refactor: 코드리뷰 반영

* refactor: Nested 클래스를 이용한 조회 테스트 개선

* refactor: 코드리뷰 반영(어노테이션 순서 변경, DisplayName 개선)

* refactor: 클래스명을 MessageServiceTest로 변경 및 시간에 따른 리마인드 테스트 이동

* refactor: 채널 목록 조회 API 개선 (#495)

* refactor: Channel -> ChannelResponse 변환 로직 개선

* test: 불필요한 변수 선언 제거

* refactor: 채널 목록 조회 로직 ChannelSubscriptionService에서 ChannelService로 이동

* test: ChannelSubscriptionServiceTest에서 ChannelService 의존 제거

* test: 채널 전체 조회 테스트 추가

* refactor: Map 대신 Set 활용

* style: 개행 문자 제거 및 메서드 순서 변경

* refactor: ChannelService와 ChannelCreateService 분리

* test: DB Cleaner 적용

* test: DB Cleaner 누락된 곳 추가

* refactor: Service Layer에서 Domain이 아닌 DTO 반환

* style: 줄바꿈 개선

* refactor: 헤더 토큰값 추출 클래스를 auth 패키지로 이동 (#504)

* refacotor: 접근제어자 수정 (#512)

* feat: SlackApiCallException 로깅 메시지 추가 (#498)

* feat: 슬랙 api 호출 예외 발생 시 에러 메시지 추가 및 로깅

* refactor: 로깅 메시지 상수화, 응답코드 500 지정

* feat: ChannelCreateService 의 슬랙 호출 예외에 메시지 추가

* feature: submodule 버전을 jenkinsfile을 삭제한 버전으로 업그레이드 (#510)

* refactor: 메시지/북마크/리마인더 조회 API 스펙 변경   (#513)

* refactor: 메시지 조회 응답 isLast를 hasPast로 변경, isFuture 추가

* refactor: 메시지 api 변경 관련 테스트 수정

* refactor: 북마크의 isLast 필드를 hasPast로 변경

* refactor: 리마인더 조회 시 isLast 필드를 hasFuture로 변경

* refactor: 필요없는 @JsonProperty 선언 제거

* refactor: has~ 필드의 getter 명 개선, 오타 정정

* refactor: 메시지/북마크/리마인더 조회 API 스펙 변경 대응 (#515)

* refactor: 불필요한 주석 제거

* refactor: 북마크 get API 스펙 변경 대응
- isLast -> hasPast 로 수정하여 nextPageParam 함수 구현
- bookmark 응답값 타입 interface 수정

* chore: 단위 테스트 임시 주석처리

* refactor: 리마인더 get API 스펙 변경 대응
- isLast -> hasFuture 로 수정하여 nextPageParam 함수 구현
- Reminder 응답값 타입 interface 수정

* refactor: 메시지 get API 스펙 변경 대응
- isLast -> hasFuture 로 변경하여 previousPageParam 함수 구현
- isLast -> hasPast 로 변경하여 nextPageParam 함수 구현
- 메시지 응답값 interface 수정

* fix: Storybook 빌드 실패 해결
- 삭제된 svg 파일 Import 문 제거, 컴포넌트 svg 로 대체

* fix: font 적용되지 않는 문제 해결
- font-face 내 오타 수정

* refactor: HashMap 강제 형변환 제거 (#508)

* refactor: HashMap 강제 형변환 대신 ObjectMapper와 DTO 사용

* refactor: challenge 검증 방식 변경

* refactor: code smell 제거

- final 키워드 추가
- 불필요한 import 제거
- util 클래스에서 private 생성자 생성
- deprecated 제거

* test: toJson 위치 변경

* refactor: json 변환 실패 시 커스텀 Exception 적용

* test: JsonUtils 테스트 코드 추가

* refactor: DTO 이름 변경

* refactor: ControllerDto -> ServiceDto 변경 로직 ControllerDto로 이동

* feat: 저장하는 이미지 512에서 48로 변경

* test: json으로 전환하는 로직 메서드에서 제거

* refactor: 미사용 import 제거

* style: 컨벤션 맞춤

- 불필요한 공백 제거
- 불필요한 import 제거
- 어노테이션 순서 변경
- InvalidJsonRequestException 로깅 메시지 변경

* test: toJson() 로직 분리

* fix: 사파리에서 로그인 되지 않는 버그 해결  (#518)

* refactor: 불필요한 주석 제거

* fix: 사파리에서 로그인되지 않는 버그 해결
- 사파리에서 지원하지 않는 정규표현식 문법 (look behind) 제거
- 대체 가능한 정규표현식 및 로직으로 대체

* fix: 달력 컴포넌트 미래 날짜 및 빈 공간 클릭시 데이터 요청되는 버그 수정 (#519)

* refactor: 매번 생성되는 date 객체 최소한으로 생성될 수 있도록 변경

* refactor: isBlank, isFuture 인 경우 클릭 이벤트 발생하지 않도록 css 수정

* fix: isBlank, isFuture인 day 클릭시 link 이동되는 버그 해결

* refactor: reminderModal component 리팩터링 (#521)

* refactor: useSetReminder hook 분리

- useDatePicker, useTimePicker로 분리

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* refactor: ReminderModal component 분리

- DatePicker, TimePicker 로 분리

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* refactor: DatePicker, TimePicker 스크롤 위치 버그 수정 및 string literal, magic number 상수화

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

Co-authored-by: moonheekim0118 <hellomooneekim@gmail.com>

* refactor: 최상단으로 스크롤을 움직이는 로직 리팩터링  (#527)

* feat: 초기 렌더링 및 의존성 배열 내 상태가 바뀌었을 때 스크롤 위치를 최상단으로 변경하는 로직 훅으로 작성

* refactor: 반복되는 로직  useScrollToTop 훅 적용

* fix: 시,분,초가 같은 메시지를 조회하는 경우 정렬 순서가 바뀌는 현상  (#528)

* feat: postedDate의 컬럼 타입 변경

* feat: LocalDateTime 변환 시 milliSecond 단위로 변경

* test: 올바른 테스트 데이터 세팅

* refacotor: 쿼리에서 불필요한 left outer join 삭제 (#531)

* fix: Drawer 내부 클릭 시, Drawer 가 닫히는 문제 해결 (#529)

* refactor: useOuterClick 훅 수정
- props 로 내려준 숫자에 따라서 innerRef 를 n개 생성 할 수 있도록 수정

* fix: Drawer 내부 클릭 시, Drawer 닫히는 문제 해결
- 변경된 useOuterClick 훅 적용하여 여러군데에 innerRef 적용 할 수 있도록 수정

* refactor: useOuterClick 훅 적용

* refactor: useOuterClick 에서 props 로 받은 ref 숫자가 0일 경우, 길이가 1개인 배열을 디폴트로 생성하도록 수정

* fix: useOuterClick의 이벤트 리스너에서 불필요한 조건문 제거
- Array 의 length 가 무조건 1개 이상이기 때문에, 불필요한 가드로 판단되어 제거

* fix: nullish 연산자 or 연산자로 수정

* refactor: useOuterClick 함수에서 innerRef 배열 크기 지정을 강제하도록 수정
- requiredRefCount -> requiredInnerRefCount 로 네이밍 수정
- requiredInnerRefCount 타입 옵셔널 제거
- requiredInnerRefCount 가 0보다 같거나 작을 경우 1로 강제하도록 수정

* refactor: useOuterClick 반환 값 주석 작성

* refactor: useOuterClick 반환값 수정
- 기존에 객체형태로 반환하던 것을 array 로 수정

* refactor: SearchForm component 리렌더링 최소화 로직 추가 (#535)

* chore: tomcat 설정 추가 (#533)

* feat: Service Layer에서 완성된 DTO 반환 (#534)

* refactor: ChannelSubscriptionService DTO 반환하도록 변경

* style: 메서드 순서 CRUD로 변경

* style: 줄바꿈 변경

Co-authored-by: hyewoncc <80666066+hyewoncc@users.noreply.github.com>
Co-authored-by: yeonLog <53105735+yeon-06@users.noreply.github.com>
Co-authored-by: 봄 <55357130+JangBomi@users.noreply.github.com>
Co-authored-by: Jaejeung Ko <jaejeung3210@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 BE 백엔드 관련 🐛 BUG 기능상 버그
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

시,분,초가 같은 메시지를 조회하는 경우 정렬 순서가 바뀌는 현상
3 participants