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

[4기 황창현] URL Shortener 과제 제출 #40

Open
wants to merge 28 commits into
base: changhyeonh
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e94b801
feat: 입력 폼 페이지 구현
Hchanghyeon Oct 1, 2023
5219f38
build: validation 의존성 추가
Hchanghyeon Oct 1, 2023
443a96a
feat: 분리되어있던 페이지 통합, 프론트엔드 구현
Hchanghyeon Oct 3, 2023
910b678
build: JPA, H2 Database 사용을 위한 yml파일 설정
Hchanghyeon Oct 3, 2023
b2e7a79
chore: 페이지를 통합하면서 필요 없는 페이지 삭제
Hchanghyeon Oct 3, 2023
ab6fdfe
feat: Url 도메인 구현
Hchanghyeon Oct 3, 2023
6233638
feat: JpaAudting 기능 추가
Hchanghyeon Oct 3, 2023
3fde736
feat: 10진수를 Base62로 변환하는 컨버터 생성
Hchanghyeon Oct 3, 2023
9a77c4f
feat: URL을 검증하는 Validator 구현
Hchanghyeon Oct 3, 2023
5b17cb3
feat: Url Repository 생성 및 Lock과 기본 조회 로직 구현
Hchanghyeon Oct 3, 2023
df14a51
feat: Url Service 로직 구현
Hchanghyeon Oct 3, 2023
0ff6b6b
feat: Url Controller 로직 구현
Hchanghyeon Oct 3, 2023
74b2b14
feat: WebConfig로 ViewController 설정
Hchanghyeon Oct 3, 2023
8a92e3a
feat: 예외 처리 구현
Hchanghyeon Oct 3, 2023
5210f20
chore: 불필요한 테스트 코드 삭제
Hchanghyeon Oct 3, 2023
1246112
test: Repository, Domain 테스트 구현
Hchanghyeon Oct 3, 2023
14f5a61
style: class import
Hchanghyeon Oct 3, 2023
3554631
feat: Url 도메인 null 예외처리
Hchanghyeon Oct 3, 2023
b4828f1
style: 개행 처리
Hchanghyeon Oct 3, 2023
88552d9
style: 페이지에서 MD5 알고리즘 삭제
Hchanghyeon Oct 3, 2023
413974e
style: 개행 삭제
Hchanghyeon Oct 3, 2023
c24d8ca
refactor: IP DTO에서 받지 않도록 변경
Hchanghyeon Oct 11, 2023
dd539b5
refactor: unique로 변경
Hchanghyeon Oct 11, 2023
de6991e
style: ViewCount로 이름 변경
Hchanghyeon Oct 11, 2023
1ced81b
refactor: 분기문이 아닌 Enum에서 처리
Hchanghyeon Oct 11, 2023
4e45131
refactor: 빈 생성자 삭제
Hchanghyeon Oct 11, 2023
55b4a31
refactor: 비관적 락 적용 삭제
Hchanghyeon Oct 11, 2023
9fd79f2
refactor: column default 값 설정
Hchanghyeon Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: 10진수를 Base62로 변환하는 컨버터 생성
Hchanghyeon committed Oct 3, 2023
commit 3fde736ae9db4223b0f04a00ab07d9bd18becc45
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.programmers.urlshortener.common.converter;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Base62Converter {
Copy link
Member Author

Choose a reason for hiding this comment

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

원본 URL의 값을 DB에 저장하기 때문에 굳이 디코딩할 필요가 없다고 생각되어 만들지 않았습니다.


private static final String ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final int BASE = ALPHABET.length();

public static String encode(int value) {
StringBuilder sb = new StringBuilder();

while (value != 0) {
sb.append(ALPHABET.charAt(value % BASE));
value /= BASE;
}

return sb.reverse().toString();
}
}