Skip to content
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] Content -> Post 엔티티 변경 #19

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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;

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wanted.media.content.domain;
package wanted.media.post.domain;

public enum Type {
FACEBOOK, TWITTER, INSTAGRAM, THREADS;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/wanted/media/post/service/PostService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package wanted.media.post.service;

import org.springframework.stereotype.Service;

@Service
public class PostService {
}