Skip to content

Commit

Permalink
feat: temp deploy version
Browse files Browse the repository at this point in the history
  • Loading branch information
ohksj77 committed Oct 4, 2024
1 parent aca443e commit ce20d83
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dragonguard.backend.domain.admin.annotation.Admin;
import com.dragonguard.backend.domain.admin.dto.request.AdminDecideRequest;
import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponse;
import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponses;
import com.dragonguard.backend.domain.admin.service.AdminService;
import com.dragonguard.backend.domain.organization.entity.OrganizationStatus;

Expand All @@ -12,8 +12,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import javax.validation.Valid;

/**
Expand All @@ -35,14 +33,14 @@ public ResponseEntity<Void> checkAdmin() {

/** 조직 승인 요청에 대해 관리자의 선택에 대한 요청을 받는 api */
@PostMapping("/organizations/decide")
public ResponseEntity<List<AdminOrganizationResponse>> decideRequest(
public ResponseEntity<AdminOrganizationResponses> decideRequest(
@RequestBody @Valid final AdminDecideRequest adminDecideRequest) {
return ResponseEntity.ok(adminService.decideRequestedOrganization(adminDecideRequest));
}

/** 조직의 승인 여부에 따른 조회 */
@GetMapping("/organizations")
public ResponseEntity<List<AdminOrganizationResponse>> getOrganizationsByStatus(
public ResponseEntity<AdminOrganizationResponses> getOrganizationsByStatus(
@RequestParam final OrganizationStatus status, final Pageable pageable) {
return ResponseEntity.ok(adminService.findOrganizationsByStatus(status, pageable));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dragonguard.backend.domain.admin.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class AdminOrganizationResponses {
private List<AdminOrganizationResponse> data;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dragonguard.backend.domain.admin.service;

import com.dragonguard.backend.domain.admin.dto.request.AdminDecideRequest;
import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponse;
import com.dragonguard.backend.domain.admin.dto.response.AdminOrganizationResponses;
import com.dragonguard.backend.domain.admin.mapper.AdminMapper;
import com.dragonguard.backend.domain.organization.entity.Organization;
import com.dragonguard.backend.domain.organization.entity.OrganizationStatus;
Expand Down Expand Up @@ -29,7 +29,7 @@ public class AdminService {
private final OrganizationRepository organizationRepository;
private final AdminMapper adminMapper;

public List<AdminOrganizationResponse> decideRequestedOrganization(
public AdminOrganizationResponses decideRequestedOrganization(
final AdminDecideRequest adminDecideRequest) {
final Organization organization = getOrganization(adminDecideRequest);
final OrganizationStatus beforeStatus = organization.getOrganizationStatus();
Expand All @@ -39,7 +39,7 @@ public List<AdminOrganizationResponse> decideRequestedOrganization(
organizationRepository.findAllByOrganizationStatus(
beforeStatus, PageRequest.of(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));

return adminMapper.toResponseList(organizations);
return new AdminOrganizationResponses(adminMapper.toResponseList(organizations));
}

private Organization getOrganization(final AdminDecideRequest adminDecideRequest) {
Expand All @@ -49,11 +49,11 @@ private Organization getOrganization(final AdminDecideRequest adminDecideRequest
}

@Transactional(readOnly = true)
public List<AdminOrganizationResponse> findOrganizationsByStatus(
public AdminOrganizationResponses findOrganizationsByStatus(
final OrganizationStatus status, final Pageable pageable) {
List<Organization> organizations =
organizationRepository.findAllByOrganizationStatus(status, pageable);

return adminMapper.toResponseList(organizations);
return new AdminOrganizationResponses(adminMapper.toResponseList(organizations));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dragonguard.backend.domain.blockchain.controller;

import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponse;
import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponses;
import com.dragonguard.backend.domain.blockchain.service.BlockchainService;

import lombok.RequiredArgsConstructor;
Expand All @@ -10,8 +10,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* @author 김승진
* @description 블록체인 관련 요청을 처리하는 컨트롤러
Expand All @@ -24,7 +22,7 @@ public class BlockchainController {

/** 블록체인 부여 내역을 조회하는 api */
@GetMapping
public ResponseEntity<List<BlockchainResponse>> getBlockchainInfo() {
public ResponseEntity<BlockchainResponses> getBlockchainInfo() {
return ResponseEntity.ok(blockchainService.getBlockchainList());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dragonguard.backend.domain.blockchain.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class BlockchainResponses {
private List<BlockchainResponse> data;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dragonguard.backend.domain.blockchain.service;

import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponse;
import com.dragonguard.backend.domain.blockchain.dto.response.BlockchainResponses;
import com.dragonguard.backend.domain.blockchain.entity.Blockchain;
import com.dragonguard.backend.domain.blockchain.entity.ContributeType;
import com.dragonguard.backend.domain.blockchain.mapper.BlockchainMapper;
Expand Down Expand Up @@ -73,9 +74,9 @@ private String transferTransaction(
}

@Transactional(readOnly = true)
public List<BlockchainResponse> getBlockchainList() {
public BlockchainResponses getBlockchainList() {
final UUID memberId = authService.getLoginUserId();
return getBlockchainResponses(memberId);
return new BlockchainResponses(getBlockchainResponses(memberId));
}

private List<BlockchainResponse> getBlockchainResponses(final UUID memberId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dragonguard.backend.domain.organization.dto.request.AddMemberRequest;
import com.dragonguard.backend.domain.organization.dto.request.OrganizationRequest;
import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponse;
import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponses;
import com.dragonguard.backend.domain.organization.entity.OrganizationType;
import com.dragonguard.backend.domain.organization.service.OrganizationEmailFacade;
import com.dragonguard.backend.global.dto.IdResponse;
Expand All @@ -13,8 +13,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import javax.validation.Valid;

/**
Expand Down Expand Up @@ -49,27 +47,27 @@ public ResponseEntity<IdResponse<Long>> addMemberToOrganization(

/** 조직 타입별 조회 api */
@GetMapping
public ResponseEntity<List<OrganizationResponse>> getOrganizations(
public ResponseEntity<OrganizationResponses> getOrganizations(
@RequestParam final OrganizationType type, final Pageable pageable) {
return ResponseEntity.ok(organizationService.findByType(type, pageable));
}

/** 조직 자체의 랭킹을 페이징을 통해 조회하는 api */
@GetMapping("/ranking/all")
public ResponseEntity<List<OrganizationResponse>> getOrganizationRank(final Pageable pageable) {
public ResponseEntity<OrganizationResponses> getOrganizationRank(final Pageable pageable) {
return ResponseEntity.ok(organizationService.getOrganizationRank(pageable));
}

/** 조직의 타입별 랭킹을 페이징을 통해 조회하는 api */
@GetMapping("/ranking")
public ResponseEntity<List<OrganizationResponse>> getOrganizationRankByType(
public ResponseEntity<OrganizationResponses> getOrganizationRankByType(
@RequestParam final OrganizationType type, final Pageable pageable) {
return ResponseEntity.ok(organizationService.getOrganizationRankByType(type, pageable));
}

/** 조직을 이름으로 검색하는 api */
@GetMapping("/search")
public ResponseEntity<List<OrganizationResponse>> searchOrganization(
public ResponseEntity<OrganizationResponses> searchOrganization(
@RequestParam final OrganizationType type,
@RequestParam final String name,
final Pageable pageable) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dragonguard.backend.domain.organization.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class OrganizationResponses {
private List<OrganizationResponse> data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import com.dragonguard.backend.domain.member.service.AuthService;
import com.dragonguard.backend.domain.organization.dto.request.AddMemberRequest;
import com.dragonguard.backend.domain.organization.dto.request.OrganizationRequest;
import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponse;
import com.dragonguard.backend.domain.organization.dto.response.OrganizationResponses;
import com.dragonguard.backend.domain.organization.entity.Organization;
import com.dragonguard.backend.domain.organization.entity.OrganizationType;
import com.dragonguard.backend.global.annotation.TransactionService;
import com.dragonguard.backend.global.dto.IdResponse;
import com.dragonguard.backend.global.template.service.EntityLoader;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;

import java.util.List;
import org.springframework.data.domain.Pageable;

/**
* @author 김승진
Expand Down Expand Up @@ -59,23 +59,26 @@ public IdResponse<Long> saveOrganization(final OrganizationRequest organizationR
return organizationService.saveOrganization(organizationRequest);
}

public List<OrganizationResponse> findByType(
public OrganizationResponses findByType(
final OrganizationType organizationType, final Pageable pageable) {
return organizationService.findByType(organizationType, pageable);
return new OrganizationResponses(
organizationService.findByType(organizationType, pageable));
}

public List<OrganizationResponse> getOrganizationRank(final Pageable pageable) {
return organizationService.findOrganizationRank(pageable);
public OrganizationResponses getOrganizationRank(final Pageable pageable) {
return new OrganizationResponses(organizationService.findOrganizationRank(pageable));
}

public List<OrganizationResponse> getOrganizationRankByType(
public OrganizationResponses getOrganizationRankByType(
final OrganizationType type, final Pageable pageable) {
return organizationService.findOrganizationRankByType(type, pageable);
return new OrganizationResponses(
organizationService.findOrganizationRankByType(type, pageable));
}

public List<OrganizationResponse> searchOrganization(
public OrganizationResponses searchOrganization(
final OrganizationType type, final String name, final Pageable pageable) {
return organizationService.searchOrganization(type, name, pageable);
return new OrganizationResponses(
organizationService.searchOrganization(type, name, pageable));
}

public IdResponse<Long> getByName(final String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dragonguard.backend.domain.search.controller;

import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponse;
import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponse;
import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponses;
import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponses;
import com.dragonguard.backend.domain.search.service.SearchResultFacade;

import lombok.RequiredArgsConstructor;
Expand All @@ -26,14 +26,14 @@ public class SearchController {

/** 깃허브 유저를 이름으로 검색하는 api */
@GetMapping(params = "type=USERS")
public ResponseEntity<List<UserResultSearchResponse>> getUsersSearchResult(
public ResponseEntity<UserResultSearchResponses> getUsersSearchResult(
@RequestParam final String name, @RequestParam final Integer page) {
return ResponseEntity.ok(searchService.getUserSearchResultByClient(name, page));
}

/** 깃허브 repository를 이름으로 검색하는 api */
@GetMapping(params = "type=REPOSITORIES")
public ResponseEntity<List<GitRepoResultResponse>> getReposSearchResult(
public ResponseEntity<GitRepoResultResponses> getReposSearchResult(
@RequestParam(value = "filters", required = false) final List<String> filters,
@RequestParam final String name,
@RequestParam final Integer page) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dragonguard.backend.domain.search.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class GitRepoResultResponses {
private List<GitRepoResultResponse> data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.dragonguard.backend.domain.search.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class UserResultSearchResponses {
private List<UserResultSearchResponse> data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import com.dragonguard.backend.domain.search.dto.kafka.ScrapeResult;
import com.dragonguard.backend.domain.search.dto.request.SearchRequest;
import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponse;
import com.dragonguard.backend.domain.search.dto.response.GitRepoResultResponses;
import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponse;
import com.dragonguard.backend.domain.search.dto.response.UserResultSearchResponses;
import com.dragonguard.backend.domain.search.entity.Search;
import com.dragonguard.backend.domain.search.entity.SearchType;
import com.dragonguard.backend.global.annotation.TransactionService;
Expand Down Expand Up @@ -53,19 +55,19 @@ public void saveAllResult(final List<ScrapeResult> results, final SearchRequest
resultService.saveAllResultsWithSearch(results, searchId, resultList);
}

public List<UserResultSearchResponse> getUserSearchResultByClient(
public UserResultSearchResponses getUserSearchResultByClient(
final String name, final Integer page) {
final SearchRequest searchRequest = new SearchRequest(name, SearchType.USERS, page);
final Search search = getSearch(searchRequest);
return searchUser(searchRequest, search);
return new UserResultSearchResponses(searchUser(searchRequest, search));
}

public List<GitRepoResultResponse> getGitRepoSearchResultByClient(
public GitRepoResultResponses getGitRepoSearchResultByClient(
final String name, final Integer page, final List<String> filters) {
final SearchRequest searchRequest =
new SearchRequest(name, SearchType.REPOSITORIES, page, filters);
final Search search = getSearch(searchRequest);
return searchRepo(searchRequest, search);
return new GitRepoResultResponses(searchRepo(searchRequest, search));
}

private Search getSearch(final SearchRequest searchRequest) {
Expand Down
Loading

0 comments on commit ce20d83

Please sign in to comment.