-
Notifications
You must be signed in to change notification settings - Fork 103
[5기 박유진] Shorten-URL 과제 제출합니다. #70
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
base: eugene
Are you sure you want to change the base?
Changes from 1 commit
f21a7cc
3b879ef
7836615
9f89a4f
4926d6a
1be563c
4ebb782
43a530d
3e78f05
74b0d62
38b98c0
3029ced
f77ca25
ff3d166
10d658b
d11a9ea
80b6440
dcf2fb1
0702ff3
585d81a
5165c18
8eb7746
651e09e
42f7595
9315f8e
c1642c9
59686bf
34df475
0fcdb18
d1f77c0
7e5f03d
5dc7ac6
48df906
f2808c5
786e478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 { | ||
|
|
||
| @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; | ||
|
||
|
|
||
| @NonNull | ||
| @Column(name = "orgin_url") | ||
| private String 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> { | ||
|
||
| Optional<Url> findByShortenKey(String key); | ||
| } | ||
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.
생성일시 / 업데이트일시도 있으면 좋을 것 같네요.