-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Gongjakso/feat/post
Feat/post
- Loading branch information
Showing
7 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/com/gongjakso/server/domain/post/controller/PostController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.gongjakso.server.domain.post.controller; | ||
|
||
import com.gongjakso.server.domain.post.service.PostService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/post") | ||
@Tag(name = "Post", description = "공고 관련 API") | ||
public class PostController { | ||
private final PostService postService; | ||
|
||
// @PostMapping | ||
// public ResponseEntity<> createPost() { | ||
// | ||
// } | ||
|
||
/** 모집글 게시(CREATE) */ | ||
// @PostMapping("/posts") | ||
// public ResponseEntity<PostCreationResponse> createPost( | ||
// @RequestBody @Validated PostCreationRequest request, | ||
// @AuthenticationPrincipal OAuth2User user) { | ||
// | ||
// String email = user.getName(); | ||
// Post post = postService.createPost(request, email); | ||
// keywordService.addKeywords(post, request); | ||
// | ||
// return ResponseEntity.ok( | ||
// PostCreationResponse.builder() | ||
// .id(post.getId()) | ||
// .title(post.getThumbnail().getTitle()) | ||
// .createdDate(post.getCreatedDate()) | ||
// .build()); | ||
// } | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/gongjakso/server/domain/post/dto/PostReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.gongjakso.server.domain.post.dto; | ||
|
||
public class PostReq { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/gongjakso/server/domain/post/dto/PostRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.gongjakso.server.domain.post.dto; | ||
|
||
public class PostRes { | ||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/com/gongjakso/server/domain/post/entity/Post.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.gongjakso.server.domain.post.entity; | ||
|
||
import com.gongjakso.server.domain.post.enumerate.PostType; | ||
import com.gongjakso.server.global.common.BaseTimeEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "post") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Post extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "post_id", nullable = false, columnDefinition = "varchar(20)") | ||
private Long postId; | ||
|
||
@Column(name = "title", nullable = false, columnDefinition = "varchar(20)") | ||
private String title; | ||
|
||
@Column(name = "contents", nullable = false, columnDefinition = "varchar(500)") | ||
private String contents; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private PostType status; | ||
|
||
@Column(name = "start_date", nullable = false) | ||
private LocalDateTime startDate; | ||
|
||
@Column(name = "end_date", nullable = false) | ||
private LocalDateTime endDate; | ||
|
||
@Column(name = "max_person", nullable = false, columnDefinition = "int") | ||
private Long maxPerson; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "meeting_method", nullable = true, columnDefinition = "varchar(10)") | ||
private PostType meetingMethod; | ||
|
||
@Column(name = "meeting_area", nullable = true, columnDefinition = "varchar(100)") | ||
private String meetingArea; | ||
|
||
@Column(name = "question_method", nullable = false, columnDefinition = "tinyint") | ||
private boolean questionMethod; | ||
|
||
@Column(name = "question_link", nullable = false, columnDefinition = "text") | ||
private String questionLink; | ||
|
||
@Column(name = "is_project", nullable = false, columnDefinition = "tinyint") | ||
private boolean isProject; | ||
|
||
@Builder | ||
public Post(Long postId, String title, String contents, PostType status, LocalDateTime startDate, LocalDateTime endDate, Long maxPerson, PostType meetingMethod, String meetingArea, boolean questionMethod, String questionLink, boolean isProject) { | ||
this.postId = postId; | ||
this.title = title; | ||
this.contents = contents; | ||
this.status = status; | ||
this.startDate = startDate; | ||
this.endDate = endDate; | ||
this.maxPerson = maxPerson; | ||
this.meetingMethod = meetingMethod; | ||
this.meetingArea = meetingArea; | ||
this.questionMethod = questionMethod; | ||
this.questionLink = questionLink; | ||
this.isProject = isProject; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/gongjakso/server/domain/post/enumerate/PostType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.gongjakso.server.domain.post.enumerate; | ||
|
||
public enum PostType { | ||
STATUS, MEETING_METHOD | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gongjakso/server/domain/post/repository/PostRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.gongjakso.server.domain.post.repository; | ||
|
||
import com.gongjakso.server.domain.post.entity.Post; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface PostRepository extends JpaRepository<Post, Long> { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/gongjakso/server/domain/post/service/PostService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.gongjakso.server.domain.post.service; | ||
|
||
import com.gongjakso.server.domain.post.repository.PostRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
@RequiredArgsConstructor | ||
public class PostService { | ||
private final PostRepository postRepository; | ||
} |