Skip to content

Commit

Permalink
Merge branch 'main' into fix/#174
Browse files Browse the repository at this point in the history
  • Loading branch information
2hyunjinn authored Jan 22, 2025
2 parents f421d35 + 0e3bca3 commit 32d47f9
Show file tree
Hide file tree
Showing 31 changed files with 93 additions and 96 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/ggang/be/api/facade/TimeTableFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
public class TimeTableFacade {
private final LectureTimeSlotService lectureTimeSlotService;
private final UserService userService;
private final ReadCommonInvalidTimeVoMaker voMaker;

public ReadInvalidTimeResponse readMyInvalidTime(final long userId) {
UserEntity findUserEntity = userService.getUserById(userId);
List<LectureTimeSlotEntity> lectureTimeSlotEntities = lectureTimeSlotService.readUserTime(findUserEntity);

return ReadInvalidTimeResponse.fromVo(voMaker.convertToCommonResponse(lectureTimeSlotEntities));
return ReadInvalidTimeResponse.fromVo(ReadCommonInvalidTimeVoMaker.convertToCommonResponse(lectureTimeSlotEntities));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.dto.GroupVo;

import java.time.LocalDate;
Expand All @@ -14,7 +14,7 @@ public record ActiveGroupsResponse(
int profileImg,
GroupType groupType,
String groupTitle,
WeekDate weekDay,
WeekDay weekDay,
LocalDate weekDate,
double startTime,
double endTime,
Expand All @@ -28,8 +28,8 @@ public static ActiveGroupsResponse fromGroupVo(GroupVo groupVo) {
groupVo.profileImg(),
groupVo.groupType(),
groupVo.groupTitle(),
groupVo.weekDay(),
groupVo.weekDate(),
groupVo.groupDate(),
groupVo.startTime(),
groupVo.endTime(),
groupVo.location()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ggang/be/api/group/dto/GroupResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;

public record GroupResponse(
long groupId,
Expand All @@ -18,7 +18,7 @@ public record GroupResponse(
String introduction,
Category category,
int coverImg,
WeekDate weekDay,
WeekDay weekDay,
String weekDate,
double startTime,
double endTime
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/ggang/be/api/group/dto/LatestResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.dto.GroupVo;

import java.time.LocalDate;
Expand All @@ -15,8 +15,8 @@ public record LatestResponse(
String nickname,
GroupType groupType,
String groupTitle,
WeekDate weekDate,
LocalDate groupDate,
WeekDay weekDay,
LocalDate weekDate,
double startTime,
double endTime,
String location
Expand All @@ -30,8 +30,8 @@ public static LatestResponse fromGroupVo(GroupVo groupVo) {
groupVo.nickname(),
groupVo.groupType(),
groupVo.groupTitle(),
groupVo.weekDay(),
groupVo.weekDate(),
groupVo.groupDate(),
groupVo.startTime(),
groupVo.endTime(),
groupVo.location()
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/ggang/be/api/group/dto/MyGroupResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.dto.GroupVo;

import java.time.LocalDate;

public record MyGroupResponse(
long groupId, Status status, Category category, int coverImg, GroupType groupType,
String groupTitle, WeekDate weekDay, LocalDate weekDate, double startTime, double endTime, String location
long groupId, Status status, Category category, int coverImg, GroupType groupType,
String groupTitle, WeekDay weekDay, LocalDate weekDate, double startTime, double endTime, String location
) {
public static MyGroupResponse fromGroupVo(GroupVo groupVo) {
return new MyGroupResponse(
Expand All @@ -20,8 +20,8 @@ public static MyGroupResponse fromGroupVo(GroupVo groupVo) {
groupVo.coverImg(),
groupVo.groupType(),
groupVo.groupTitle(),
groupVo.weekDay(),
groupVo.weekDate(),
groupVo.groupDate(),
groupVo.startTime(),
groupVo.endTime(),
groupVo.location()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;

public record NearestGroupResponse(
long groupId,
Category category,
GroupType groupType,
String groupTitle,
WeekDate weekDay,
WeekDay weekDay,
String weekDate,
int currentPeopleCount,
int maxPeopleCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.dto.RegisterGroupServiceRequest;
import com.ggang.be.domain.timslot.gongbaekTimeSlot.dto.GongbaekTimeSlotRequest;
import com.ggang.be.domain.timslot.lectureTimeSlot.dto.LectureTimeSlotRequest;
Expand All @@ -16,7 +16,7 @@ public record RegisterGongbaekRequest(
GroupType groupType,
@DateTimeFormat(pattern = "yyyy-MM-dd")
LocalDate weekDate,
WeekDate weekDay,
WeekDay weekDay,
double startTime,
double endTime,
Category category,
Expand All @@ -34,7 +34,7 @@ public static LectureTimeSlotRequest toLectureTimeSlotRequest(
userEntity,
request.startTime(),
request.endTime(),
WeekDate.fromDayOfWeek(request.weekDate().getDayOfWeek())
WeekDay.fromDayOfWeek(request.weekDate().getDayOfWeek())
);
else
return LectureTimeSlotRequest.of(
Expand All @@ -54,7 +54,7 @@ public static GongbaekTimeSlotRequest toGongbaekTimeSlotRequest(
userEntity,
request.startTime(),
request.endTime(),
WeekDate.fromDayOfWeek(request.weekDate().getDayOfWeek())
WeekDay.fromDayOfWeek(request.weekDate().getDayOfWeek())
);
} else {
return new GongbaekTimeSlotRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static GroupResponse fromEveryGroup(EveryGroupDto dto) {
dto.introduction(),
dto.category(),
dto.coverImg(),
dto.gongbaekTimeSlotEntity().getWeekDate(),
dto.gongbaekTimeSlotEntity().getWeekDay(),
null,
dto.gongbaekTimeSlotEntity().getStartTime(),
dto.gongbaekTimeSlotEntity().getEndTime()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ggang/be/api/user/vo/TimeTableVo.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ggang.be.api.user.vo;

import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.timslot.lectureTimeSlot.vo.LectureTimeSlotVo;

public record TimeTableVo(WeekDate weekDay,
public record TimeTableVo(WeekDay weekDay,
Double startTime,
Double endTime) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.time.DayOfWeek;
import java.time.LocalDate;

public enum WeekDate {
public enum WeekDay {
MON,
TUE,
WED,
Expand All @@ -12,7 +12,7 @@ public enum WeekDate {
SAT,
SUN;

public static WeekDate fromDayOfWeek(DayOfWeek dayOfWeek) {
public static WeekDay fromDayOfWeek(DayOfWeek dayOfWeek) {
return switch (dayOfWeek) {
case MONDAY -> MON;
case TUESDAY -> TUE;
Expand All @@ -24,8 +24,8 @@ public static WeekDate fromDayOfWeek(DayOfWeek dayOfWeek) {
};
}

public static DayOfWeek getDayOfWeekFromWeekDate(WeekDate weekDate) {
return switch (weekDate) {
public static DayOfWeek getDayOfWeekFromWeekDate(WeekDay weekDay) {
return switch (weekDay) {
case MON -> DayOfWeek.MONDAY;
case TUE -> DayOfWeek.TUESDAY;
case WED -> DayOfWeek.WEDNESDAY;
Expand All @@ -36,9 +36,9 @@ public static DayOfWeek getDayOfWeekFromWeekDate(WeekDate weekDate) {
};
}

public static LocalDate getNextMeetingDate(WeekDate weekDate) {
public static LocalDate getNextMeetingDate(WeekDay weekDay) {
LocalDate today = LocalDate.now();
DayOfWeek targetDay = getDayOfWeekFromWeekDate(weekDate);
DayOfWeek targetDay = getDayOfWeekFromWeekDate(weekDay);
LocalDate nextMeetingDate = today;

while (nextMeetingDate.getDayOfWeek() != targetDay) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/ggang/be/domain/group/dto/GroupVo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.everyGroup.dto.EveryGroupVo;
import com.ggang.be.domain.group.onceGroup.dto.OnceGroupVo;

Expand All @@ -12,7 +12,7 @@

public record GroupVo(long groupId, Status status, Category category, int coverImg, int profileImg, String nickname,
GroupType groupType,
String groupTitle, WeekDate weekDate, LocalDate groupDate, double startTime, double endTime, String location, LocalDateTime createdAt) {
String groupTitle, WeekDay weekDay, LocalDate weekDate, double startTime, double endTime, String location, LocalDateTime createdAt) {

public static GroupVo fromEveryGroup(EveryGroupVo everyGroupVo) {
return new GroupVo(
Expand All @@ -24,7 +24,7 @@ public static GroupVo fromEveryGroup(EveryGroupVo everyGroupVo) {
everyGroupVo.nickname(),
GroupType.WEEKLY,
everyGroupVo.groupTitle(),
everyGroupVo.weekDate(),
everyGroupVo.weekDay(),
null,
everyGroupVo.startTime(),
everyGroupVo.endTime(),
Expand All @@ -43,7 +43,7 @@ public static GroupVo fromOnceGroup(OnceGroupVo onceGroupVo) {
onceGroupVo.nickname(),
GroupType.ONCE,
onceGroupVo.groupTitle(),
WeekDate.fromDayOfWeek(onceGroupVo.dateTime().getDayOfWeek()),
WeekDay.fromDayOfWeek(onceGroupVo.dateTime().getDayOfWeek()),
onceGroupVo.dateTime(),
onceGroupVo.startTime(),
onceGroupVo.endTime(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.user.UserEntity;

import java.time.LocalDate;
Expand All @@ -11,7 +11,7 @@ public record RegisterGroupServiceRequest(
UserEntity userEntity,
GroupType groupType,
LocalDate weekDate,
WeekDate weekDay,
WeekDay weekDay,
double startTime,
double endTime,
Category category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.everyGroup.EveryGroupEntity;

import java.time.LocalDateTime;

public record EveryGroupVo(long groupId, Status status, Category category, int coverImg, int profileImg,
String nickname, GroupType groupType,
String groupTitle, WeekDate weekDate, double startTime, double endTime, String location, LocalDateTime createdAt) {
String groupTitle, WeekDay weekDay, double startTime, double endTime, String location, LocalDateTime createdAt) {
public static EveryGroupVo of(EveryGroupEntity everyGroupEntity) {
return new EveryGroupVo(
everyGroupEntity.getId(),
Expand All @@ -21,7 +21,7 @@ public static EveryGroupVo of(EveryGroupEntity everyGroupEntity) {
everyGroupEntity.getUserEntity().getNickname(),
GroupType.WEEKLY,
everyGroupEntity.getTitle(),
everyGroupEntity.getGongbaekTimeSlotEntity().getWeekDate(),
everyGroupEntity.getGongbaekTimeSlotEntity().getWeekDay(),
everyGroupEntity.getGongbaekTimeSlotEntity().getStartTime(),
everyGroupEntity.getGongbaekTimeSlotEntity().getEndTime(),
everyGroupEntity.getLocation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.everyGroup.EveryGroupEntity;
import com.ggang.be.domain.user.UserEntity;
import jakarta.persistence.LockModeType;
Expand All @@ -18,15 +18,15 @@ public interface EveryGroupRepository extends JpaRepository<EveryGroupEntity, Lo
@Query("SELECT CASE WHEN COUNT(o) > 0 THEN TRUE ELSE FALSE END " +
"FROM every_group o " +
"WHERE o.userEntity = :userEntity " +
"AND o.gongbaekTimeSlotEntity.weekDate = :weekDate " +
"AND o.gongbaekTimeSlotEntity.weekDay = :weekDay " +
"AND o.status != :status " +
"AND (" +
" (o.gongbaekTimeSlotEntity.startTime <= :startTime AND o.gongbaekTimeSlotEntity.endTime > :startTime) " +
" OR (o.gongbaekTimeSlotEntity.startTime < :endTime AND o.gongbaekTimeSlotEntity.endTime >= :endTime) " +
" OR (o.gongbaekTimeSlotEntity.startTime > :startTime AND o.gongbaekTimeSlotEntity.endTime < :endTime)" +
")")
boolean isInTime(UserEntity userEntity, double startTime, double endTime,
WeekDate weekDate, Status status);
WeekDay weekDay, Status status);

@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("select o from every_group o join fetch o.gongbaekTimeSlotEntity where o.status!=:status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ggang.be.domain.constant.Category;
import com.ggang.be.domain.constant.Status;
import com.ggang.be.domain.constant.WeekDate;
import com.ggang.be.domain.constant.WeekDay;
import com.ggang.be.domain.group.onceGroup.OnceGroupEntity;
import com.ggang.be.domain.timslot.gongbaekTimeSlot.GongbaekTimeSlotEntity;
import com.ggang.be.domain.user.UserEntity;
Expand All @@ -19,7 +19,7 @@ public record OnceGroupDto(
String introduction,
Category category,
int coverImg,
WeekDate weekDay,
WeekDay weekDay,
String weekDate,
GongbaekTimeSlotEntity gongbaekTimeSlotEntity
) {
Expand All @@ -37,12 +37,12 @@ public static OnceGroupDto toDto(OnceGroupEntity entity, UserEntity currentUser)
entity.getIntroduction(),
entity.getCategory(),
entity.getCoverImg(),
WeekDate.fromDayOfWeek(entity.getGroupDate().getDayOfWeek()),
WeekDay.fromDayOfWeek(entity.getGroupDate().getDayOfWeek()),
entity.getGroupDate().toString(),
GongbaekTimeSlotEntity.builder()
.startTime(entity.getGongbaekTimeSlotEntity().getStartTime())
.endTime(entity.getGongbaekTimeSlotEntity().getEndTime())
.weekDate(WeekDate.fromDayOfWeek(entity.getGroupDate().getDayOfWeek()))
.weekDay(WeekDay.fromDayOfWeek(entity.getGroupDate().getDayOfWeek()))
.userEntity(currentUser)
.build()
);
Expand Down
Loading

0 comments on commit 32d47f9

Please sign in to comment.