refactor(store-service): refactoring user-id hardcode
store-service에 user-id 하드코딩 된 코드를 access token에 담긴 userid로 변경
This commit is contained in:
@@ -46,14 +46,15 @@ spring:
|
||||
predicates:
|
||||
- Path=/order-service/**
|
||||
filters:
|
||||
- RewritePath=/order-service/(?<segment>.*),/$\{segment}
|
||||
- AuthorizationHeaderFilter
|
||||
- RewritePath=/order-service/(?<segment>.*),/$\{segment}
|
||||
|
||||
- id: store-service
|
||||
uri: lb://STORE-SERVCIE
|
||||
predicates:
|
||||
- Path=/store-service/**
|
||||
filters:
|
||||
- AuthorizationHeaderFilter
|
||||
- RewritePath=/store-service/(?<segment>.*),/$\{segment}
|
||||
|
||||
- id: user-service
|
||||
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
return axios.get(process.env.VUE_APP_OWNER_SERVICE_BASEURL+'/store-service/category');
|
||||
},
|
||||
putCategoryList(data){
|
||||
return this.$axios({
|
||||
return axios({
|
||||
method:'put',
|
||||
url:process.env.VUE_APP_OWNER_SERVICE_BASEURL+'/store-service/category',
|
||||
headers: {
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ItemOption from "@/views/ItemOption";
|
||||
import ItemOption from "@/components/ItemOption";
|
||||
export default {
|
||||
name: "MenuItem",
|
||||
components:{
|
||||
@@ -8,10 +8,6 @@ import auth from "./api/auth.js";
|
||||
axios.defaults.withCredentials = true;
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.$axios = axios;
|
||||
Vue.prototype.$customUtil = customUtil;
|
||||
|
||||
console.log(process.env)
|
||||
|
||||
new Vue({
|
||||
vuetify,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export default {
|
||||
deepCopy : function (o) {
|
||||
let result = {};
|
||||
if (typeof o === "object" && o !== null)
|
||||
for (let i in o) result[i] = this.deepCopy(o[i]);
|
||||
else result = o;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,7 @@ import {
|
||||
mdiPlus,
|
||||
|
||||
} from '@mdi/js'
|
||||
// import axios from "axios";
|
||||
import MenuItem from "@/views/MenuItem";
|
||||
import MenuItem from "@/components/MenuItem";
|
||||
import store from "@/api/store";
|
||||
|
||||
export default {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Category extends BaseEntity {
|
||||
@JoinColumn(name = "store_id")
|
||||
private Store store;
|
||||
|
||||
@OneToMany(mappedBy = "category")
|
||||
@OneToMany(mappedBy = "category", cascade = CascadeType.ALL)
|
||||
private List<Item> items;
|
||||
|
||||
// == 연관관계 편의 메소드 == //
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -21,9 +22,8 @@ public class CategoryController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@GetMapping("/category")
|
||||
public ResponseEntity getCategoryList( ){
|
||||
// TODO: 2022-02-09 storeId hard coding 변경해야함
|
||||
Long storeId = 1L;
|
||||
public ResponseEntity getCategoryList(@RequestHeader(value = "user-id") String userId ){
|
||||
Long storeId = Long.parseLong(userId);
|
||||
List<CategoryDto> categoryList = categoryService.getCategoryList(storeId);
|
||||
|
||||
List<CategoryResponse> categoryResponseList = categoryList.stream()
|
||||
|
||||
@@ -27,9 +27,10 @@ public class ItemController {
|
||||
|
||||
@GetMapping("/item")
|
||||
public ResponseEntity<Result<GetItemResponse>> getItemList( @RequestParam String word,
|
||||
@PageableDefault(page = 0, size = 10) Pageable pageable){
|
||||
@PageableDefault(page = 0, size = 10) Pageable pageable,
|
||||
@RequestHeader(value = "user-id") String userId ){
|
||||
|
||||
Long storeId = 1L;
|
||||
Long storeId = Long.parseLong(userId);
|
||||
|
||||
Page<ItemDto> itemDtoList = itemService.findItemList(storeId,word,pageable);
|
||||
List<GetItemListResponse.Item> itemList = itemDtoList.stream()
|
||||
@@ -191,9 +192,10 @@ public class ItemController {
|
||||
}
|
||||
|
||||
@PostMapping("/item")
|
||||
public ResponseEntity createItem( @RequestBody @Valid ItemRequest itemRequest){
|
||||
public ResponseEntity createItem( @RequestBody @Valid ItemRequest itemRequest,
|
||||
@RequestHeader(value = "user-id") String userId ){
|
||||
|
||||
Long storeId = 1L;
|
||||
Long storeId = Long.parseLong(userId);
|
||||
|
||||
List<ItemOptionDto> itemOption = itemRequest.getRequiredOption().stream()
|
||||
.map(ItemRequest.ItemOptionRequest::createItemOptionDto)
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableEurekaClient
|
||||
public class UserServiceApplication {
|
||||
|
||||
Reference in New Issue
Block a user