Skip to content

Commit

Permalink
style: Code Formatting
Browse files Browse the repository at this point in the history
- 모든 파일에 자동 포매팅 적용

issue: #8
  • Loading branch information
kihyuk-sung committed Apr 21, 2021
1 parent 42b3719 commit 78ff8f9
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 86 deletions.
26 changes: 15 additions & 11 deletions BE/src/main/java/com/team10/banchan/dto/ItemDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
import java.util.List;

public class ItemDetail {
private final String topImage;
private final List<String> thumbImages;
private final String title;
private final String productDescription;
private final String point;
private final String deliveryInfo;
private final String deliveryFee;
private final String nPrices;
private final String sPrices;
private final List<String> detailSection;
private final List<String> badges;

private final String topImage;
private final List<String> thumbImages;

private final String title;
private final String productDescription;

private final String point;
private final String deliveryInfo;

private final String deliveryFee;
private final String nPrices;
private final String sPrices;

private final List<String> detailSection;
private final List<String> badges;

private ItemDetail(String topImage, List<String> thumbImages, String title, String productDescription, String point, String deliveryInfo, String deliveryFee, String nPrices, String sPrices, List<String> detailSection, List<String> badges) {
this.topImage = topImage;
Expand Down
11 changes: 8 additions & 3 deletions BE/src/main/java/com/team10/banchan/dto/ItemDetailResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import com.fasterxml.jackson.annotation.JsonProperty;

public class ItemDetailResponse {
private Long id;
private ItemDetail itemDetail;

public ItemDetailResponse(Long id, ItemDetail itemDetail) {
private final Long id;
private final ItemDetail itemDetail;

private ItemDetailResponse(Long id, ItemDetail itemDetail) {
this.id = id;
this.itemDetail = itemDetail;
}

public static ItemDetailResponse of(Long id, ItemDetail itemDetail) {
return new ItemDetailResponse(id, itemDetail);
}

@JsonProperty("hash")
public Long getId() {
return id;
Expand Down
9 changes: 5 additions & 4 deletions BE/src/main/java/com/team10/banchan/model/Badge.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.team10.banchan.model;

public class Badge {

private final BadgeType badgeType;

Badge(BadgeType badgeType) {
this.badgeType = badgeType;
}

public String name() {
return this.badgeType.name;
}

public static Badge event() {
return new Badge(BadgeType.EVENT);
}
Expand All @@ -19,6 +16,10 @@ public static Badge launching() {
return new Badge(BadgeType.LAUNCHING);
}

public String getName() {
return this.badgeType.name;
}

enum BadgeType {
EVENT("이벤트특가"),
LAUNCHING("런칭특가");
Expand Down
20 changes: 6 additions & 14 deletions BE/src/main/java/com/team10/banchan/model/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,26 @@

import org.springframework.data.annotation.Id;

import java.util.HashSet;
import java.util.Set;

public class Category {

@Id
private final Long id;
private final String name;
private final Set<Item> items;

Category(Long id, String name, Set<Item> items) {
Category(Long id, String name) {
this.id = id;
this.name = name;
this.items = items;
}

public Long getId() {
return id;
public static Category newCategory(String name) {
return new Category(null, name);
}

public Set<Item> getItems() {
return items;
public Long getId() {
return id;
}

public String getName() {
return name;
}

public static Category newCategory(String name) {
return new Category(null, name, new HashSet<>());
}
}
9 changes: 5 additions & 4 deletions BE/src/main/java/com/team10/banchan/model/DeliveryDay.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.team10.banchan.model;

public class DeliveryDay {

private final TheDayOfWeek theDayOfWeek;

DeliveryDay(TheDayOfWeek theDayOfWeek) {
this.theDayOfWeek = theDayOfWeek;
}

public String korean() {
return theDayOfWeek.korean;
}

public static DeliveryDay monday() {
return new DeliveryDay(TheDayOfWeek.MON);
}
Expand Down Expand Up @@ -39,6 +36,10 @@ public static DeliveryDay sunday() {
return new DeliveryDay(TheDayOfWeek.SUN);
}

public String korean() {
return theDayOfWeek.korean;
}

enum TheDayOfWeek {
MON("월"),
TUE("화"),
Expand Down
17 changes: 9 additions & 8 deletions BE/src/main/java/com/team10/banchan/model/DeliveryType.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package com.team10.banchan.model;

public class DeliveryType {

private final DeliveryTypeEnum deliveryTypeName;

DeliveryType(DeliveryTypeEnum deliveryTypeName) {
this.deliveryTypeName = deliveryTypeName;
}

public String getName() {
return deliveryTypeName.name;
}

public String getDetail() {
return deliveryTypeName.detail;
}

public static DeliveryType nationwide() {
return new DeliveryType(DeliveryTypeEnum.NATIONWIDE);
}
Expand All @@ -23,6 +16,14 @@ public static DeliveryType dawn() {
return new DeliveryType(DeliveryTypeEnum.DAWN);
}

public String getName() {
return deliveryTypeName.name;
}

public String getDetail() {
return deliveryTypeName.detail;
}

enum DeliveryTypeEnum {
NATIONWIDE("전국택배", "전국택배 (제주 및 도서산간 불가)"),
DAWN("새벽배송", "서울 경기 새벽배송");
Expand Down
1 change: 1 addition & 0 deletions BE/src/main/java/com/team10/banchan/model/Description.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.team10.banchan.model;

public class Description {

private final String title;
private final String description;

Expand Down
9 changes: 5 additions & 4 deletions BE/src/main/java/com/team10/banchan/model/DetailSection.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.team10.banchan.model;

public class DetailSection {

private final String url;

DetailSection(String url) {
this.url = url;
}

public String getUrl() {
return url;
}

public static DetailSection of(String url) {
return new DetailSection(url);
}

public String getUrl() {
return url;
}
}
35 changes: 18 additions & 17 deletions BE/src/main/java/com/team10/banchan/model/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.stream.Collectors;

public class Item {

@Id
private final Long id;
private final Long section;
Expand Down Expand Up @@ -55,15 +56,27 @@ public class Item {
this.deliveryDays = deliveryDays;
}

public static Item newItem(Long section, Long category,
TopImage topImage, Description description,
Prices prices,
Integer stock) {
return new Item(null, section, category,
topImage,
description,
prices,
stock,
new ArrayList<>(), new ArrayList<>(), new HashSet<>(), new HashSet<>(), new HashSet<>());
}

public Long getId() {
return id;
}

public void addDetailSection (DetailSection detailSection) {
public void addDetailSection(DetailSection detailSection) {
this.detailSections.add(detailSection);
}

public void addThumbImage (ThumbImage thumbImage) {
public void addThumbImage(ThumbImage thumbImage) {
this.thumbImages.add(thumbImage);
}

Expand All @@ -81,7 +94,7 @@ public void addDeliveryDay(DeliveryDay deliveryDay) {

public ItemDetail itemDetail() {
return ItemDetail.of(
topImage.getTopImage(),
topImage.getUrl(),
thumbImagesUrl(),
description.getTitle(),
description.getDescription(),
Expand All @@ -98,7 +111,7 @@ public ItemDetail itemDetail() {
public ItemSummary itemSummary() {
return ItemSummary.of(
id,
topImage.getTopImage(),
topImage.getUrl(),
topImage.getAlt(),
deliveryType(),
description.getTitle(),
Expand Down Expand Up @@ -140,19 +153,7 @@ private List<String> deliveryType() {

private List<String> badge() {
return badges.stream()
.map(Badge::name)
.map(Badge::getName)
.collect(Collectors.toList());
}

public static Item newItem(Long section, Long category,
TopImage topImage, Description description,
Prices prices,
Integer stock) {
return new Item(null, section, category,
topImage,
description,
prices,
stock,
new ArrayList<>(), new ArrayList<>(), new HashSet<>(), new HashSet<>(), new HashSet<>());
}
}
3 changes: 2 additions & 1 deletion BE/src/main/java/com/team10/banchan/model/Prices.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.text.DecimalFormat;

public class Prices {

@Transient
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#,###원");

Expand All @@ -20,7 +21,7 @@ public class Prices {
}

public static Prices of(BigDecimal nPrice, BigDecimal sPrice, BigDecimal deliveryFee) {
return new Prices(nPrice,sPrice, deliveryFee);
return new Prices(nPrice, sPrice, deliveryFee);
}

public String getnPrice() {
Expand Down
20 changes: 6 additions & 14 deletions BE/src/main/java/com/team10/banchan/model/Section.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,26 @@

import org.springframework.data.annotation.Id;

import java.util.HashSet;
import java.util.Set;

public class Section {

@Id
private final Long id;
private final String name;
private final Set<Item> items;

Section(Long id, String name, Set<Item> items) {
Section(Long id, String name) {
this.id = id;
this.name = name;
this.items = items;
}

public Long getId() {
return id;
public static Section newSection(String name) {
return new Section(null, name);
}

public Set<Item> getItems() {
return items;
public Long getId() {
return id;
}

public String getName() {
return name;
}

public static Section newSection(String name) {
return new Section(null, name, new HashSet<>());
}
}
9 changes: 5 additions & 4 deletions BE/src/main/java/com/team10/banchan/model/ThumbImage.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.team10.banchan.model;

public class ThumbImage {

private final String url;

ThumbImage(String url) {
this.url = url;
}

public String getUrl() {
return url;
}

public static ThumbImage of(String url) {
return new ThumbImage(url);
}

public String getUrl() {
return url;
}
}
3 changes: 2 additions & 1 deletion BE/src/main/java/com/team10/banchan/model/TopImage.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.team10.banchan.model;

public class TopImage {

private final String alt;
private final String topImage;

Expand All @@ -17,7 +18,7 @@ public String getAlt() {
return alt;
}

public String getTopImage() {
public String getUrl() {
return topImage;
}
}
Loading

0 comments on commit 78ff8f9

Please sign in to comment.