Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f21a7cc
init commit
eugene225 Dec 7, 2023
3b879ef
docs: h2 database, jpa, server 환경설정
eugene225 Dec 10, 2023
7836615
docs: h2 database, guava 의존성 추가
eugene225 Dec 10, 2023
9f89a4f
feat: Url 엔티티 구성 및 repository 생성
eugene225 Dec 10, 2023
4926d6a
feat: UrlService 기본 기능 구현 (인코딩 방식 추가 필요)
eugene225 Dec 10, 2023
1be563c
feat: UrlController 기본구현
eugene225 Dec 10, 2023
4ebb782
feat: shortenURL 화면 구성
eugene225 Dec 11, 2023
43a530d
Chore: 패키지 수정
eugene225 Dec 11, 2023
3e78f05
chore: 패키지 구조 변경
eugene225 Dec 11, 2023
74b0d62
refactor: 기본 service 구성
eugene225 Dec 11, 2023
38b98c0
refactor: 기본 rest api 구성
eugene225 Dec 11, 2023
3029ced
feat: web controller 구성
eugene225 Dec 11, 2023
f77ca25
refactor: 기본 api 주소 변경
eugene225 Dec 11, 2023
ff3d166
chore: 패키지 구조 변경
eugene225 Dec 11, 2023
10d658b
feat: GlobalExceptionHandler 구성 및 적용
eugene225 Dec 11, 2023
d11a9ea
feat: base62 인코딩 방식 추가
eugene225 Dec 11, 2023
80b6440
feat: 이진수, 16진수 converter 추가
eugene225 Dec 11, 2023
dcf2fb1
refactor: Base62 Encoding 클래스명 변경 (이넘명 중복)
eugene225 Dec 16, 2023
0702ff3
feat: encodingType 이넘 생성 및 함수형 인터페이스 적용
eugene225 Dec 16, 2023
585d81a
feat: string 값 이넘 변환 converter 생성
eugene225 Dec 16, 2023
5165c18
refactor: 인코딩 함수 로직 변경
eugene225 Dec 16, 2023
8eb7746
refactor: encodingType 파라미터 추가
eugene225 Dec 16, 2023
651e09e
feat: html encodingType 라디오 버튼 추가
eugene225 Dec 16, 2023
42f7595
feat: url 요청 수 count 필드 추가 및 서비스 코드 수정
eugene225 Dec 16, 2023
9315f8e
refactor: 진수 Converter 클래스명 수정
eugene225 Dec 16, 2023
c1642c9
refactor: HttpStatus 활용 수정
eugene225 Dec 16, 2023
59686bf
feat: UrlRequestDto 생성 및 적용
eugene225 Dec 17, 2023
34df475
feat: base62 encoding 길이 추가
eugene225 Dec 17, 2023
0fcdb18
feat: originUrl 유효성 검사 코드 추가
eugene225 Dec 17, 2023
d1f77c0
docs: servlet 설정 제거
eugene225 Dec 18, 2023
7e5f03d
feat: createdAt, updatedAt 컬럼 추가
eugene225 Dec 19, 2023
5dc7ac6
feat: ID 값 타입수정
eugene225 Dec 19, 2023
48df906
Create maven.yml
eugene225 Feb 4, 2024
f2808c5
refactor: 이미 존재하는 url 처리
eugene225 Feb 4, 2024
786e478
Merge branch 'main' of https://github.com/eugene225/springboot-url-sh…
eugene225 Feb 4, 2024
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
34 changes: 34 additions & 0 deletions src/main/java/com/prgrms/shortenurl/url/domain/Url.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.prgrms.shortenurl.url.domain;

import jakarta.persistence.*;
import lombok.*;

@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Url {

Choose a reason for hiding this comment

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

생성일시 / 업데이트일시도 있으면 좋을 것 같네요.


@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shortenUrl")
@SequenceGenerator(name = "shortenUrl", sequenceName = "shortenUrl", allocationSize = 1)
private Long id;

@NonNull
@Column(name = "shorten_key")
private String shortenKey;

Choose a reason for hiding this comment

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

요것도 유니크하게 처리될 수 있으면 좋을 것 같네요.
인코딩 값이 충돌되었을때를 대비할 수 있을 것 같아요.


@NonNull
@Column(name = "orgin_url")
private String originUrl;

Choose a reason for hiding this comment

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

originUrl은 유니크하지 않아도 되는건가요?
만약, 유니크해야한다면 유니크 제약 조건을 걸어보면 좋을 것 같네요.


@NonNull
@Column(name = "shorten_url")
private String shortenUrl;

@Builder
public Url(@NonNull String shortenKey, @NonNull String originUrl, @NonNull String shortenUrl) {
this.shortenKey = shortenKey;
this.originUrl = originUrl;
this.shortenUrl = shortenUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.prgrms.shortenurl.url.domain;

import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface UrlRepository extends JpaRepository<Url, String> {

Choose a reason for hiding this comment

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

왜 ID 값에 String이 들어간걸까요?

Optional<Url> findByShortenKey(String key);
}