Skip to content

Commit

Permalink
정렬조회 응답 필드 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomeo184 committed Dec 25, 2023
1 parent 02225ad commit bc8f72f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
@NoArgsConstructor
public class SortResponse {

private String code;
private String name;
private String exposureTitle;

@Builder
public SortResponse(String name, String exposureTitle) {
public SortResponse(String code, String name) {
this.code = code;
this.name = name;
this.exposureTitle = exposureTitle;
}

public static SortResponse from(SortItem sortItem) {
return SortResponse.builder()
.code(sortItem.getCode())
.name(sortItem.getName())
.exposureTitle(sortItem.getExposureTitle())
.build();
}
}
12 changes: 5 additions & 7 deletions src/main/java/com/offer/post/domain/sort/SortItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.UniqueConstraint;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand All @@ -22,19 +20,19 @@ public class SortItem {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "code")
private String code;

@Column(name = "name")
private String name;

@Column(name = "exposure_title")
private String exposureTitle;

@ManyToOne
@JoinColumn(name = "sort_group_id")
private SortGroup sortGroup;

public SortItem(String name, String exposureTitle) {
public SortItem(String code, String name) {
this.code = code;
this.name = name;
this.exposureTitle = exposureTitle;
}

public void setSortGroup(SortGroup sortGroup) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ insert into category(code, name, image_url) values ('OTHER', '기타 중고물
insert into sort_group(sort_type) values ('POST');
insert into sort_group(sort_type) values ('OFFER');

insert into sort_item(sort_group_id, exposure_title, name) values (1, '높은 가격순', 'PRICE_DESC');
insert into sort_item(sort_group_id, exposure_title, name) values (1, '최신순', 'CREATED_DATE_DESC');
insert into sort_item(sort_group_id, exposure_title, name) values (2, '높은 가격순', 'PRICE_DESC');
insert into sort_item(sort_group_id, exposure_title, name) values (2, '최신순', 'CREATED_DATE_DESC');
insert into sort_item(sort_group_id, name, code) values (1, '높은 가격순', 'PRICE_DESC');
insert into sort_item(sort_group_id, name, code) values (1, '최신순', 'CREATED_DATE_DESC');
insert into sort_item(sort_group_id, name, code) values (2, '높은 가격순', 'PRICE_DESC');
insert into sort_item(sort_group_id, name, code) values (2, '최신순', 'CREATED_DATE_DESC');


insert into post(price, created_at, modified_at, seller_id, category, description, location, product_condition, thumbnail_image_url, title, trade_type, trade_status)
Expand Down

0 comments on commit bc8f72f

Please sign in to comment.