-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from d-h-k/BE
Be
- Loading branch information
Showing
9 changed files
with
286 additions
and
74 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
BE/side-dish-backend/src/main/java/com/codesquad/team14/domain/Category.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,40 @@ | ||
package com.codesquad.team14.domain; | ||
|
||
import org.springframework.data.annotation.Id; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class Category { | ||
|
||
@Id | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private final Set<Item> items = new HashSet<>(); | ||
|
||
public Category(String name) { | ||
this.name = name; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Set<Item> getItems() { | ||
return items; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void addItem(Item item) { | ||
items.add(item); | ||
} | ||
} |
13 changes: 12 additions & 1 deletion
13
BE/side-dish-backend/src/main/java/com/codesquad/team14/domain/DeliveryType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package com.codesquad.team14.domain; | ||
|
||
public enum DeliveryType { | ||
NEXT_DAY, NATIONAL_WIDE | ||
NEXT_DAY("서울 경기 새벽배송"), | ||
NATIONAL_WIDE("전국택배 (제주 및 도서산간 불가) [월, 화, 수, 목, 금, 토] 수령 가능한 상품입니다."); | ||
|
||
final private String detail; | ||
|
||
DeliveryType(String detail) { | ||
this.detail = detail; | ||
} | ||
|
||
public String getDetail() { | ||
return detail; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
BE/side-dish-backend/src/main/java/com/codesquad/team14/dto/DetailedItemDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,48 @@ | ||
package com.codesquad.team14.dto; | ||
|
||
import com.codesquad.team14.domain.Item; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class DetailedItemDto { | ||
|
||
private static class Response { | ||
private final Long id; | ||
private final String topImage; | ||
private final List<String> thumbImages; | ||
private final String description; | ||
private final String deliveryInfo; | ||
private final String deliveryFee; | ||
private final int nPrice; | ||
private final int sPrice; | ||
private final int point; | ||
|
||
public Response(Long id, String topImage, List<String> thumbImages, String description, String deliveryInfo, | ||
String deliveryFee, int nPrice, int sPrice, int point) { | ||
this.id = id; | ||
this.topImage = topImage; | ||
this.thumbImages = thumbImages; | ||
this.description = description; | ||
this.deliveryInfo = deliveryInfo; | ||
this.deliveryFee = deliveryFee; | ||
this.nPrice = nPrice; | ||
this.sPrice = sPrice; | ||
this.point = point; | ||
} | ||
|
||
public static Response from(Item item) { | ||
return new Response( | ||
item.getId(), | ||
item.getImages().split(", ")[0], | ||
Arrays.asList(item.getImages().split(", ")), | ||
item.getDescription(), | ||
item.getDeliveryInfo(), | ||
item.getDeliveryFeePolicy(), | ||
item.getNPrice(), | ||
item.getSPrice(), | ||
item.getSPrice() / 100 | ||
); | ||
} | ||
} | ||
} |
77 changes: 68 additions & 9 deletions
77
BE/side-dish-backend/src/main/java/com/codesquad/team14/dto/ItemDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,76 @@ | ||
package com.codesquad.team14.dto; | ||
|
||
import com.codesquad.team14.domain.Badge; | ||
import com.codesquad.team14.domain.Item; | ||
|
||
import java.util.List; | ||
|
||
public class ItemDto { | ||
private String temp; | ||
public static class Response { | ||
private final Long id; | ||
private final String topImage; | ||
private final String deliveryTypes; | ||
private final String title; | ||
private final String description; | ||
private final int nPrice; | ||
private final int sPrice; | ||
private final List<Badge> badges; | ||
|
||
public ItemDto(String s) { | ||
temp = s; | ||
} | ||
private Response(Long id, String image, String deliveryTypes, String title, | ||
String description, int nPrice, int sPrice, List<Badge> badges) { | ||
this.id = id; | ||
this.topImage = image; | ||
this.deliveryTypes = deliveryTypes; | ||
this.title = title; | ||
this.description = description; | ||
this.nPrice = nPrice; | ||
this.sPrice = sPrice; | ||
this.badges = badges; | ||
} | ||
|
||
public String getTemp() { | ||
return temp; | ||
} | ||
public static Response from(Item item) { | ||
return new Response( | ||
item.getId(), | ||
item.getImages().split(", ")[0], | ||
item.getDeliveryTypes().toString(), | ||
item.getTitle(), | ||
item.getDescription(), | ||
item.getNPrice(), | ||
item.getSPrice(), | ||
item.getBadges() | ||
); | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getTopImage() { | ||
return topImage; | ||
} | ||
|
||
public String getDeliveryTypes() { | ||
return deliveryTypes; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public int getnPrice() { | ||
return nPrice; | ||
} | ||
|
||
public int getsPrice() { | ||
return sPrice; | ||
} | ||
|
||
public void setTemp(String temp) { | ||
this.temp = temp; | ||
public List<Badge> getBadges() { | ||
return badges; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
BE/side-dish-backend/src/main/java/com/codesquad/team14/repository/CategoryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.codesquad.team14.repository; | ||
|
||
import com.codesquad.team14.domain.Category; | ||
import com.codesquad.team14.domain.Item; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface CategoryRepository extends CrudRepository<Category, Long> { | ||
} |
Oops, something went wrong.