Skip to content

Commit

Permalink
[#6] chore: 포맷팅 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sss4920 committed Sep 24, 2024
1 parent 2e6c4c6 commit 1d1a260
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.List;

import lombok.Builder;

public record GatheringListResponseDto(List<GatheringResponseDto> gatherings) {
public static GatheringListResponseDto from(List<GatheringResponseDto> gatherings){
return new GatheringListResponseDto(gatherings);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package dev.office.networkoffice.gathering.controller.dto.response;

import java.time.LocalDateTime;

import dev.office.networkoffice.gathering.entity.Gathering;
import lombok.Builder;

@Builder
public record GatheringResponseDto(
String title,
Expand All @@ -16,8 +19,8 @@ public record GatheringResponseDto(
Double y,
String date,

String startTime,
String endTime
LocalDateTime startTime,
LocalDateTime endTime
) {
public static GatheringResponseDto from(Gathering gathering){
return GatheringResponseDto.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 신고 상태는 파토, 성공, 신고 이렇게 3가지 경우의 수가 있을 것 같습니다. 별점 이런것들도 고려하면 인터페이스등으로 추상화하는게 맞다고 생각합니다.
*/
public enum DeletedType {
PATO,
CANCELED,
SUCCESSFUL,
REPORT

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package dev.office.networkoffice.gathering.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;

import dev.office.networkoffice.gathering.entity.Applicants;
import dev.office.networkoffice.gathering.entity.Gathering;

public interface ApplicantRepository extends JpaRepository<Applicants, Long> {
List<Applicants> findAllByGathering(Gathering gathering);

List<Applicants> findAllByGatheringId(Long gatheringId);

Optional<Applicants> findByIdAndUserId(Long applicantId, Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.springframework.data.jpa.repository.JpaRepository;

import dev.office.networkoffice.gathering.entity.DeletedGathering;
import dev.office.networkoffice.gathering.entity.DeletedGatheringManager;

public interface DeletedGatheringManagerRepository extends JpaRepository<DeletedGatheringManager, Long> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import org.springframework.data.jpa.repository.Query;

import dev.office.networkoffice.gathering.domain.GatheringAuthority;
import dev.office.networkoffice.gathering.entity.Gathering;
import dev.office.networkoffice.gathering.entity.GatheringUserConfirmManager;
import dev.office.networkoffice.user.entity.User;

public interface GatheringManagerRepository extends JpaRepository<GatheringUserConfirmManager, Long> {
@Query("""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package dev.office.networkoffice.gathering.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import dev.office.networkoffice.gathering.entity.Gathering;
import dev.office.networkoffice.user.entity.User;

public interface GatheringRepository extends JpaRepository<Gathering, Long> {
Optional<Gathering> findByHostId(Long hostId);

@Query("""
SELECT g
FROM Gathering g
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void applyGathering(Long userId, Long gatheringId){

User user = getUserById(userId);
Gathering gathering = getGatheringById(gatheringId);
//기존 모임에 이미 user가 있는지 체크
//TODO: 기존 모임에 이미 user가 있는지 체크

//신청 엔티티 생성
Applicants applicants = Applicants.builder()
Expand All @@ -50,7 +50,8 @@ public void applyGathering(Long userId, Long gatheringId){

@Transactional(readOnly = true)
public List<Applicants> readApplicantsByGathering(Long hostId, Long gatheringId) {
return applicantRepository.findByGatheringIdAndUserId(gatheringId, hostId);
managerService.findAuthorityManager_withHostIdAndGatheringId(hostId,gatheringId);
return applicantRepository.findAllByGatheringId(gatheringId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void createConfirmedUserAuthority(Gathering gathering, User confirmedUser
.build());
}

public GatheringUserConfirmManager findAuthorityManager_withHostIdAndGatheringId(Long gatheringId, Long hostId){
public GatheringUserConfirmManager findAuthorityManager_withHostIdAndGatheringId(Long hostId, Long gatheringId){
//TODO: not found exception
return gatheringManagerRepository.findByGatheringAndUser(gatheringId,hostId,GatheringAuthority.HOST).orElseThrow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ public void deleteGatheringByHost(Long hostId, Long gatheringId, String reason,
.reason(reason)
.deletedType(deletedType)
.build());

deletedGatheringManagerService.savingDeletedGathering(
confirmManager.getUser(),
deletedGathering
);

gatheringManagerRepository.delete(confirmManager);//삭제
}

Expand Down

0 comments on commit 1d1a260

Please sign in to comment.