-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 도메인 세팅 #2
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
Merged
sungchaewon
merged 6 commits into
FixLog:develop
from
sungchaewon:feature/#1-setup-properties-cw
May 12, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4018cee
fix: apply complete .gitignore
sungchaewon 891f79d
chore(config): H2 DB 설정을 application.properties로 추가
sungchaewon e41d572
feat(config): H2 DB 연결 설정 및 콘솔 확인 완료
sungchaewon 163c4c8
feat(config): bookmarktag 수정(글자수 등)
sungchaewon 1bd5c10
feat(config): 코드 내에 필드명 카멜 케이스로 수정
sungchaewon 8a68855
feat(config): originalPost 카멜 케이스로 변경
sungchaewon 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
2 changes: 1 addition & 1 deletion
2
...com/example/FixLog/FixLogApplication.java → ...com/example/fixlog/FixLogApplication.java
This file contains hidden or 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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/example/fixlog/domain/bookmark/Bookmark.java
This file contains hidden or 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,29 @@ | ||
| package com.example.fixlog.domain.bookmark; | ||
|
|
||
| import com.example.fixlog.domain.member.Member; | ||
| import com.example.fixlog.domain.post.Post; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Bookmark { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name="bookmarkId") | ||
| private Long id; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "userId") | ||
| private Member member; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "postId") | ||
| private Post post; | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/example/fixlog/domain/bookmark/BookmarkTag.java
This file contains hidden or 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,26 @@ | ||
| package com.example.fixlog.domain.bookmark; | ||
|
|
||
| import com.example.fixlog.domain.tag.Tag; | ||
| import com.example.fixlog.domain.tag.TagCategory; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class BookmarkTag { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "bookmarkTagId",nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(length = 20, nullable = false) | ||
| private String tagName; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| private TagCategory tagCategory; | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/example/fixlog/domain/bookmark/BookmarkTagMap.java
This file contains hidden or 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,26 @@ | ||
| package com.example.fixlog.domain.bookmark; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class BookmarkTagMap { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "mapId", nullable = false) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "bookmarkId", nullable = false) | ||
| private Bookmark bookmark; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "bookmarkTagId", nullable = false) | ||
| private BookmarkTag bookmarkTag; | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/example/fixlog/domain/follow/Follow.java
This file contains hidden or 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,26 @@ | ||
| package com.example.fixlog.domain.follow; | ||
|
|
||
| import com.example.fixlog.domain.member.Member; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Follow { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "followId") | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "followerId", nullable = false) | ||
| private Member follower; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "followingId", nullable = false) | ||
| private Member following; | ||
| } |
This file contains hidden or 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,31 @@ | ||
| package com.example.fixlog.domain.fork; | ||
|
|
||
| import com.example.fixlog.domain.member.Member; | ||
| import com.example.fixlog.domain.post.Post; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Fork { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "forkId") | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "userId", nullable = false) | ||
| private Member member; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "postId", nullable = false) | ||
| private Post originalPost; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "forkPostId", nullable = false) | ||
| private Post forkedPost; | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/example/fixlog/domain/like/PostLike.java
This file contains hidden or 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,27 @@ | ||
| package com.example.fixlog.domain.like; | ||
|
|
||
| import com.example.fixlog.domain.member.Member; | ||
| import com.example.fixlog.domain.post.Post; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PostLike { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "likeId", nullable = false) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "userId", nullable = false) | ||
| private Member member; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "postId", nullable = false) | ||
| private Post post; | ||
| } |
63 changes: 63 additions & 0 deletions
63
src/main/java/com/example/fixlog/domain/member/Member.java
This file contains hidden or 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,63 @@ | ||
| package com.example.fixlog.domain.member; | ||
|
|
||
| import com.example.fixlog.domain.post.Post; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import org.springframework.data.annotation.CreatedDate; | ||
| import org.springframework.data.annotation.LastModifiedDate; | ||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @EntityListeners(AuditingEntityListener.class) | ||
| public class Member { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "userId") | ||
| private Long id; | ||
|
|
||
| @Column(nullable = false) | ||
| private String email; | ||
|
|
||
| @Column(nullable = false) | ||
| private String password; | ||
|
|
||
| @Column(nullable = false) | ||
| private String nickname; | ||
|
|
||
| @Column(nullable = false) | ||
| private Boolean isDeleted = false; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(nullable = false) | ||
| private SocialType socialType = SocialType.EMAIL; | ||
|
|
||
| @CreatedDate | ||
| private LocalDateTime createdAt; | ||
|
|
||
| @LastModifiedDate | ||
| private LocalDateTime updatedAt; | ||
|
|
||
| @OneToMany(mappedBy = "member", cascade = CascadeType.ALL, orphanRemoval = true) | ||
| private List<Post> posts = new ArrayList<>(); | ||
|
|
||
| // Member 객체를 정적 팩토리 방식으로 생성하는 메서드 | ||
| // Creates a Member object using a static factory method | ||
| public static Member of(String email, String password, String nickname, SocialType socialType) { | ||
| Member member = new Member(); | ||
| member.email = email; | ||
| member.password = password; | ||
| member.nickname = nickname; | ||
| member.socialType = socialType; | ||
| member.isDeleted = false; | ||
| return member; | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/example/fixlog/domain/member/SocialType.java
This file contains hidden or 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,6 @@ | ||
| package com.example.fixlog.domain.member; | ||
|
|
||
| public enum SocialType { | ||
| EMAIL, | ||
| GITHUB | ||
| } |
This file contains hidden or 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,38 @@ | ||
| package com.example.fixlog.domain.post; | ||
|
|
||
| import com.example.fixlog.domain.member.Member; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Post { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "postId", nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(length = 20, nullable = false) | ||
| private String title; | ||
|
|
||
| @Column(columnDefinition = "TEXT", nullable = false) | ||
| private String content; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "userId", nullable = false) | ||
| private Member member; | ||
|
|
||
| private LocalDateTime createdAt; | ||
| private LocalDateTime updatedAt; | ||
|
|
||
| @OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true) | ||
| private List<PostImage> postImages = new ArrayList<>(); | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/example/fixlog/domain/post/PostImage.java
This file contains hidden or 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,24 @@ | ||
| package com.example.fixlog.domain.post; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PostImage { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "postImageId",nullable = false) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "postId", nullable = false) | ||
| private Post post; | ||
|
|
||
| @Column(columnDefinition = "TEXT", nullable = false) | ||
| private String postImageUrl; | ||
| } |
This file contains hidden or 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,26 @@ | ||
| package com.example.fixlog.domain.post; | ||
|
|
||
| import com.example.fixlog.domain.tag.Tag; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PostTag { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "postTagId",nullable = false) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "postId", nullable = false) | ||
| private Post post; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "tagId", nullable = false) | ||
| private Tag tag; | ||
| } |
This file contains hidden or 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,23 @@ | ||
| package com.example.fixlog.domain.tag; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Tag { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "tagId",nullable = false) | ||
| private Long id; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| private TagCategory tagCategory; | ||
|
|
||
| @Column(length = 20, nullable = false) | ||
| private String tag_name; | ||
| } | ||
This file contains hidden or 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,7 @@ | ||
| package com.example.fixlog.domain.tag; | ||
|
|
||
| public enum TagCategory { | ||
| STYLE, | ||
| CONCEPT, | ||
| ETC | ||
| } |
This file contains hidden or 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 +1,15 @@ | ||
| spring.application.name=FixLog | ||
| spring.application.name=fixlog | ||
|
|
||
| # DB setting | ||
| spring.h2.console.enabled=true | ||
| spring.h2.console.path=/h2-console | ||
|
|
||
| # DataBase Info | ||
| spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog | ||
| spring.datasource.driver-class-name=org.h2.Driver | ||
| spring.datasource.username=sa | ||
| spring.datasource.password= | ||
|
|
||
| spring.jpa.show-sql=true | ||
| spring.jpa.hibernate.ddl-auto=update | ||
| spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect |
2 changes: 1 addition & 1 deletion
2
...xample/FixLog/FixLogApplicationTests.java → ...xample/fixlog/FixLogApplicationTests.java
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.