Skip to content

Commit

Permalink
fix : Gathering DeadLine LocalDate로 변경 (#88)
Browse files Browse the repository at this point in the history
* fix : Gathering  DeadLine LocalDate로 변경

* fix : yml 변경
  • Loading branch information
kcsc2217 authored Dec 6, 2024
1 parent 1abc13c commit 2fabb2d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
Expand Down Expand Up @@ -49,9 +50,8 @@ public record GatheringCommonRequest(

) {

public static LocalDateTime getDeadLineLocalDate(String deadLine){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm");
return LocalDateTime.parse(deadLine, formatter);
public static LocalDate getDeadLineLocalDate(String deadLine){
return LocalDate.parse(deadLine);
}

public static List<GatheringTag> getGatheringTag(List<String> gatheringTag){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public static GatheringDetailsResponse toDto(Gathering gathering, Long likeCount

List<String> positionList = gatheringPositions(gathering);

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm");
String deadLine = gathering.getDeadLine().format(formatter);
String deadLine = gathering.getDeadLine().toString();

return new GatheringDetailsResponse(
gathering.getUser().getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public record GatheringResponse(

public static GatheringResponse toDto(Gathering gathering) {

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm");
String deadLine = gathering.getDeadLine().format(formatter);
String deadLine = gathering.getDeadLine().toString();

List<String> gatheringTagList = checkGatheringTag(gathering);

Expand Down
13 changes: 8 additions & 5 deletions src/main/java/com/palettee/gathering/domain/Gathering.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import com.palettee.gathering.controller.dto.Request.GatheringCommonRequest;
import com.palettee.global.entity.BaseEntity;
import com.palettee.user.domain.*;
import com.palettee.user.domain.User;
import jakarta.persistence.*;
import lombok.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -33,7 +36,7 @@ public class Gathering extends BaseEntity {

private String period; // 개발 기간

private LocalDateTime deadLine; //마감일
private LocalDate deadLine; //마감일

private int personnel; // 모집 인원

Expand Down Expand Up @@ -67,7 +70,7 @@ public Gathering(
Subject subject,
String period,
Contact contact,
LocalDateTime deadLine,
LocalDate deadLine,
int personnel,
String title,
String content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public record CustomSliceResponse(
List<?> content,
boolean hasNext,
Long nextLikeId
Long nextId
) {

public static CustomSliceResponse toDTO(List<?> content, boolean hasNext, Long nextLikeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageRequest;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void create_gathering() throws Exception {
List<String> positions = new ArrayList<>();
positions.add("개발자");
positions.add("기획자");
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24-09-30", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24", positions, tagList, "testUrl", "제목", "content", imageList);

//when

Expand Down Expand Up @@ -141,7 +142,7 @@ public void gathering_paging() throws Exception {
positions.add("기획자");

for(int i = 0; i < 30; i++){
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24-09-30", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24", positions, tagList, "testUrl", "제목", "content", imageList);

gatheringService.createGathering(gatheringCreateRequest, savedUser);

Expand Down Expand Up @@ -178,7 +179,7 @@ public void gathering_details() throws Exception {
positions.add("개발자");
positions.add("기획자");

GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24-09-30", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonResponse gathering = gatheringService.createGathering(gatheringCreateRequest, savedUser);

//when
Expand Down Expand Up @@ -210,7 +211,7 @@ public void gathering_update() throws Exception {
positions.add("개발자");
positions.add("기획자");

GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24-09-30", positions, tagList, "testUrl", "제목", "content",null);
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24", positions, tagList, "testUrl", "제목", "content",null);
GatheringCommonResponse gathering = gatheringService.createGathering(gatheringCreateRequest, savedUser);


Expand All @@ -221,7 +222,7 @@ public void gathering_update() throws Exception {
updateList.add("tag4");


GatheringCommonRequest gatheringCreateRequest1 = new GatheringCommonRequest("스터디", "취미", "오프라인", 3, "3개월", "2024-11-24-09-30", null, updateList, "testUrl", "제목", "content", null);
GatheringCommonRequest gatheringCreateRequest1 = new GatheringCommonRequest("스터디", "취미", "오프라인", 3, "3개월", "2024-11-24", null, updateList, "testUrl", "제목", "content", null);

GatheringCommonResponse gatheringCreateResponse = gatheringService.updateGathering(gathering.gatheringId(), gatheringCreateRequest1, savedUser);

Expand Down Expand Up @@ -259,7 +260,7 @@ public void gatheringStatus_upate() throws Exception {



GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24-09-30", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonRequest gatheringCreateRequest = new GatheringCommonRequest("프로젝트", "개발", "온라인", 3, "3개월", "2024-11-24", positions, tagList, "testUrl", "제목", "content", imageList);
GatheringCommonResponse gathering = gatheringService.createGathering(gatheringCreateRequest, savedUser);


Expand Down Expand Up @@ -336,7 +337,7 @@ public void expired_gatheringStatus() throws Exception {
.personnel(4)
.positions(null)
.title("테스트")
.deadLine(LocalDateTime.now()).build();
.deadLine(LocalDate.now()).build();

Gathering save = gatheringRepository.save(gathering);
gatheringRepository.save(gathering);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private List<Gathering> genGatheringListList(int size, User user) {
return IntStream.range(0, size).boxed()
.map(i -> new Gathering(
Sort.ETC, Subject.ETC, "period? 이게 뭐지?", Contact.OFFLINE,
LocalDateTime.MAX, 3, "test", "title" + i,
LocalDate.MAX, 3, "test", "title" + i,
"content", user,null, null, null
)).toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private List<Archive> genArchiveList(int size, ArchiveType color, User user) {
private Gathering genGathering(String title, User user) {
return new Gathering(
Sort.ETC, Subject.ETC, "period? 이게 뭐지?", Contact.OFFLINE,
LocalDateTime.MAX, 3, "test", "title",
LocalDate.MAX, 3, "test", "title",
"content", user,null, null, null
);
}
Expand Down

0 comments on commit 2fabb2d

Please sign in to comment.