-
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 #26 from ghojeong/feature/be/set-directory-structure
수고하셨습니다.~~
- Loading branch information
Showing
12 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/com/codesquad/sidedish/SideDish/config/WebConfig.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,16 @@ | ||
package com.codesquad.sidedish.SideDish.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addCorsMappings(final CorsRegistry registry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedMethods("*"); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
backend/src/main/java/com/codesquad/sidedish/SideDish/controller/DishController.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,63 @@ | ||
package com.codesquad.sidedish.SideDish.controller; | ||
|
||
import com.codesquad.sidedish.SideDish.dto.*; | ||
import com.codesquad.sidedish.SideDish.service.CategoryService; | ||
import com.codesquad.sidedish.SideDish.service.DishService; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
public class DishController { | ||
private final CategoryService categoryService; | ||
private final DishService dishService; | ||
|
||
DishController(CategoryService categoryService, DishService dishService) { | ||
this.categoryService = categoryService; | ||
this.dishService = dishService; | ||
} | ||
|
||
@GetMapping | ||
@RequestMapping("/categories") | ||
public ResponseEntity<List<CategoryDto>> getCategories() { | ||
List<CategoryDto> categories = categoryService.getList(); | ||
return ResponseEntity.ok().body(categories); | ||
} | ||
|
||
@GetMapping("/detail/{hash}") | ||
public ResponseEntity<DishDetailDto> getDetail(@PathVariable("hash") String hash) { | ||
DishDetailDto dishDetailDto = dishService.getDetail(hash); | ||
return ResponseEntity.ok().body(dishDetailDto); | ||
} | ||
|
||
@GetMapping("/detail/{hash}/refreshable") | ||
public ResponseEntity<RefreshDto> getDetailRefreshable(@PathVariable("hash") String hash, @RequestParam("lastUpdated") int lastUpdated) { | ||
RefreshDto refreshDto = dishService.getDetailRefreshable(hash, lastUpdated); | ||
return ResponseEntity.ok().body(refreshDto); | ||
} | ||
|
||
@GetMapping("/detail/{hash}/quantity") | ||
public ResponseEntity<QuantityDto> getDetailQuantity(@PathVariable("hash") String hash) { | ||
QuantityDto quantityDto = dishService.getDetailQuantity(hash); | ||
return ResponseEntity.ok().body(quantityDto); | ||
} | ||
|
||
@GetMapping("/main") | ||
public ResponseEntity<List<DishDto>> getMainList() { | ||
List<DishDto> dishes = dishService.getList(1); | ||
return ResponseEntity.ok().body(dishes); | ||
} | ||
|
||
@GetMapping("/side") | ||
public ResponseEntity<List<DishDto>> getSideList() { | ||
List<DishDto> dishes = dishService.getList(1); | ||
return ResponseEntity.ok().body(dishes); | ||
} | ||
|
||
@GetMapping("/soup") | ||
public ResponseEntity<List<DishDto>> getSoupList() { | ||
List<DishDto> dishes = dishService.getList(1); | ||
return ResponseEntity.ok().body(dishes); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/codesquad/sidedish/SideDish/domain/Dish.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,5 @@ | ||
package com.codesquad.sidedish.SideDish.domain; | ||
|
||
// TODO: | ||
public class Dish { | ||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/codesquad/sidedish/SideDish/domain/DishRepository.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,5 @@ | ||
package com.codesquad.sidedish.SideDish.domain; | ||
|
||
// TODO: | ||
public class DishRepository { | ||
} |
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/CategoryDto.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,25 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
public class CategoryDto { | ||
private long id; | ||
private String categoryName; | ||
private String endPoint; | ||
|
||
public CategoryDto(long id, String categoryName, String endPoint) { | ||
this.id = id; | ||
this.categoryName = categoryName; | ||
this.endPoint = endPoint; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public String getCategoryName() { | ||
return categoryName; | ||
} | ||
|
||
public String getEndPoint() { | ||
return endPoint; | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/DishDetailDataDto.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,112 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
import java.util.List; | ||
|
||
public class DishDetailDataDto { | ||
private final String topImage; | ||
private final List<String> thumbImages; | ||
private final String productDescription; | ||
private final int point; | ||
private final String deliveryInfo; | ||
private final String deliveryFee; | ||
private final List<String> prices; | ||
private final List<String> detailSection; | ||
|
||
private DishDetailDataDto(Builder builder) { | ||
this.topImage = builder.topImage; | ||
this.thumbImages = builder.thumbImages; | ||
this.productDescription = builder.productDescription; | ||
this.point = builder.point; | ||
this.deliveryInfo = builder.deliveryInfo; | ||
this.deliveryFee = builder.deliveryFee; | ||
this.prices = builder.prices; | ||
this.detailSection = builder.detailSection; | ||
} | ||
|
||
public static class Builder { | ||
private String topImage; | ||
private List<String> thumbImages; | ||
private String productDescription; | ||
private int point; | ||
private String deliveryInfo; | ||
private String deliveryFee; | ||
private List<String> prices; | ||
private List<String> detailSection; | ||
|
||
public DishDetailDataDto build() { | ||
return new DishDetailDataDto(this); | ||
} | ||
|
||
public Builder topImage(String topImage) { | ||
this.topImage = topImage; | ||
return this; | ||
} | ||
|
||
public Builder thumbImages(List<String> thumbImages) { | ||
this.thumbImages = thumbImages; | ||
return this; | ||
} | ||
|
||
public Builder productDescription(String productDescription) { | ||
this.productDescription = productDescription; | ||
return this; | ||
} | ||
|
||
public Builder point(int point) { | ||
this.point = point; | ||
return this; | ||
} | ||
|
||
public Builder deliveryInfo(String deliveryInfo) { | ||
this.deliveryInfo = deliveryInfo; | ||
return this; | ||
} | ||
|
||
public Builder deliveryFee(String deliveryFee) { | ||
this.deliveryFee = deliveryFee; | ||
return this; | ||
} | ||
|
||
public Builder prices(List<String> prices) { | ||
this.prices = prices; | ||
return this; | ||
} | ||
|
||
public Builder detailSection(List<String> detailSection) { | ||
this.detailSection = detailSection; | ||
return this; | ||
} | ||
} | ||
|
||
public String getTopImage() { | ||
return topImage; | ||
} | ||
|
||
public List<String> getThumbImages() { | ||
return thumbImages; | ||
} | ||
|
||
public String getProductDescription() { | ||
return productDescription; | ||
} | ||
|
||
public int getPoint() { | ||
return point; | ||
} | ||
|
||
public String getDeliveryInfo() { | ||
return deliveryInfo; | ||
} | ||
|
||
public String getDeliveryFee() { | ||
return deliveryFee; | ||
} | ||
|
||
public List<String> getPrices() { | ||
return prices; | ||
} | ||
|
||
public List<String> getDetailSection() { | ||
return detailSection; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/DishDetailDto.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,19 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
public class DishDetailDto { | ||
private final String hash; | ||
private final DishDetailDataDto data; | ||
|
||
public DishDetailDto(String hash, DishDetailDataDto data) { | ||
this.hash = hash; | ||
this.data = data; | ||
} | ||
|
||
public String getHash() { | ||
return hash; | ||
} | ||
|
||
public DishDetailDataDto getData() { | ||
return data; | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/DishDto.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,113 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
import java.util.List; | ||
|
||
public class DishDto { | ||
private final String detailHash; | ||
private final String image; | ||
private final List<String> deliveryType; | ||
private final String title; | ||
private final String description; | ||
private final int nPrice; | ||
private final String sPrice; | ||
private final List<String> badge; | ||
|
||
private DishDto(Builder builder) { | ||
this.detailHash = builder.detailHash; | ||
this.image = builder.image; | ||
this.deliveryType = builder.deliveryType; | ||
this.title = builder.title; | ||
this.description = builder.description; | ||
this.nPrice = builder.nPrice; | ||
this.sPrice = builder.sPrice; | ||
this.badge = builder.badge; | ||
} | ||
|
||
public static class Builder { | ||
private String detailHash; | ||
private String image; | ||
private List<String> deliveryType; | ||
private String title; | ||
private String description; | ||
private int nPrice; | ||
private String sPrice; | ||
private List<String> badge; | ||
|
||
public DishDto build() { | ||
return new DishDto(this); | ||
} | ||
|
||
|
||
public Builder detailHash(String detailHash) { | ||
this.detailHash = detailHash; | ||
return this; | ||
} | ||
|
||
public Builder image(String image) { | ||
this.image = image; | ||
return this; | ||
} | ||
|
||
public Builder deliveryType(List<String> deliveryType) { | ||
this.deliveryType = deliveryType; | ||
return this; | ||
} | ||
|
||
public Builder title(String title) { | ||
this.title = title; | ||
return this; | ||
} | ||
|
||
public Builder description(String description) { | ||
this.description = description; | ||
return this; | ||
} | ||
|
||
public Builder nPrice(int nPrice) { | ||
this.nPrice = nPrice; | ||
return this; | ||
} | ||
|
||
public Builder sPrice(String sPrice) { | ||
this.sPrice = sPrice; | ||
return this; | ||
} | ||
|
||
public Builder badge(List<String> badge) { | ||
this.badge = badge; | ||
return this; | ||
} | ||
} | ||
|
||
public String getDetailHash() { | ||
return detailHash; | ||
} | ||
|
||
public String getImage() { | ||
return image; | ||
} | ||
|
||
public List<String> getDeliveryType() { | ||
return deliveryType; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public int getnPrice() { | ||
return nPrice; | ||
} | ||
|
||
public String getsPrice() { | ||
return sPrice; | ||
} | ||
|
||
public List<String> getBadge() { | ||
return badge; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/QuantityDto.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,13 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
public class QuantityDto { | ||
private final int quantity; | ||
|
||
public QuantityDto(int quantity) { | ||
this.quantity = quantity; | ||
} | ||
|
||
public int getQuantity() { | ||
return quantity; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/codesquad/sidedish/SideDish/dto/RefreshDto.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,13 @@ | ||
package com.codesquad.sidedish.SideDish.dto; | ||
|
||
public class RefreshDto { | ||
private final boolean refreshable; | ||
|
||
public RefreshDto(boolean refreshable) { | ||
this.refreshable = refreshable; | ||
} | ||
|
||
public boolean isRefreshable() { | ||
return refreshable; | ||
} | ||
} |
Oops, something went wrong.