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

[COMMON] FEAT: 수요지식회 날짜 변경하는 기능 추가 #1702

Open
wants to merge 68 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a471ca9
[BE] presentationForm Category에 DUMMY 추가
chyo1 Oct 8, 2024
e176103
[BE] presentationForm에 더미 데이터 포함
chyo1 Oct 8, 2024
bddd38b
FEAT: 메인 페이지의 발표 폼 반환 시 더미데이터 제외
saewoo1 Oct 8, 2024
f90817a
FEAT: 3개월 내의 더미 데이터의 LocalDateTime들을 반환하는 기능
saewoo1 Oct 8, 2024
52648ad
[FE] FEAT: 발표 가능한 날짜 api 추가 #1691
jihyunk03 Oct 10, 2024
e4e0f46
[BE] FEAT:presentationForm dummy Form userId nullable 추가
chyo1 Oct 11, 2024
d5dc781
[BE] FIX: 등록 가능 날짜 조회 시 해당 월의 첫 날 자정으로 수정
saewoo1 Oct 11, 2024
c2d15f0
Merge branch 'common/dev/refactor-presentation-date#1691' of https://…
saewoo1 Oct 11, 2024
8eda651
[BE] FEAT:presentationForm date 메서드 분리
chyo1 Oct 11, 2024
a32b7db
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
chyo1 Oct 11, 2024
a129e6c
[FE] FEAT: 발표 가능한 날짜를 api 받는 것으로 변경(더미 데이터 형식)
jihyunk03 Oct 11, 2024
be9c4eb
[BE] FEAT: 지식회 발표 10월 ~ 12월 초기 데이터 sql
saewoo1 Oct 11, 2024
479eedb
Merge branch 'common/dev/refactor-presentation-date#1691' of https://…
saewoo1 Oct 11, 2024
b9a9afb
[BE] FEAT:presentation entity에 Table annotation 추가
chyo1 Oct 11, 2024
4d11d71
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
chyo1 Oct 11, 2024
40b8c1c
[FE] FEAT: 수지회 날짜수정시 해당월 기준으로 드롭다운 변경 #1691
seonmiki Oct 18, 2024
46f248b
[FE] FEAT: API로부터 받아오는 데이터 형식으로 변경 #1691
jihyunk03 Oct 18, 2024
e43e4c3
[BE] FIX: 초기 DUMMY 데이터 2023년에서 2024년으로 수정 #1691
jihyunk03 Oct 18, 2024
0be1c86
[FE] FIX: 발표 일정을 API로 받아와서 출력하도록 변경 #1691
wet6123 Oct 18, 2024
518ed43
[BE] FIX:invalid date 목록에서 category가 DUMMY인 날짜 제외
chyo1 Oct 18, 2024
a7589b3
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
chyo1 Oct 18, 2024
34e3e4d
[BE] FIX: able-date API 반환 이름 변경
chyo1 Oct 18, 2024
f98ace3
[BE] FIX: 발표 가능한 날짜 조회 시 현재 날짜 이후만 조회
chyo1 Oct 18, 2024
af3102f
[FE] FIX: able-date API 응답 데이터 이름 변경 #1691
jihyunk03 Oct 21, 2024
0b3ae8c
[FE] REFACTOR: 응답 확인용 콘솔 로그 삭제
jihyunk03 Oct 21, 2024
29b1752
[FE] BUG: PresentationCategoryType에 DUMMY를 추가하면서 생겼던 버그 픽스 #1691
wet6123 Oct 21, 2024
537cc0d
[FE] FEAT: DUMMY인 경우에도 일정을 변경할 수 있도록 변경 #1691
wet6123 Oct 21, 2024
fc79664
[FE] BUG: 일정 변경 시 원래 날짜도 선택 가능하게 변경 #1691
wet6123 Oct 21, 2024
0f7bf59
[BE] FIX: verifyReservationDate에서 dummy인 날 조건 추가
chyo1 Oct 22, 2024
92545cc
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
chyo1 Oct 22, 2024
bb8caf1
[BE] FIX: Presentation
chyo1 Oct 22, 2024
86857c7
[BE] FIX: Presentation
chyo1 Oct 22, 2024
2231a40
[FE] FEAT: 발표 취소 시 일정 변경이 불가능 하도록 수정 #1691
wet6123 Oct 22, 2024
ef20680
[FE] FIX: DUMMY인 경우 "발표 취소" 선택 불가하게 수정 #1691
wet6123 Oct 27, 2024
c287596
[FE] REFACTOR: 가로 스크롤 제한 추가 및 버튼 컴포넌트 컨벤션 적용 #1691
jihyunk03 Oct 28, 2024
769b3f4
[FE] REFACTOR: 반응형 max-width 통일 #1691
jihyunk03 Oct 28, 2024
ee6b949
[FE] FIX: token 로드 위치 조정
wet6123 Oct 28, 2024
20fbe9c
[FE] FIX: token 로드 위치 조정 #1691
wet6123 Oct 28, 2024
aca2cee
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
jihyunk03 Oct 29, 2024
892a204
[BE] FIX: 취소된 날짜에 다시 신청 시 500 에러 수정
chyo1 Oct 29, 2024
814af22
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
jihyunk03 Oct 29, 2024
72ddfc2
FEAT: Repository 내에서 status 기준으로 데이터 필터링 기능
saewoo1 Oct 29, 2024
fae430e
REFACTOR: 사용하지 않는 함수 삭제
saewoo1 Oct 29, 2024
182edb3
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
jihyunk03 Oct 29, 2024
2d01aa7
REFACTOR: invalid-date 반환 시 중복되는 repository 함수 통일
saewoo1 Oct 29, 2024
3110143
[FE] FEAT: 날짜 순서대로 정렬 추가
jihyunk03 Oct 29, 2024
384211f
[FE] REFACTOR: 사용하지 않는 함수 삭제
jihyunk03 Oct 29, 2024
f391c74
Merge branch 'common/dev/refactor-presentation-date#1691' of github.c…
jihyunk03 Oct 29, 2024
45ab06d
[FE] FEAT: 지나간 일정도 일정관리 모달 열리도록 수정 #1691
wet6123 Oct 29, 2024
d2857ff
FIX: Presentation Status에 Dummy 타입 추가
saewoo1 Oct 29, 2024
6948dcd
FIX: 정렬 방식을 Pageable을 기준으로 변경
saewoo1 Oct 29, 2024
8e9a560
REFACTOR: 수요지식회 유저 폼 등록 시 변수명 변경
saewoo1 Oct 29, 2024
2bccca5
FEAT: sql 지식회 폼 케이스 추가
saewoo1 Oct 29, 2024
f871765
[FE] FEAT: 일정 관리 모달에서 카테고리가 DUMMY인 경우 status를 DUMMY로 고정 #1691
wet6123 Oct 29, 2024
bf0cad6
[BE] FIX: sql 지식회 케이스 수정
jihyunk03 Oct 29, 2024
e241438
FIX: 더미 데이터 판별 시 status, category가 아닌 user로 판별
saewoo1 Oct 29, 2024
17aef86
FIX: 더미 데이터 판별 시 status, category가 아닌 user로 판별
saewoo1 Oct 29, 2024
5683175
[FE] FIX: status, category에 DUMMY 타입 제거 #1691
wet6123 Oct 29, 2024
deabcd2
FIX: 폼 Category 부분 DUMMY 삭제
saewoo1 Oct 29, 2024
675c66e
FIX: 메인 페이지 조회 시 더미 폼 조회 제외
saewoo1 Nov 1, 2024
456ba1d
FIX: 메인 페이지 조회 시 더미 폼 조회 제외
saewoo1 Nov 1, 2024
9964715
FIX: 폼 조회 시 유저가 작성한 폼의 상태에 따라 조회하는 기능
saewoo1 Nov 1, 2024
3ee1cfb
FIX: 폼 조회 시 유저가 작성한 폼의 상태에 따라 조회하는 기능
saewoo1 Nov 1, 2024
9aa21d6
REFACTOR: 유저의 폼을 가져온 후 서비스 로직에서 status에 따라 필터링
saewoo1 Nov 1, 2024
00b74fd
[FE] FIX: 400에러(month: '1' -> '01') 수정 #1691
jihyunk03 Nov 4, 2024
41a8a81
[FE] FEAT: 날짜 비교 형식 변환(관련 함수 추가 및 로직 변경) #1691
jihyunk03 Nov 4, 2024
8501ec1
[BE] FIX: sql 지식회 케이스 category, status에서 DUMMY 제거
jihyunk03 Nov 4, 2024
00fe8c8
Merge branch 'dev' into common/dev/refactor-presentation-date#1691
jihyunk03 Nov 4, 2024
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
32 changes: 32 additions & 0 deletions backend/database/cabi_local.sql
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,38 @@ CREATE TABLE `section_alarm`
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

