Skip to content

Commit

Permalink
fix : 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
jw427 committed Aug 23, 2024
2 parents 7211ab2 + c4182f9 commit 8108606
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package wanted.media.content.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RestController
@RequestMapping("/contents")
public class ContentController {
}
27 changes: 18 additions & 9 deletions src/main/java/wanted/media/content/domain/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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;
Expand All @@ -14,33 +13,43 @@

@Entity
@Getter
@Setter
@Table(name="contents")
@NoArgsConstructor
@Table(name = "contents")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
@ToString
@EntityListeners(AuditingEntityListener.class)
public class Content {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "content_id", nullable = false)
private Long id;

@Column(name = "like_count")
private Long likeCount;
@Size(max = 50)
private String type;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Type type;

@Size(max = 150)
@Column(nullable = false)
private String title;

private String content;

private String hashtags;

private Long viewCount;

private Long shareCount;

@LastModifiedDate
private LocalDateTime updatedAt;

@CreatedDate
private LocalDateTime createdAt;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
@NotNull
private User user;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/wanted/media/content/domain/Type.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package wanted.media.content.domain;

public enum Type {
FACEBOOK, TWITTER, INSTAGRAM, THREADS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import org.springframework.data.jpa.repository.JpaRepository;
import wanted.media.content.domain.Content;

public interface ContentRepository extends JpaRepository<Content,Long> {
public interface ContentRepository extends JpaRepository<Content, Long> {
}
9 changes: 1 addition & 8 deletions src/main/java/wanted/media/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import wanted.media.content.domain.Content;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@NoArgsConstructor
Expand All @@ -21,13 +18,9 @@
public class User {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "userId", nullable = false)
@Column(name = "user_id", nullable = false)
private UUID userId;

@OneToMany(mappedBy = "user")
@Builder.Default
List<Content> interviews = new ArrayList<>();

@Column(unique = true, nullable = false)
@Size(max = 50)
private String account;
Expand Down

0 comments on commit 8108606

Please sign in to comment.