diff --git a/src/main/java/wanted/media/content/controller/ContentController.java b/src/main/java/wanted/media/content/controller/ContentController.java new file mode 100644 index 0000000..025e10a --- /dev/null +++ b/src/main/java/wanted/media/content/controller/ContentController.java @@ -0,0 +1,9 @@ +package wanted.media.content.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/contents") +public class ContentController { +} diff --git a/src/main/java/wanted/media/content/domain/Content.java b/src/main/java/wanted/media/content/domain/Content.java new file mode 100644 index 0000000..0ef7ad2 --- /dev/null +++ b/src/main/java/wanted/media/content/domain/Content.java @@ -0,0 +1,48 @@ +package wanted.media.content.domain; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.*; + +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; + +@Entity +@Getter +@Setter +@Table(name="contents") +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ToString +@EntityListeners(AuditingEntityListener.class) +public class Content { + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + @Column(name = "content_id", nullable = false) + private Long id; + private Long likeCount; + @Size(max = 50) + private String type; + @Size(max = 150) + private String title; + private String content; + private String hashtags; + private Long viewCount; + private Long shareCount; + @LastModifiedDate + private LocalDateTime updatedAt; + @CreatedDate + private LocalDateTime createdAt; + + @ManyToOne + @JoinColumn(name = "user_id") + @NotNull + private User user; + +} diff --git a/src/main/java/wanted/media/content/repository/ContentRepository.java b/src/main/java/wanted/media/content/repository/ContentRepository.java new file mode 100644 index 0000000..06eaa31 --- /dev/null +++ b/src/main/java/wanted/media/content/repository/ContentRepository.java @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..b505adc --- /dev/null +++ b/src/main/java/wanted/media/content/service/ContentService.java @@ -0,0 +1,7 @@ +package wanted.media.content.service; + +import org.springframework.stereotype.Service; + +@Service +public class ContentService { +} diff --git a/src/main/java/wanted/media/user/domain/User.java b/src/main/java/wanted/media/user/domain/User.java new file mode 100644 index 0000000..0c4cca0 --- /dev/null +++ b/src/main/java/wanted/media/user/domain/User.java @@ -0,0 +1,27 @@ +package wanted.media.user.domain; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.NoArgsConstructor; +import wanted.media.content.domain.Content; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Entity +@Table(name="users") +public class User { + @Id + @GeneratedValue(strategy = GenerationType.UUID) + @Column(name = "userId", nullable = false) + private UUID userId; + + @OneToMany(mappedBy = "user") + @Builder.Default + List interviews = new ArrayList<>(); +}