Skip to content

Commit

Permalink
Merge pull request #417 from KEEPER31337/feature/세미나_출석_정보_조회시_이름_정렬_추가
Browse files Browse the repository at this point in the history
Feature/세미나 출석 정보 조회시 기수와 이름 정렬을 추가한다.
  • Loading branch information
lcqff authored Mar 4, 2024
2 parents b6e1082 + 550782c commit b85c629
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
Expand Down Expand Up @@ -49,7 +50,7 @@ public ResponseEntity<Page<SeminarAttendanceManageResponse>> getAttendances(
@RequestParam(defaultValue = "10") @PositiveOrZero int size
) {
Page<SeminarAttendanceManageResponse> responses = seminarAttendanceService.getAttendances(
PageRequest.of(page, size));
PageRequest.of(page, size, Sort.by(Sort.DEFAULT_DIRECTION, "generation.generation").and(Sort.by(Sort.DEFAULT_DIRECTION,"profile.realName"))));
return ResponseEntity.ok(responses);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.keeper.homepage.domain.member.entity.Member;
import com.keeper.homepage.domain.member.entity.embedded.RealName;
import com.keeper.homepage.domain.seminar.dto.request.SeminarAttendanceCodeRequest;
import com.keeper.homepage.domain.seminar.dto.request.SeminarAttendanceStatusRequest;
import com.keeper.homepage.domain.seminar.dto.request.SeminarStartRequest;
Expand Down Expand Up @@ -56,8 +57,8 @@ public class SeminarAttendanceControllerTest extends SeminarApiTestHelper {

@BeforeEach
void setUp() {
adminId = memberTestHelper.builder().build().getId();
userId = memberTestHelper.builder().build().getId();
adminId = memberTestHelper.builder().realName(RealName.from("김영환")).build().getId();
userId = memberTestHelper.builder().realName(RealName.from("김기철")).build().getId();
adminToken = jwtTokenProvider.createAccessToken(ACCESS_TOKEN, adminId, ROLE_회원, ROLE_회장);
userToken = jwtTokenProvider.createAccessToken(ACCESS_TOKEN, userId, ROLE_회원);

Expand Down Expand Up @@ -268,17 +269,17 @@ class GetSeminarAttendanceTest {
mockMvc.perform(get("/seminars/attendances")
.cookie(new Cookie(ACCESS_TOKEN.getTokenName(), adminToken)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.content[0].memberId").value(adminId))
.andExpect(jsonPath("$.content[0].memberName").value(admin.getRealName()))
.andExpect(jsonPath("$.content[0].generation").value(admin.getGeneration()))
.andExpect(jsonPath("$.content[0].attendances[0].attendanceStatus").value(ATTENDANCE.toString()))
.andExpect(jsonPath("$.content[0].memberId").value(userId))
.andExpect(jsonPath("$.content[0].memberName").value(user.getRealName()))
.andExpect(jsonPath("$.content[0].generation").value(user.getGeneration()))
.andExpect(jsonPath("$.content[0].attendances[0].attendanceId").value(attendanceId))
.andExpect(jsonPath("$.content[0].attendances[0].attendanceStatus").value(LATENESS.toString()))
.andExpect(jsonPath("$.content[0].attendances[0].excuse").isEmpty())
.andExpect(jsonPath("$.content[0].attendances[0].attendDate").value(LocalDate.now().toString()))
.andExpect(jsonPath("$.content[1].memberId").value(userId))
.andExpect(jsonPath("$.content[1].memberName").value(user.getRealName()))
.andExpect(jsonPath("$.content[1].generation").value(user.getGeneration()))
.andExpect(jsonPath("$.content[1].attendances[0].attendanceId").value(attendanceId))
.andExpect(jsonPath("$.content[1].attendances[0].attendanceStatus").value(LATENESS.toString()))
.andExpect(jsonPath("$.content[1].memberId").value(adminId))
.andExpect(jsonPath("$.content[1].memberName").value(admin.getRealName()))
.andExpect(jsonPath("$.content[1].generation").value(admin.getGeneration()))
.andExpect(jsonPath("$.content[1].attendances[0].attendanceStatus").value(ATTENDANCE.toString()))
.andExpect(jsonPath("$.content[1].attendances[0].excuse").isEmpty())
.andExpect(jsonPath("$.content[1].attendances[0].attendDate").value(LocalDate.now().toString()))
.andDo(document("get-seminar-attendances",
Expand Down

0 comments on commit b85c629

Please sign in to comment.