DROP TABLE IF EXISTS `presentation`;
CREATE TABLE `presentation`
(
`id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`category` VARCHAR(255) NULL,
`date_time` DATETIME(6) NULL,
`detail` VARCHAR(500) NULL,
`presentation_location` VARCHAR(255) NULL,
`presentation_status` VARCHAR(255) NULL,
`presentation_time` VARCHAR(255) NULL,
`subject` VARCHAR(25) NULL,
`summary` VARCHAR(40) NULL,
`user_id` BIGINT NULL,
CONSTRAINT `presentation_user_id`
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

LOCK TABLES `presentation` WRITE;
/*!40000 ALTER TABLE `presentation`
DISABLE KEYS */;
INSERT INTO `presentation`
VALUES (1, 'JOB', '2024-10-09 22:56:47', 'DUMMY', 'FIRST', 'EXPECTED', 'HALF', 'DUMMY', 'DUMMY', NULL),
(2, NULL, '2024-10-23 22:56:47', 'DUMMY', 'FIRST', 'CANCEL', 'HALF', 'DUMMY', 'DUMMY', NULL),
(3, NULL, '2024-11-05 22:56:47', 'DUMMY', 'FIRST', 'EXPECTED', 'HALF', 'DUMMY', 'DUMMY', NULL),
(4, 'JOB', '2024-11-19 22:56:47', 'DUMMY', 'FIRST', 'EXPECTED', 'HALF', 'DUMMY', 'DUMMY', NULL),
(5, NULL, '2024-12-11 22:56:47', 'DUMMY', 'FIRST', 'EXPECTED', 'HALF', 'DUMMY', 'DUMMY', NULL),
(6, 'JOB', '2024-12-25 22:56:47', 'DUMMY', 'FIRST', 'EXPECTED', 'HALF', 'DUMMY', 'DUMMY', NULL);
/*!40000 ALTER TABLE `presentation`
ENABLE KEYS */;
UNLOCK TABLES;

/*!40103 SET TIME_ZONE = @OLD_TIME_ZONE */;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ftclub.cabinet.dto;

import java.time.LocalDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class AbleDateResponseDto {

private List<LocalDateTime> results;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public enum ExceptionStatus {
INVALID_CLUB_MASTER(HttpStatus.BAD_REQUEST, "동아리에 동아리 장이 없습니다."),
NOT_FOUND_CLUB_LENT_HISTORY(HttpStatus.NOT_FOUND, "동아리가 대여한 사물함이 없습니다."),
INVALID_PRESENTATION_CATEGORY(HttpStatus.BAD_REQUEST, "발표회에 정의된 카테고리가 아닙니다."),
INVALID_PRESENTATION_DATE(HttpStatus.BAD_REQUEST, "가능한 발표 날짜가 아닙니다"),
INVALID_DATE(HttpStatus.BAD_REQUEST, "잘못된 날짜입니다."),
PRESENTATION_ALREADY_EXISTED(HttpStatus.CONFLICT, "이미 예약된 발표 날짜입니다"),
NOT_FOUND_FORM(HttpStatus.NOT_FOUND, "신청서가 존재하지 않습니다."),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.ftclub.cabinet.mapper;

import java.time.LocalDate;
import java.util.List;
import org.ftclub.cabinet.dto.PresentationFormData;
import org.ftclub.cabinet.dto.PresentationFormRequestDto;
import org.ftclub.cabinet.dto.PresentationMainData;
import org.ftclub.cabinet.dto.PresentationMyPageDto;
import org.ftclub.cabinet.presentation.domain.Presentation;
Expand All @@ -19,5 +21,4 @@ public interface PresentationMapper {

PresentationMainData toPresentationMainData(List<PresentationFormData> past,
List<PresentationFormData> upcoming);

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.RequiredArgsConstructor;
import org.ftclub.cabinet.auth.domain.AuthGuard;
import org.ftclub.cabinet.auth.domain.AuthLevel;
import org.ftclub.cabinet.dto.AbleDateResponseDto;
import org.ftclub.cabinet.dto.InvalidDateResponseDto;
import org.ftclub.cabinet.dto.PresentationFormRequestDto;
import org.ftclub.cabinet.dto.PresentationFormResponseDto;
Expand Down Expand Up @@ -39,6 +40,11 @@ public void createPresentationForm(
presentationService.createPresentationForm(user.getUserId(), dto);
}

@GetMapping("/able-date")
public AbleDateResponseDto getAbleDate() {
return presentationService.getAbleDate();
}

@GetMapping("/form/invalid-date")
public InvalidDateResponseDto getInvalidDate() {
return presentationService.getInvalidDate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -19,6 +20,7 @@

@Entity
@Getter
@Table(name = "PRESENTATION")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Presentation {

Expand Down Expand Up @@ -56,12 +58,11 @@ public class Presentation {

@Setter
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "USER_ID")
@JoinColumn(name = "USER_ID", nullable = true)
private User user;

protected Presentation(Category category, LocalDateTime dateTime,
protected Presentation(LocalDateTime dateTime,
PresentationTime presentationTime, String subject, String summary, String detail) {
this.category = category;
this.dateTime = dateTime;
this.presentationTime = presentationTime;
this.subject = subject;
Expand All @@ -71,10 +72,10 @@ protected Presentation(Category category, LocalDateTime dateTime,
this.presentationLocation = PresentationLocation.BASEMENT;
}

public static Presentation of(Category category, LocalDateTime dateTime,
public static Presentation of(LocalDateTime dateTime,
PresentationTime presentationTime, String subject, String summary, String detail) {

return new Presentation(category, dateTime, presentationTime, subject, summary, detail);
return new Presentation(dateTime, presentationTime, subject, summary, detail);
}

public void adminUpdate(PresentationStatus newStatus, LocalDateTime newDateTime,
Expand All @@ -83,4 +84,16 @@ public void adminUpdate(PresentationStatus newStatus, LocalDateTime newDateTime,
this.dateTime = newDateTime;
this.presentationLocation = newLocation;
}

public void updateDummyToUserForm(Category category,
PresentationTime presentationTime, LocalDateTime presentationDateTime,
String subject, String summary, String detail) {
this.category = category;
this.presentationTime = presentationTime;
this.dateTime = presentationDateTime;
this.subject = subject;
this.summary = summary;
this.detail = detail;
this.presentationStatus = PresentationStatus.EXPECTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ public interface PresentationRepository extends JpaRepository<Presentation, Long

@EntityGraph(attributePaths = "user")
List<Presentation> findAllByDateTimeBetweenOrderByDateTime(LocalDateTime start,
LocalDateTime end);
LocalDateTime end);

List<Presentation> findAllByDateTimeBetween(LocalDateTime start, LocalDateTime end);

@EntityGraph(attributePaths = "user")
List<Presentation> findByDateTimeBetween(@Param("start") LocalDateTime start,
@Param("end") LocalDateTime end, Pageable pageable);

@Query("SELECT p "
+ "FROM Presentation p "
+ "WHERE p.user.id = :userId")
+ "FROM Presentation p "
+ "WHERE p.user.id = :userId")
Page<Presentation> findPaginationById(@Param("userId") Long userId, Pageable pageable);

@Query("SELECT p "
+ "FROM Presentation p "
+ "WHERE p.user IS NOT NULL "
+ "AND p.dateTime BETWEEN :start AND :end")
List<Presentation> findAllBetweenAndNotNullUser(
@Param("start") LocalDateTime start,
@Param("end") LocalDateTime end,
Pageable pageable
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.RequiredArgsConstructor;
import org.ftclub.cabinet.exception.ExceptionStatus;
import org.ftclub.cabinet.presentation.domain.Presentation;
import org.ftclub.cabinet.presentation.domain.PresentationLocation;
import org.ftclub.cabinet.presentation.domain.PresentationStatus;
import org.ftclub.cabinet.presentation.repository.PresentationRepository;
import org.springframework.stereotype.Service;
Expand All @@ -33,23 +32,23 @@ public void verifyReservationDate(LocalDateTime localDateTime) {
LocalDateTime endOfDay = startOfDay.plusDays(1);

if (isOverRangeDate(reservationDate, now)
|| isAlreadyRegisteredDate(startOfDay,
endOfDay)) {
|| isAlreadyRegisteredDate(startOfDay, endOfDay)) {
throw ExceptionStatus.INVALID_DATE.asServiceException();
}
}

private boolean isAlreadyRegisteredDate(LocalDateTime startOfDay, LocalDateTime endOfDay) {
List<Presentation> presentations =
presentationRepository.findAllByDateTimeBetween(startOfDay, endOfDay);
presentationRepository.findAllByDateTimeBetween(startOfDay, endOfDay);

return presentations.stream()
.anyMatch(presentation ->
!presentation.getPresentationStatus().equals(PresentationStatus.CANCEL));
.anyMatch(presentation -> presentation.getUser() != null
&& presentation.getPresentationStatus()
.equals(PresentationStatus.EXPECTED));
}

private boolean isOverRangeDate(LocalDate reservationDate, LocalDate now) {
return reservationDate.isBefore(now) ||
reservationDate.isAfter(now.plusMonths(MAXIMUM_MONTH));
reservationDate.isAfter(now.plusMonths(MAXIMUM_MONTH));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.ftclub.cabinet.exception.ExceptionStatus;
import org.ftclub.cabinet.presentation.domain.Presentation;
import org.ftclub.cabinet.presentation.domain.PresentationStatus;
import org.ftclub.cabinet.presentation.repository.PresentationRepository;
Expand All @@ -23,30 +24,54 @@ public class PresentationQueryService {

public List<Presentation> getRegisteredPresentations(LocalDateTime start, LocalDateTime end) {
List<Presentation> presentations =
presentationRepository.findAllByDateTimeBetween(start, end);
presentationRepository.findAllByDateTimeBetween(start, end);

return presentations.stream()
.filter(presentation ->
!presentation.getPresentationStatus().equals(PresentationStatus.CANCEL))
.collect(Collectors.toList());
}

public List<Presentation> getPresentationsBetweenWithPageRequest(LocalDateTime start,
LocalDateTime end,
PageRequest pageRequest) {
return presentationRepository.findByDateTimeBetween(start, end, pageRequest);
.filter(presentation ->
presentation.getPresentationStatus().equals(PresentationStatus.EXPECTED)
&& presentation.getUser() != null
)
.collect(Collectors.toList());
}

public List<Presentation> getPresentationsByYearMonth(YearMonth yearMonth) {
LocalDateTime startDate = yearMonth.atDay(START_DAY).atStartOfDay();
LocalDateTime endDayDate = yearMonth.atEndOfMonth().atTime(23, 59, 59);

return presentationRepository.findAllByDateTimeBetweenOrderByDateTime(startDate,
endDayDate);
endDayDate);
}

public Presentation getOneDummyByDate(LocalDateTime dateTime) {
LocalDateTime startOfDate = dateTime.withHour(0).withMinute(0).withSecond(0);
LocalDateTime endOfDate = dateTime.withHour(23).withMinute(59).withSecond(59);
return presentationRepository.findAllByDateTimeBetween(startOfDate, endOfDate)
.stream()
.filter(p -> p.getUser() == null)
.findFirst()
.orElseThrow(ExceptionStatus.INVALID_PRESENTATION_DATE::asServiceException);
}

public Page<Presentation> getPresentationsById(Long id, Pageable pageable) {
return presentationRepository.findPaginationById(id, pageable);
}

public List<Presentation> getDummyDateBetweenMonth(
LocalDateTime now,
LocalDateTime localDateTime) {

List<Presentation> presentations =
presentationRepository.findAllByDateTimeBetweenOrderByDateTime(now, localDateTime);

return presentations.stream()
.filter(presentation -> presentation.getUser() == null)
.collect(Collectors.toList());
}

public List<Presentation> findUserFormsWithinPeriod(
LocalDateTime start,
LocalDateTime end,
PageRequest pageRequest) {
return presentationRepository.findAllBetweenAndNotNullUser(start, end, pageRequest);
}
}
Loading
Loading