Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into fix/club-post-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
goalSetter09 committed Aug 22, 2024
2 parents e582bf7 + 739fa56 commit de40df0
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.cotato.squadus.api.club.dto.*;
import com.cotato.squadus.common.config.auth.CustomOAuth2Member;
import com.cotato.squadus.domain.auth.service.ClubMemberService;
import com.cotato.squadus.domain.club.common.enums.SportsCategory;
import com.cotato.squadus.domain.club.common.service.ClubService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -17,6 +18,8 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Tag(name = "동아리", description = "동아리 관련 API")
@RestController
@RequestMapping("/v1/api/clubs")
Expand Down Expand Up @@ -88,4 +91,14 @@ public ResponseEntity<ClubUpdateResponse> updateClub(
ClubUpdateResponse clubUpdateResponse = clubService.updateClub(customOAuth2Member, clubId, clubUpdateRequest, logoImage);
return ResponseEntity.ok(clubUpdateResponse);
}


@GetMapping("/ranking/{sportsCategory}")
@Operation(summary = "랭킹 목록 조회", description = "랭킹 페이지로 들어가면 ALL TIME 기준의 랭킹 정보를 순위대로 얻을 수 있다.")
public ResponseEntity<List<ClubRankResponse>> getRanking(@PathVariable SportsCategory sportsCategory) {
List<ClubRankResponse> ranking = clubService.getRanking(sportsCategory);
return ResponseEntity.ok(ranking);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,18 @@ public ResponseEntity<MatchCreateResponse> createMatch(@RequestBody MatchCreateR

@GetMapping
@Operation(summary = "모든 매칭 조회", description = "모든 매칭 게시글을 조회합니다.")
public ResponseEntity<MatchCreateResponseWrapper> getAllMatches(@RequestParam Long clubMemberId) {
List<MatchCreateResponse> responses = matchService.findAllMatches(clubMemberId);
public ResponseEntity<MatchCreateResponseWrapper> getAllMatches() {
List<MatchCreateResponse> responses = matchService.findAllMatches();
return ResponseEntity.ok(MatchCreateResponseWrapper.from(responses));
}

@GetMapping("/paged")
@Operation(summary = "모든 매칭 조회 (페이징)", description = "모든 매칭 게시글을 페이징 처리하여 조회합니다.")
public ResponseEntity<MatchCreateResponseWrapper> getAllMatchesPaged(
@RequestParam Long clubMemberId,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "10") int size) {
Pageable pageable = PageRequest.of(page, size);
Page<MatchCreateResponse> responses = matchService.findAllMatches(clubMemberId, pageable);
Page<MatchCreateResponse> responses = matchService.findAllMatches(pageable);
return ResponseEntity.ok(MatchCreateResponseWrapper.from(responses));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public record MatchCreateResponse(
LocalDate matchStartDate,
LocalTime matchStartTime,
Integer maxParticipants,
Long clubIdx,
String sportsCategory,
String clubName,
String clubLogo
Expand All @@ -30,6 +31,7 @@ public static MatchCreateResponse from(MatchPost matchPost) {
matchPost.getMatchStartDate(),
matchPost.getMatchStartTime(),
matchPost.getMaxParticipants(),
matchPost.getHomeClub().getClubId(),
matchPost.getHomeClub().getSportsCategory().name(),
matchPost.getHomeClub().getClubName(),
matchPost.getHomeClub().getLogo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@ public ResponseEntity<MercenaryCreateResponse> createMatch(@RequestBody Mercenar
}

@GetMapping
@Operation(summary = "모든 용병 매칭 조회", description = "모든 용병 매칭 게시글을 조회합니다. 자신이 속한 동아리에서 올린 정보는 보이지 않습니다.")
public ResponseEntity<MercenaryCreateResponseWrapper> getAllMatches(@RequestParam Long clubMemberId) {
List<MercenaryCreateResponse> responses = mercenaryService.findAllMatches(clubMemberId);
@Operation(summary = "모든 용병 매칭 조회", description = "모든 용병 매칭 게시글을 조회합니다")
public ResponseEntity<MercenaryCreateResponseWrapper> getAllMatches() {
List<MercenaryCreateResponse> responses = mercenaryService.findAllMatches();
return ResponseEntity.ok(MercenaryCreateResponseWrapper.from(responses));
}

@GetMapping("/paged")
@Operation(summary = "모든 용병 매칭 조회 (페이징)", description = "모든 용병 매칭 게시글을 페이징(10개) 처리하여 조회합니다.")
public ResponseEntity<MercenaryCreateResponseWrapper> getAllMatchesPaged(
@RequestParam Long clubMemberId,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "10") int size) {
Pageable pageable = PageRequest.of(page, size);
Page<MercenaryCreateResponse> responses = mercenaryService.findAllMatches(clubMemberId, pageable);
Page<MercenaryCreateResponse> responses = mercenaryService.findAllMatches(pageable);
return ResponseEntity.ok(MercenaryCreateResponseWrapper.from(responses));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.cotato.squadus.api.match.dto.matchPost.request.MatchCreateRequest;
import com.cotato.squadus.domain.club.common.entity.Tier;
import com.cotato.squadus.domain.club.common.enums.SportsCategory;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

Expand All @@ -19,6 +21,9 @@ public class MercenaryCreateRequest {
private MatchPlaceRequest matchPlace;
private Boolean placeProvided;
private LocalDate matchStartDate;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
@Schema(description = "Match start time in format HH:mm", example = "10:00")
private LocalTime matchStartTime;
private Integer maxParticipants;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public record MercenaryCreateResponse(
LocalTime matchStartTime,
Integer maxParticipants,
Integer currentParticipants,
Long clubIdx,
String sportsCategory,
String clubName,
String clubLogo
Expand All @@ -31,6 +32,7 @@ public static MercenaryCreateResponse from(MercenaryPost mercenaryPost) {
mercenaryPost.getMatchStartTime(),
mercenaryPost.getMaxParticipants(),
mercenaryPost.getCurrentParticipants(),
mercenaryPost.getHomeClub().getClubId(),
mercenaryPost.getHomeClub().getSportsCategory().name(),
mercenaryPost.getHomeClub().getClubName(),
mercenaryPost.getHomeClub().getLogo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,24 @@ public String joinEmail(String email) {
String customerMail = email;
String title = "학교 인증을 위한 이메일입니다";
String content =
"이메일을 인증하기 위한 절차입니다." +
"<b>안녕하세요!</b> \uD83D\uDC4B" +
"<br><br>" +
"인증 번호는 " + authNumber + "입니다." +
"이메일 인증을 완료하기 위해 아래 절차를 진행해 주세요:" +
"<br><br>" +
"<b>1. 인증 번호 입력</b> \uD83D\uDCDD" +
"<br>" +
"학교 인증 칸에 해당 번호를 입력해주세요.";
"인증 번호 : " + "<b>" + authNumber + "</b>" +
"<br><br>" +
"2. 학교 인증 칸에 해당 번호를 입력해 주세요. \uD83D\uDD11" +
"<br><br>" +
"인증 절차가 완료되면, 추가적인 안내를 드리겠습니다." +
"<br><br>" +
"감사합니다! \uD83D\uDE0A";
// "이메일을 인증하기 위한 절차입니다." +
// "<br><br>" +
// "인증 번호는 " + authNumber + "입니다." +
// "<br>" +
// "학교 인증 칸에 해당 번호를 입력해주세요.";
mailSend(serviceName, customerMail, title, content);
return Integer.toString(authNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public interface ClubRepository extends JpaRepository<Club, Long> {

List<Club> findBySportsCategoryOrderByMatchScoreDesc(SportsCategory sportsCategory);

long countBySportsCategory(SportsCategory sportsCategory);
// List<Club> findBySportsCategoryAndMatchDateBetweenOrderByMatchScoreDesc(SportsCategory sportsCategory, LocalDate startDate, LocalDate endDate);

}
Loading

0 comments on commit de40df0

Please sign in to comment.