Skip to content

Commit

Permalink
Merge pull request #197 from Soongsil-CoffeeChat/fix/#196
Browse files Browse the repository at this point in the history
[FIX] 모바일 파트 추가, 멘토링 시간대 삭제 기능 추가
  • Loading branch information
KimKyoHwee authored Dec 9, 2024
2 parents 510b10b + 562b725 commit 530e306
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ private void addSameSiteCookie(HttpServletResponse response, String name, String
ResponseCookie responseCookie = ResponseCookie.from(name, value)
.httpOnly(true)
.secure(true)
.path("/")
.maxAge(24 * 60 * 60)
//.domain("coffeego-ssu.web.app") // 정확한 도메인 설정
.path("/")
.sameSite("None")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@

import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import com.soongsil.CoffeeChat.controller.handler.ApiResponseGenerator;
import com.soongsil.CoffeeChat.dto.Oauth.CustomOAuth2User;
Expand Down Expand Up @@ -79,4 +74,17 @@ public ResponseEntity<ApiResponseGenerator<List<PossibleDateCreateGetResponseDto
)
);
}

@DeleteMapping("{possibleDateId}")
@Operation(summary = "시간대ID로 등록한 시간대 삭제")
@ApiResponse(responseCode = "200", description = "삭제 성공")
public ResponseEntity<ApiResponseGenerator<String>> deletePossibleDates(
Authentication authentication,
@PathVariable("possibleDateId") Long possibleDateId
) throws Exception {
return ResponseEntity.ok().body(
ApiResponseGenerator.onSuccessOK(
possibleDateService.deletePossibleDate(possibleDateId, getUserNameByAuthentication(authentication)))
);
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/soongsil/CoffeeChat/enums/PartEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public enum PartEnum {
FE,
BE,
PM,
DESIGN
DESIGN,
MOBILE
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import com.soongsil.CoffeeChat.dto.PossibleDateCreateGetResponseDto;
import com.soongsil.CoffeeChat.entity.PossibleDate;

public interface PossibleDateRepositoryCustom {
List<PossibleDateCreateGetResponseDto> getPossibleDatesByUsername(String username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ public List<PossibleDateCreateGetResponseDto> getPossibleDatesByUsername(String
))
.fetch();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import static com.soongsil.CoffeeChat.controller.exception.enums.UserErrorCode.USER_NOT_FOUND;
Expand Down Expand Up @@ -85,4 +86,18 @@ public List<PossibleDateCreateGetResponseDto> findMentorPossibleDateListByUserna
User user = findUserByUsername(username);
return findPossibleDateListByMentor(user.getMentor().getId());
}

public String deletePossibleDate(Long possibleDateId, String username) {
// ID가 존재하는지 확인하고 예외 처리
if (!possibleDateRepository.existsById(possibleDateId)) {
throw new IllegalArgumentException("The specified possibleDateId does not exist: " + possibleDateId);
}

// 삭제 수행
possibleDateRepository.deleteById(possibleDateId);

// 삭제 후 성공 여부 반환 (일반적으로 예외가 없으면 삭제 성공)
return "삭제완료";
}

}

0 comments on commit 530e306

Please sign in to comment.