Skip to content

Commit

Permalink
Merge pull request #19 from 2024-pre-onboarding-backend-F/refactor/mo…
Browse files Browse the repository at this point in the history
…dify_post_entity

[refactor] Content -> Post 엔티티 변경
  • Loading branch information
pie2457 authored Aug 26, 2024
2 parents 58317aa + e97334b commit fd06fb4
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.

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 {
}

0 comments on commit fd06fb4

Please sign in to comment.