Skip to content

Commit

Permalink
Merge pull request #78 from Ajou-Hertz/feature/#67-find-instruments
Browse files Browse the repository at this point in the history
종류별 악기 목록 조회 API 구현
  • Loading branch information
Wo-ogie authored Mar 12, 2024
2 parents 6a31c9b + 2d80d88 commit 37972ce
Show file tree
Hide file tree
Showing 15 changed files with 798 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@
import com.ajou.hertz.domain.instrument.dto.BassGuitarDto;
import com.ajou.hertz.domain.instrument.dto.EffectorDto;
import com.ajou.hertz.domain.instrument.dto.ElectricGuitarDto;
import com.ajou.hertz.domain.instrument.dto.request.AcousticAndClassicGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.AmplifierFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.AudioEquipmentFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.BassGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewAcousticAndClassicGuitarRequest;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewAmplifierRequest;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewAudioEquipmentRequest;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewBassGuitarRequest;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewEffectorRequest;
import com.ajou.hertz.domain.instrument.dto.request.CreateNewElectricGuitarRequest;
import com.ajou.hertz.domain.instrument.dto.request.EffectorFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.ElectricGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.InstrumentFilterConditions;
import com.ajou.hertz.domain.instrument.dto.response.AcousticAndClassicGuitarResponse;
import com.ajou.hertz.domain.instrument.dto.response.AmplifierResponse;
Expand Down Expand Up @@ -97,7 +103,7 @@ public Page<ElectricGuitarResponse> findElectricGuitarsV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute ElectricGuitarFilterConditions filterConditions
) {
return instrumentQueryService
.findElectricGuitars(page, size, sort, filterConditions)
Expand All @@ -121,7 +127,7 @@ public Page<BassGuitarResponse> findBassGuitarsV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute BassGuitarFilterConditions filterConditions
) {
return instrumentQueryService
.findBassGuitars(page, size, sort, filterConditions)
Expand All @@ -145,7 +151,7 @@ public Page<AcousticAndClassicGuitarResponse> findAcousticAndClassicGuitarsV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute AcousticAndClassicGuitarFilterConditions filterConditions
) {
return instrumentQueryService
.findAcousticAndClassicGuitars(page, size, sort, filterConditions)
Expand All @@ -169,7 +175,7 @@ public Page<EffectorResponse> findEffectorsV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute EffectorFilterConditions filterConditions
) {
return instrumentQueryService
.findEffectors(page, size, sort, filterConditions)
Expand All @@ -193,7 +199,7 @@ public Page<AmplifierResponse> findAmplifiersV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute AmplifierFilterConditions filterConditions
) {
return instrumentQueryService
.findAmplifiers(page, size, sort, filterConditions)
Expand All @@ -217,7 +223,7 @@ public Page<AudioEquipmentResponse> findAudioEquipmentsV1(
@Parameter(
description = "정렬 기준"
) @RequestParam InstrumentSortOption sort,
@ParameterObject @Valid @ModelAttribute InstrumentFilterConditions filterConditions
@ParameterObject @Valid @ModelAttribute AudioEquipmentFilterConditions filterConditions
) {
return instrumentQueryService
.findAudioEquipments(page, size, sort, filterConditions)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarBrand;
import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarModel;
import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarPickUp;
import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarWood;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class AcousticAndClassicGuitarFilterConditions extends InstrumentFilterConditions {

private AcousticAndClassicGuitarBrand brand;
private AcousticAndClassicGuitarModel model;
private AcousticAndClassicGuitarWood wood;
private AcousticAndClassicGuitarPickUp pickUp;

private AcousticAndClassicGuitarFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
AcousticAndClassicGuitarBrand brand,
AcousticAndClassicGuitarModel model,
AcousticAndClassicGuitarWood wood,
AcousticAndClassicGuitarPickUp pickUp
) {
super(progress, sido, sgg);
this.brand = brand;
this.model = model;
this.wood = wood;
this.pickUp = pickUp;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.AmplifierBrand;
import com.ajou.hertz.domain.instrument.constant.AmplifierType;
import com.ajou.hertz.domain.instrument.constant.AmplifierUsage;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class AmplifierFilterConditions extends InstrumentFilterConditions {

private AmplifierType type;
private AmplifierBrand brand;
private AmplifierUsage usage;

private AmplifierFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
AmplifierType type,
AmplifierBrand brand,
AmplifierUsage usage
) {
super(progress, sido, sgg);
this.type = type;
this.brand = brand;
this.usage = usage;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.AudioEquipmentType;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class AudioEquipmentFilterConditions extends InstrumentFilterConditions {

private AudioEquipmentType type;

private AudioEquipmentFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
AudioEquipmentType type
) {
super(progress, sido, sgg);
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.BassGuitarBrand;
import com.ajou.hertz.domain.instrument.constant.BassGuitarPickUp;
import com.ajou.hertz.domain.instrument.constant.BassGuitarPreAmplifier;
import com.ajou.hertz.domain.instrument.constant.GuitarColor;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class BassGuitarFilterConditions extends InstrumentFilterConditions {

private BassGuitarBrand brand;
private BassGuitarPickUp pickUp;
private BassGuitarPreAmplifier preAmplifier;
private GuitarColor color;

private BassGuitarFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
BassGuitarBrand brand,
BassGuitarPickUp pickUp,
BassGuitarPreAmplifier preAmplifier,
GuitarColor color
) {
super(progress, sido, sgg);
this.brand = brand;
this.pickUp = pickUp;
this.preAmplifier = preAmplifier;
this.color = color;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.EffectorFeature;
import com.ajou.hertz.domain.instrument.constant.EffectorType;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class EffectorFilterConditions extends InstrumentFilterConditions {

private EffectorType type;
private EffectorFeature feature;

private EffectorFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
EffectorType type,
EffectorFeature feature
) {
super(progress, sido, sgg);
this.type = type;
this.feature = feature;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.ajou.hertz.domain.instrument.dto.request;

import com.ajou.hertz.domain.instrument.constant.ElectricGuitarBrand;
import com.ajou.hertz.domain.instrument.constant.ElectricGuitarModel;
import com.ajou.hertz.domain.instrument.constant.GuitarColor;
import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Setter // for @ModelAttribute
@Getter
public class ElectricGuitarFilterConditions extends InstrumentFilterConditions {

private ElectricGuitarBrand brand;
private ElectricGuitarModel model;
private GuitarColor color;

private ElectricGuitarFilterConditions(
InstrumentProgressStatus progress,
String sido,
String sgg,
ElectricGuitarBrand brand,
ElectricGuitarModel model,
GuitarColor color
) {
super(progress, sido, sgg);
this.brand = brand;
this.model = model;
this.color = color;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Setter // for @ModelAttribute
@Getter
public class InstrumentFilterConditions {

private InstrumentProgressStatus progress;

@Schema(description = "거래 지역 - 시/도", example = "서울특별시")
private String sido;

@Schema(description = "거래 지역 - 시/군/구", example = "종로구")
private String sgg;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import org.springframework.data.domain.Page;

import com.ajou.hertz.domain.instrument.constant.InstrumentSortOption;
import com.ajou.hertz.domain.instrument.dto.request.InstrumentFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.AcousticAndClassicGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.AmplifierFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.AudioEquipmentFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.BassGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.EffectorFilterConditions;
import com.ajou.hertz.domain.instrument.dto.request.ElectricGuitarFilterConditions;
import com.ajou.hertz.domain.instrument.entity.AcousticAndClassicGuitar;
import com.ajou.hertz.domain.instrument.entity.Amplifier;
import com.ajou.hertz.domain.instrument.entity.AudioEquipment;
Expand All @@ -14,26 +19,26 @@
public interface InstrumentRepositoryCustom {

Page<ElectricGuitar> findElectricGuitars(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, ElectricGuitarFilterConditions filterConditions
);

Page<BassGuitar> findBassGuitars(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, BassGuitarFilterConditions filterConditions
);

Page<AcousticAndClassicGuitar> findAcousticAndClassicGuitars(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, AcousticAndClassicGuitarFilterConditions filterConditions
);

Page<Effector> findEffectors(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, EffectorFilterConditions filterConditions
);

Page<Amplifier> findAmplifiers(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, AmplifierFilterConditions filterConditions
);

Page<AudioEquipment> findAudioEquipments(
int page, int pageSize, InstrumentSortOption sort, InstrumentFilterConditions filterConditions
int page, int pageSize, InstrumentSortOption sort, AudioEquipmentFilterConditions filterConditions
);
}
Loading

0 comments on commit 37972ce

Please sign in to comment.