Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 사용하지 않는 버전 코드를 제거한다. #1074

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import com.bang_ggood.auth.config.AuthRequiredPrincipal;
import com.bang_ggood.auth.config.UserPrincipal;
import com.bang_ggood.checklist.dto.request.ChecklistRequest;
import com.bang_ggood.checklist.dto.request.ChecklistRequestV1;
import com.bang_ggood.checklist.dto.response.ChecklistCompareResponsesV1;
import com.bang_ggood.checklist.dto.response.ChecklistCompareResponses;
import com.bang_ggood.checklist.dto.response.ChecklistsPreviewResponse;
import com.bang_ggood.checklist.dto.response.ChecklistsPreviewResponseV1;
import com.bang_ggood.checklist.dto.response.SelectedChecklistResponse;
import com.bang_ggood.checklist.dto.response.SelectedChecklistResponseV1;
import com.bang_ggood.checklist.service.ChecklistManageService;
import com.bang_ggood.user.domain.User;
import jakarta.validation.Valid;
Expand All @@ -31,73 +28,41 @@ public class ChecklistController {

private final ChecklistManageService checklistManageService;

@PostMapping("/checklists")
public ResponseEntity<Void> createChecklist(@AuthRequiredPrincipal User user,
@Valid @RequestBody ChecklistRequest checklistRequest) {
long checklistId = checklistManageService.createChecklist(user, checklistRequest);
return ResponseEntity.created(URI.create("/checklist/" + checklistId)).build();
}

@PostMapping("/v1/checklists")
public ResponseEntity<Void> createChecklistV1(@AuthRequiredPrincipal User user,
@Valid @RequestBody ChecklistRequestV1 checklistRequestV1) {
long checklistId = checklistManageService.createChecklistV1(user, checklistRequestV1);
@Valid @RequestBody ChecklistRequest checklistRequest) {
long checklistId = checklistManageService.createChecklist(user, checklistRequest);
return ResponseEntity.created(URI.create("/checklist/" + checklistId)).build();
}

@GetMapping("/checklists/{id}")
public ResponseEntity<SelectedChecklistResponse> readChecklistById(@UserPrincipal User user,
@PathVariable("id") Long checklistId) {
return ResponseEntity.ok(checklistManageService.readChecklist(user, checklistId));
}

@GetMapping("v1/checklists/{id}")
public ResponseEntity<SelectedChecklistResponseV1> readChecklistByIdV1(@UserPrincipal User user,
@PathVariable("id") Long checklistId) {
return ResponseEntity.ok(checklistManageService.readChecklistV1(user, checklistId));
}

@GetMapping("/checklists")
public ResponseEntity<ChecklistsPreviewResponse> readChecklistsPreview(@UserPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readAllChecklistsPreview(user));
public ResponseEntity<SelectedChecklistResponse> readChecklistByIdV1(@UserPrincipal User user,
@PathVariable("id") Long checklistId) {
return ResponseEntity.ok(checklistManageService.readChecklist(user, checklistId));
}

@GetMapping("/v1/checklists")
public ResponseEntity<ChecklistsPreviewResponseV1> readChecklistsPreviewV1(@UserPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readAllChecklistsPreviewV1(user));
}

@GetMapping("/checklists/like")
public ResponseEntity<ChecklistsPreviewResponse> readLikedChecklistsPreview(@AuthRequiredPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readLikedChecklistsPreview(user));
public ResponseEntity<ChecklistsPreviewResponse> readChecklistsPreviewV1(@UserPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readAllChecklistsPreview(user));
}

@GetMapping("/v1/checklists/like")
public ResponseEntity<ChecklistsPreviewResponseV1> readLikedChecklistsPreviewV1(@AuthRequiredPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readLikedChecklistsPreviewV1(user));
public ResponseEntity<ChecklistsPreviewResponse> readLikedChecklistsPreviewV1(@AuthRequiredPrincipal User user) {
return ResponseEntity.ok(checklistManageService.readLikedChecklistsPreview(user));
}

