diff --git a/src/main/java/wanted/media/content/repository/ContentRepository.java b/src/main/java/wanted/media/content/repository/ContentRepository.java deleted file mode 100644 index 510a593..0000000 --- a/src/main/java/wanted/media/content/repository/ContentRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package wanted.media.content.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import wanted.media.content.domain.Content; - -public interface ContentRepository extends JpaRepository { -} diff --git a/src/main/java/wanted/media/content/service/ContentService.java b/src/main/java/wanted/media/content/service/ContentService.java deleted file mode 100644 index b505adc..0000000 --- a/src/main/java/wanted/media/content/service/ContentService.java +++ /dev/null @@ -1,7 +0,0 @@ -package wanted.media.content.service; - -import org.springframework.stereotype.Service; - -@Service -public class ContentService { -} diff --git a/src/main/java/wanted/media/content/controller/ContentController.java b/src/main/java/wanted/media/post/controller/PostController.java similarity index 58% rename from src/main/java/wanted/media/content/controller/ContentController.java rename to src/main/java/wanted/media/post/controller/PostController.java index 00583de..97212e6 100644 --- a/src/main/java/wanted/media/content/controller/ContentController.java +++ b/src/main/java/wanted/media/post/controller/PostController.java @@ -1,9 +1,9 @@ -package wanted.media.content.controller; +package wanted.media.post.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/contents") -public class ContentController { +@RequestMapping("/posts") +public class PostController { } diff --git a/src/main/java/wanted/media/content/domain/Content.java b/src/main/java/wanted/media/post/domain/Post.java similarity index 54% rename from src/main/java/wanted/media/content/domain/Content.java rename to src/main/java/wanted/media/post/domain/Post.java index fed9efd..0e1d996 100644 --- a/src/main/java/wanted/media/content/domain/Content.java +++ b/src/main/java/wanted/media/post/domain/Post.java @@ -1,31 +1,37 @@ -package wanted.media.content.domain; +package wanted.media.post.domain; -import jakarta.persistence.*; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; -import lombok.*; +import java.time.LocalDateTime; + +import org.hibernate.annotations.ColumnDefault; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; -import wanted.media.user.domain.User; -import java.time.LocalDateTime; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.validation.constraints.Size; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import wanted.media.user.domain.User; @Entity @Getter -@Table(name = "contents") +@Table(name = "posts") @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor -@Builder @EntityListeners(AuditingEntityListener.class) -public class Content { +public class Post { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "content_id", nullable = false) - private Long id; - - @Column(name = "like_count") - private Long likeCount; + @Column(name = "post_id", nullable = false) + private String id; @Enumerated(EnumType.STRING) @Column(nullable = false) @@ -34,24 +40,25 @@ public class Content { @Size(max = 150) @Column(nullable = false) private String title; - private String content; - private String hashtags; + @ColumnDefault("0") + private Long likeCount; + + @ColumnDefault("0") private Long viewCount; + @ColumnDefault("0") private Long shareCount; - @LastModifiedDate - private LocalDateTime updatedAt; - @CreatedDate private LocalDateTime createdAt; + @LastModifiedDate + private LocalDateTime updatedAt; + @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user_id") - @NotNull + @JoinColumn(name = "user_id", nullable = false) private User user; - } diff --git a/src/main/java/wanted/media/content/domain/Type.java b/src/main/java/wanted/media/post/domain/Type.java similarity index 63% rename from src/main/java/wanted/media/content/domain/Type.java rename to src/main/java/wanted/media/post/domain/Type.java index 539f7fa..55a18e9 100644 --- a/src/main/java/wanted/media/content/domain/Type.java +++ b/src/main/java/wanted/media/post/domain/Type.java @@ -1,4 +1,4 @@ -package wanted.media.content.domain; +package wanted.media.post.domain; public enum Type { FACEBOOK, TWITTER, INSTAGRAM, THREADS; diff --git a/src/main/java/wanted/media/post/service/PostService.java b/src/main/java/wanted/media/post/service/PostService.java new file mode 100644 index 0000000..cb52ee0 --- /dev/null +++ b/src/main/java/wanted/media/post/service/PostService.java @@ -0,0 +1,7 @@ +package wanted.media.post.service; + +import org.springframework.stereotype.Service; + +@Service +public class PostService { +}