-
Notifications
You must be signed in to change notification settings - Fork 4
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
게시글 작성 api에서 사진을 없는 경우 empty file을 보내는 방식 수정 및 수정 관련 버그 수정 #557
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
18fdd26
design: (#541) 글쓰기 페이지 오른쪽 패딩 적용 및 헤더 글씨 크기 조정
chsua 14203f8
design: (#482) safari에서 글 쓸때 확대되어서 보이는 오류 수정
chsua c29654b
fix: (#482) 사파리에서 날짜가 nan뜨는 오류 수정
chsua e523cfb
test: 날짜문자열과 현재 시간을 비교하여 문자열을 출력하는 유틸 함수 테스트 코드 작성
chsua 50dfd03
design: (#541) 작성된 게시글 속 사진 가로 길이 80%으로 수정
chsua 4cd149d
feat: 게시글 마감 제한 시간 정책변경에 따라 3일 -> 14일로 수정
chsua e60f325
feat: 본문 내용에 연속되는 개행은 1회 개행으로 처리되도록 수정
chsua 7d8131e
test: 연속된 개행을 1회 개행으로 수정하는 유틸함수 테스트
chsua 5b43aec
test: 마감시간 버튼용 배열 변경에 따른 테스트 코드 수정
chsua 07ab5f8
fix: 선택된 time 객체 확인을 위해 비교하는 로직을 깊은 비교로 수정
chsua 5053dfb
fix: 최대 마감일자 버튼 클릭 후 사용자 지정 클릭시 잘못된 ui가 출력되는 오류 수정
chsua 82fb101
fix: (#280) 선택지에 사진 등록/삭제 후 동일한 사진 올릴시 안올라가는 버그 수정
chsua c6d5458
refactor: 사용하지 않는 함수 삭제 및 시간 유효성 검사 함수 분리
chsua 147d9f0
fix: 마감 최대 시간(14일)인 경우 마감시간 유효성 검사에 걸리지 않도록 수정
chsua fb57587
fix: (#280) 선택지에 사진 등록/삭제 후 동일한 사진 올라가지 않는 오류 수정
chsua ecd874e
feat: 글 등록/수정 api 수정에 따라 formData 형식 수정
chsua 1c95560
feat: (#541) imageUrl 앞 도메인 삭제
chsua 239c41c
feat: 수정인 경우 수정 api 통신에 optionId를 함께 보내도록 수정
chsua 4987bc1
refactor: 테스트 파일명 컨벤션에 따라 테스트 함수 이름으로 수정하기
chsua f57798d
feat: 개행 5번 이상 연속되면 5번 개행으로 고정하도록 수정
chsua 04ad070
feat: 개행이 가능한 textarea의 value는 5회이상 연속개행을 검열하여 통신
chsua 8ef7516
refactor: 마감시간 유효성 검사코드 중 변수를 선언하여 가독성 향상
chsua 6317aa7
refactor: 글 작성/수정데이터 유효성 검사 type 체크 강화
chsua 4c9c315
refactor: contentInputRefList 의 type중 null 제거
chsua 265ba23
test: 개행 검열 유틸함수 변경에 따른 테스트 코드 수정
chsua d23e65e
fix: (#541) 기존 작성한 선택지인 경우 id를 보내고, 아니면 보내지 않도록 수정
chsua e0f3f81
test: 선택지 훅 수정에 따른 테스트 코드 수정
chsua fc165f7
fix: 선택지 훅에서 isServerId가 무조건 true인 오류 수정
chsua 0784e7c
Merge branch 'dev' into feat/#541
inyeong-kang 7c15999
로그인, 투표 통계, 회원정보 페이지 lazy import 적용 (#571)
Gilpop8663 a68c06b
게시글 작성 시 이미지 파일을 보낼 때 webp 로 압축하여 성능 개선 (#614)
Gilpop8663 46aa064
신고 도메인 리팩터링 (#540)
tjdtls690 648931d
정사각형으로 나오는 이미지를 너비값 기준으로 보이게 변경 (#623)
Gilpop8663 34c11f2
fix: (#627) 개발서버 오리진 url 수정 (#628)
aiaiaiai1 2887b85
style: (#622) 선택지가 왼쪽으로 움직이는 버그 수정
Gilpop8663 59b95cc
fix: (#629) https 로컬호스트 오리진 url 추가 (#630)
aiaiaiai1 332b35f
feat: (#602) 본문 이미지를 붙여넣기 이벤트로 이미지를 첨부할 수 있도록 구현
Gilpop8663 5afb4e3
refactor: (#602) 선택지 작성에서 중복되는 업로드 이미지 코드를 리팩터링한 것을 적용
Gilpop8663 577b8fd
refactor: (#602) 사용하지 않는 async 제거, 부자연스러운 함수명 변경
Gilpop8663 30fa5ee
성능 최적화를 위한 리액트 쿼리 캐시정책 설정 및 불필요한 fetch하지 않기 (#626)
chsua f846ecc
chore: (#631) https로 실행되도록 설정 및 스크립트 명령어 추가
Gilpop8663 c0ea5c4
chore: (#631) pem키 gitignore에 추가
Gilpop8663 6a4cb61
feat: (#563) 카테고리 즐겨찾기에 대한 낙관적 업데이트 구현 (#633)
inyeong-kang f1d8219
feat: (#541) imageUrl 앞 도메인 삭제
chsua 0989a38
refactor: (#541) 불필요한 코드(이미지 업로드 버튼의 클릭이벤트) 삭제
chsua 6bf612c
refactor: (#541) 사용하지 않는 유틸함수(이미지 url 수정) 삭제
chsua 8565736
정사각형으로 나오는 이미지를 너비값 기준으로 보이게 변경 (#623)
Gilpop8663 ac8f438
[REFACTOR] 게시글 도메인 리팩터링 (#549)
woo-chang 105c4a3
design: (#541) 작성된 게시글 속 사진 가로 길이 80%으로 수정
chsua dd3a9eb
Merge branch 'dev' into feat/#541
woo-chang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { convertTimeToWord } from '@utils/time'; | ||
|
||
describe('게시글 작성시간을 숫자 문자열로 받아 현재 시간과 비교해 반올림한 차이를 한글로 반환하는 유틸함수를 테스트한다.', () => { | ||
test('2023-01-01 12:00에 작성한 글은 2023-01-01 12:05을 기준으로 "5분"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-01 12:05'); | ||
const result = convertTimeToWord('2023-01-01 12:00', nowDate); | ||
|
||
expect(result).toBe('5분 전 작성'); | ||
}); | ||
|
||
test('2023-01-01 12:00에 작성한 글은 2023-01-01 20:10을 기준으로 "8시간"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-01 20:10'); | ||
const result = convertTimeToWord('2023-01-01 12:00', nowDate); | ||
|
||
expect(result).toBe('8시간 전 작성'); | ||
}); | ||
|
||
test('2023-01-01 12:00에 작성한 글은 2023-01-02 13:00을 기준으로 "1일"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-02 13:00'); | ||
const result = convertTimeToWord('2023-01-01 12:00', nowDate); | ||
|
||
expect(result).toBe('1일 전 작성'); | ||
}); | ||
|
||
test('2023-01-01 12:00에 작성한 글은 2023-01-12 13:00을 기준으로 "11일"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-12 13:00'); | ||
const result = convertTimeToWord('2023-01-01 12:00', nowDate); | ||
|
||
expect(result).toBe('11일 전 작성'); | ||
}); | ||
|
||
test('작성된지 30일 이상이라면 작성 날짜를 반환한다.', () => { | ||
const nowDate = new Date('2023-02-01 13:00'); | ||
const result = convertTimeToWord('2023-01-01 12:00', nowDate); | ||
|
||
expect(result).toBe('2023-01-01'); | ||
}); | ||
}); | ||
|
||
describe('게시글 마감시간을 숫자 문자열로 받아 현재 시간과 비교해 반올림한 차이를 한글로 반환하는 유틸함수를 테스트한다.', () => { | ||
test('2023-01-01 12:00 기준으로 2023-01-01 12:10가 마감인 경우 "10분 후 마감"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-01 12:00'); | ||
const result = convertTimeToWord('2023-01-01 12:10', nowDate); | ||
|
||
expect(result).toBe('10분 후 마감'); | ||
}); | ||
|
||
test('2023-01-01 12:00 기준으로 2023-01-01 18:00가 마감인 경우 "6시간 후 마감"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-01 12:00'); | ||
const result = convertTimeToWord('2023-01-01 18:00', nowDate); | ||
|
||
expect(result).toBe('6시간 후 마감'); | ||
}); | ||
|
||
test('2023-01-01 12:00 기준으로 2023-01-03 12:00가 마감인 경우 "2일 후 마감"이 반환된다.', () => { | ||
const nowDate = new Date('2023-01-01 12:00'); | ||
const result = convertTimeToWord('2023-01-03 12:00', nowDate); | ||
|
||
expect(result).toBe('2일 후 마감'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { deleteOverlappingNewLine } from '@utils/post/deleteOverlappingNewLine'; | ||
|
||
describe('연속된 개행은 하나의 개행으로 처리하는 유틸함수를 테스트한다.', () => { | ||
test('개행이 없는 문자열은 인자와 동일한 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다. 동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(text); | ||
}); | ||
|
||
test('연속된 개행이 없는 문자열은 인자와 동일한 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(text); | ||
}); | ||
|
||
test('2회 연속된 개행이 있는 문자열은 인자와 동일한 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const expectText = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(expectText); | ||
}); | ||
|
||
test('5회 연속된 개행이 있는 문자열은 인자와 연속된 개행이 5회 개행으로 바뀐 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const expectText = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(expectText); | ||
}); | ||
|
||
test('7회 연속된 개행이 있는 문자열은 인자와 연속된 개행이 5회 개행으로 바뀐 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const expectText = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(expectText); | ||
}); | ||
|
||
test('10회 연속된 개행이 있는 문자열은 인자와 연속된 개행이 5회 개행으로 바뀐 결과를 반환한다.', () => { | ||
const text = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const expectText = | ||
'안녕하세요. 이것은 유틸함수를 테스트하기 위한 문자열입니다.\n\n\n\n\n동일한 결과물이 나와야 옳은 작동을 하는 유틸함수 입니다.'; | ||
const changedText = deleteOverlappingNewLine(text); | ||
|
||
expect(changedText).toBe(expectText); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,53 @@ | ||
export type DeadlineOption = '10분' | '30분' | '1시간' | '6시간' | '1일'; | ||
import { Time } from '@type/post'; | ||
|
||
export const DEADLINE_OPTION: DeadlineOption[] = ['10분', '30분', '1시간', '6시간', '1일']; | ||
export type DeadlineOptionName = '1일' | '3일' | '5일' | '7일' | '14일'; | ||
|
||
export interface DeadlineOptionInfo { | ||
name: DeadlineOptionName; | ||
time: Time; | ||
} | ||
|
||
export const DEADLINE_OPTION: DeadlineOptionInfo[] = [ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 분리하니까 훨씬 깔끔해졌네요!!👍 |
||
name: '1일', | ||
time: { | ||
day: 1, | ||
hour: 0, | ||
minute: 0, | ||
}, | ||
}, | ||
{ | ||
name: '3일', | ||
time: { | ||
day: 3, | ||
hour: 0, | ||
minute: 0, | ||
}, | ||
}, | ||
{ | ||
name: '5일', | ||
time: { | ||
day: 5, | ||
hour: 0, | ||
minute: 0, | ||
}, | ||
}, | ||
{ | ||
name: '7일', | ||
time: { | ||
day: 7, | ||
hour: 0, | ||
minute: 0, | ||
}, | ||
}, | ||
{ | ||
name: '14일', | ||
time: { | ||
day: 14, | ||
hour: 0, | ||
minute: 0, | ||
}, | ||
}, | ||
]; | ||
|
||
export const MAX_FILE_SIZE = 1500000; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍👍