-
Notifications
You must be signed in to change notification settings - Fork 3
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
[refactor] contents 기초 코드 수정 #10
Changes from all commits
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 |
---|---|---|
@@ -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 { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 테이블의 pk를 content_id라고 설정해 놓으셨나요? id라고 설정해 놓으셨으면 name은 따로 작성 안하셔도 돼요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 DB 모델링 할 때 content_id로 했었습니다. |
||
private Long id; | ||
|
||
@Column(name = "like_count") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 카멜 케이스는 알아서 스네이크 케이스로 변경되기 때문에 어노테이션 따로 작성 안하셔도 괜찮습니다! |
||
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; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 37라인부터 43라인까지 공백은 없어도 괜찮은거 같아요 ~! |
||
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; | ||
|
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; | ||
} |
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.
이전 PR에서 제안한 의견 반영해 주신거 확인했습니다!