@GetMapping("/v1/checklists/comparison")
public ResponseEntity<ChecklistCompareResponsesV1> readChecklistsCompare(@AuthRequiredPrincipal User user,
@RequestParam("id") List<Long> checklistIds) {
public ResponseEntity<ChecklistCompareResponses> readChecklistsCompare(@AuthRequiredPrincipal User user,
@RequestParam("id") List<Long> checklistIds) {
return ResponseEntity.ok(checklistManageService.compareChecklists(user, checklistIds));
}

@PutMapping("/checklists/{id}")
public ResponseEntity<Void> updateChecklistById(
@AuthRequiredPrincipal User user,
@PathVariable("id") long id,
@Valid @RequestBody ChecklistRequest checklistRequest) {
checklistManageService.updateChecklistById(user, id, checklistRequest);
return ResponseEntity.noContent().build();
}

@PutMapping("/v1/checklists/{id}")
public ResponseEntity<Void> updateChecklistByIdV1(
@AuthRequiredPrincipal User user,
@PathVariable("id") long id,
@Valid @RequestBody ChecklistRequestV1 checklistRequestV1) {
checklistManageService.updateChecklistByIdV1(user, id, checklistRequestV1);
@Valid @RequestBody ChecklistRequest checklistRequest) {
checklistManageService.updateChecklistById(user, id, checklistRequest);
return ResponseEntity.noContent().build();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.bang_ggood.checklist.domain.Checklist;
import com.bang_ggood.maintenance.domain.ChecklistMaintenance;
import com.bang_ggood.option.domain.ChecklistOption;
import com.bang_ggood.question.dto.response.CategoryScoreResponsesV1;
import com.bang_ggood.question.dto.response.CategoryScoreResponses;
import com.bang_ggood.station.domain.ChecklistStation;
import com.bang_ggood.station.dto.response.SubwayStationResponse;
import com.bang_ggood.station.dto.response.SubwayStationResponses;
import java.time.LocalDateTime;
import java.util.List;

public record ChecklistCompareResponseV1(
public record ChecklistCompareResponse(
Long checklistId, String roomName, String address, String buildingName,
Double latitude, Double longitude,
List<Integer> options, String structure, Double size,
Expand All @@ -20,13 +20,13 @@ public record ChecklistCompareResponseV1(
Integer maintenanceFee, List<Integer> includedMaintenances,
Integer contractTerm, Integer occupancyMonth, String occupancyPeriod,
String realEstate, LocalDateTime createdAt,
CategoryScoreResponsesV1 categories
CategoryScoreResponses categories
) {
public static ChecklistCompareResponseV1 of(Checklist checklist, List<ChecklistOption> options,
List<ChecklistStation> stations,
List<ChecklistMaintenance> maintenances,
CategoryScoreResponsesV1 categories) {
return new ChecklistCompareResponseV1(
public static ChecklistCompareResponse of(Checklist checklist, List<ChecklistOption> options,
List<ChecklistStation> stations,
List<ChecklistMaintenance> maintenances,
CategoryScoreResponses categories) {
return new ChecklistCompareResponse(
checklist.getId(), checklist.getRoomName(), checklist.getRoomAddress(), checklist.getRoomBuildingName(),
checklist.getRoomLatitude(), checklist.getRoomLongitude(),
convertToOptionIds(options), checklist.getRoomStructure().getName(), checklist.getRoomSize(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.bang_ggood.checklist.dto.response;

import java.util.List;

public record ChecklistCompareResponses(List<ChecklistCompareResponse> checklists) {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package com.bang_ggood.checklist.dto.response;

import com.bang_ggood.checklist.domain.Checklist;
import com.bang_ggood.station.dto.response.SubwayStationResponse;
import java.time.LocalDateTime;

public record ChecklistPreviewResponse(
Long checklistId, String roomName, String address, String buildingName,
String station, Integer walkingTime,
SubwayStationResponse station, Integer walkingTime,
Integer deposit, Integer rent, LocalDateTime createdAt,
String summary, boolean isLiked) {

public static ChecklistPreviewResponse of(Checklist checklist, boolean isLiked) {
public static ChecklistPreviewResponse of(Checklist checklist, SubwayStationResponse station, boolean isLiked) {
return new ChecklistPreviewResponse(
checklist.getId(),
checklist.getRoomName(),
checklist.getRoomAddress(),
checklist.getRoomBuildingName(),
checklist.getRoomStation(),
station,
checklist.getRoomWalkingTime(),
checklist.getDeposit(),
checklist.getRent(),
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
import com.bang_ggood.option.dto.response.SelectedOptionResponse;
import com.bang_ggood.question.dto.response.SelectedCategoryQuestionsResponse;
import com.bang_ggood.room.dto.response.SelectedRoomResponse;
import com.bang_ggood.room.dto.response.SelectedRoomResponseV1;
import com.bang_ggood.station.dto.response.SubwayStationResponse;
import com.bang_ggood.station.dto.response.SubwayStationResponses;
import java.util.List;

public record SelectedChecklistResponse(SelectedRoomResponse room,
public record SelectedChecklistResponse(SelectedRoomResponseV1 room,
List<SelectedOptionResponse> options,
List<SelectedCategoryQuestionsResponse> categories,
boolean isLiked) {
boolean isLiked,
List<SubwayStationResponse> stations) {

public static SelectedChecklistResponse of(SelectedRoomResponse room, List<SelectedOptionResponse> options,
List<SelectedCategoryQuestionsResponse> categories, boolean isLiked) {
return new SelectedChecklistResponse(room, options, categories, isLiked);
List<SelectedCategoryQuestionsResponse> categories, boolean isLiked,
SubwayStationResponses stations) {
return new SelectedChecklistResponse(SelectedRoomResponseV1.from(room), options, categories, isLiked,
stations.getStations());
}
}

This file was deleted.

Loading
Loading