Skip to content

Commit

Permalink
Merge pull request #343 from 2022-bancow-teamProject/feature/kim-jihun
Browse files Browse the repository at this point in the history
[REFACTOR] Find Manger Change Json
  • Loading branch information
kho903 authored Feb 13, 2022
2 parents fbef500 + 59d5efc commit 1b8afd8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import com.bancow.bancowback.domain.common.dto.Response;
import com.bancow.bancowback.domain.common.dto.ServiceResult;
import com.bancow.bancowback.domain.manager.dto.ManagerRequestDto;
import com.bancow.bancowback.domain.manager.dto.ManagerResponseDto;
import com.bancow.bancowback.domain.manager.dto.ManagerFindDto;
import com.bancow.bancowback.domain.manager.dto.ManagerLoginDto;
import com.bancow.bancowback.domain.manager.dto.ManagerLoginResultDto;
Expand Down Expand Up @@ -64,8 +64,8 @@ public Response<ServiceResult> statusToAdmin(@RequestHeader("TOKEN") String toke
}

@GetMapping("/allmanager")
public Response<Page<ManagerRequestDto>> findPagingManager(@RequestParam int page, @RequestHeader("TOKEN") String token) {
Page<ManagerRequestDto> pagingManager = managerService.findPagingManager(page, token);
public Response<Page<ManagerResponseDto>> findPagingManager(@RequestParam int page, @RequestHeader("TOKEN") String token) {
Page<ManagerResponseDto> pagingManager = managerService.findPagingManager(page, token);
return new Response<>(pagingManager, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.persistence.Enumerated;

import com.bancow.bancowback.domain.manager.entity.ManagerStatus;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -16,7 +17,7 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ManagerRequestDto {
public class ManagerResponseDto {

private Long id;

Expand All @@ -27,7 +28,9 @@ public class ManagerRequestDto {
@Enumerated(EnumType.STRING)
private ManagerStatus managerStatus;

@JsonProperty("create_date")
private LocalDateTime createDate;

@JsonProperty("update_date")
private LocalDateTime updateDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.bancow.bancowback.domain.common.util.PasswordUtils;
import com.bancow.bancowback.domain.manager.dto.ManagerRegisterDto;
import com.bancow.bancowback.domain.manager.dto.ManagerRequestDto;
import com.bancow.bancowback.domain.manager.dto.ManagerResponseDto;
import com.bancow.bancowback.domain.manager.entity.Manager;
import com.bancow.bancowback.domain.manager.entity.ManagerStatus;

Expand All @@ -28,8 +28,8 @@ default public Manager registerToEntity(ManagerRegisterDto dto) {
.build();
}

default public ManagerRequestDto toRequest(Manager manager) {
return ManagerRequestDto.builder()
default public ManagerResponseDto toRequest(Manager manager) {
return ManagerResponseDto.builder()
.id(manager.getId())
.email(manager.getEmail())
.username(manager.getUsername())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.bancow.bancowback.domain.manager.dto.ManagerLoginResultDto;
import com.bancow.bancowback.domain.manager.dto.ManagerPasswordDto;
import com.bancow.bancowback.domain.manager.dto.ManagerRegisterDto;
import com.bancow.bancowback.domain.manager.dto.ManagerRequestDto;
import com.bancow.bancowback.domain.manager.dto.ManagerResponseDto;
import com.bancow.bancowback.domain.manager.entity.Manager;
import com.bancow.bancowback.domain.manager.entity.ManagerStatus;
import com.bancow.bancowback.domain.manager.mapper.ManagerMapper;
Expand Down Expand Up @@ -111,7 +111,7 @@ public ServiceResult statusToAdmin(String token, Long id) {
return ServiceResult.success(manager.getUsername() + " 님의 상태를 ADMIN으로 변경하였습니다.");
}

public Page<ManagerRequestDto> findPagingManager(int page, String token) {
public Page<ManagerResponseDto> findPagingManager(int page, String token) {

tokenService.validTokenSuper(token);
Page<Manager> allManager = managerRepository.findAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ void findAllManager() throws Exception {
fieldWithPath("data.content[0].email").description("이메일"),
fieldWithPath("data.content[0].username").description("이름"),
fieldWithPath("data.content[0].managerStatus").description("Manager 상태"),
fieldWithPath("data.content[0].createDate").description("Manager 생성일"),
fieldWithPath("data.content[0].updateDate").description("Manager 수정일"),
fieldWithPath("data.content[0].create_date").description("Manager 생성일"),
fieldWithPath("data.content[0].update_date").description("Manager 수정일"),
fieldWithPath("data.pageable").description("Pageable 설명"),
fieldWithPath("data.pageable.sort").description("페이지 정렬 설명"),
fieldWithPath("data.pageable.sort.empty").description("비어있는 지 여부"),
Expand Down

0 comments on commit 1b8afd8

Please sign in to comment.