@@ -2,7 +2,6 @@
|
||||
<v-card
|
||||
class="mx-auto mb-5"
|
||||
outlined
|
||||
|
||||
>
|
||||
<v-list-item three-line>
|
||||
<v-list-item-content>
|
||||
@@ -19,7 +18,7 @@
|
||||
{{ card.orderItemNames }}
|
||||
</div>
|
||||
<div class="text--primary">
|
||||
합계 : <b>{{ card.orderPrice }}원</b>
|
||||
합계 : <b>{{ card.orderPrice | currency }}원</b>
|
||||
</div>
|
||||
</v-list-item-content>
|
||||
|
||||
@@ -33,11 +32,15 @@
|
||||
</v-list-item>
|
||||
|
||||
<v-card-actions class="pb-1">
|
||||
<v-btn block color="primary">재주문하기</v-btn>
|
||||
<v-btn block color="primary" @click="clickReOrder">
|
||||
재주문하기
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
|
||||
<v-card-actions class="pt-1">
|
||||
<v-btn block outlined color="primary">자세히보기</v-btn>
|
||||
<v-btn block outlined color="primary" @click="clickDetail">
|
||||
자세히보기
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -47,12 +50,24 @@ export default {
|
||||
name: "OrderHistoryCard",
|
||||
props: {
|
||||
card: {
|
||||
storeId: Number,
|
||||
storeName: String,
|
||||
orderTime: String,
|
||||
orderStatus: String,
|
||||
orderItemNames: String,
|
||||
orderPrice: String
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickReOrder: function() {
|
||||
this.$router.push({
|
||||
name: "store",
|
||||
params: {storeId: this.card.storeId}
|
||||
})
|
||||
},
|
||||
clickDetail: function() {
|
||||
alert("준비 중입니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
class="my-3 mx-3"
|
||||
height="250"
|
||||
width="165"
|
||||
@click="clickStore(item.id)"
|
||||
>
|
||||
<v-skeleton-loader>
|
||||
<v-img
|
||||
@@ -59,7 +60,14 @@
|
||||
export default {
|
||||
name: "SlideStore",
|
||||
props:["storeList", "id"],
|
||||
|
||||
methods: {
|
||||
clickStore: function(storeId) {
|
||||
this.$router.push({
|
||||
name: "store",
|
||||
params: {storeId: storeId}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -38,42 +38,49 @@ const routes = [
|
||||
path: "/home",
|
||||
beforeEnter: authCheck,
|
||||
name: 'home',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/HomeView')
|
||||
},
|
||||
{
|
||||
path: "/search",
|
||||
beforeEnter: authCheck,
|
||||
name: 'search-store',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/SearchStore')
|
||||
},
|
||||
{
|
||||
path: "/history",
|
||||
beforeEnter: authCheck,
|
||||
name: 'order-history',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/OrderHistory')
|
||||
},
|
||||
{
|
||||
path: "/favorite",
|
||||
beforeEnter: authCheck,
|
||||
name: 'favorite-store',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/FavoriteStore')
|
||||
},
|
||||
{
|
||||
path: "/notification",
|
||||
beforeEnter: authCheck,
|
||||
name: 'notification',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/NotificationView')
|
||||
},
|
||||
{
|
||||
path: "/item/:itemId",
|
||||
beforeEnter: authCheck,
|
||||
name: 'itemDetail',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/ItemDetail')
|
||||
},
|
||||
{
|
||||
path: "/order",
|
||||
beforeEnter: authCheck,
|
||||
name: 'orderPage',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('../views/OrderPage')
|
||||
},
|
||||
{
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
/>
|
||||
</v-col>
|
||||
<v-col v-for="card in cards" v-bind:key="card.storeId" sm="6">
|
||||
<v-card v-bind:data-id="card.storeId">
|
||||
<v-card
|
||||
v-bind:data-id="card.storeId"
|
||||
@click="clickCard(card.storeId)"
|
||||
>
|
||||
<v-img
|
||||
height="180"
|
||||
:src="require('@/assets/store.jpeg')"
|
||||
@@ -110,6 +113,12 @@ export default {
|
||||
favoriteCounts: store.favoriteCounts
|
||||
})
|
||||
});
|
||||
},
|
||||
clickCard: function(storeId) {
|
||||
this.$router.push({
|
||||
name: "store",
|
||||
params: {storeId: storeId}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ export default {
|
||||
this.cards.push({
|
||||
orderId: order.orderId,
|
||||
orderTime: order.orderTime,
|
||||
storeId: order.storeId,
|
||||
storeName: order.storeName,
|
||||
orderPrice: order.orderPrice,
|
||||
orderStatus: this.getOrderStatusName(order.orderStatus),
|
||||
@@ -90,9 +91,11 @@ export default {
|
||||
});
|
||||
},
|
||||
getOrderStatusName(orderStatus) {
|
||||
if (orderStatus === "REJECT") return "주문 거절";
|
||||
if (orderStatus === "ORDER") return "주문 중";
|
||||
if (orderStatus === "PLACED") return "주문 수락";
|
||||
if (orderStatus === "PLACED") return "주문신청";
|
||||
if (orderStatus === "REJECTED") return "주문거절";
|
||||
if (orderStatus === "ACCEPTED") return "주문수락";
|
||||
if (orderStatus === "WAITING") return "픽업대기";
|
||||
if (orderStatus === "FINISHED") return "픽업완료";
|
||||
return orderStatus;
|
||||
},
|
||||
getOrderItemName(orderItems) {
|
||||
@@ -100,7 +103,7 @@ export default {
|
||||
if (itemSize == 1) return orderItems[0].orderItemName;
|
||||
else if (itemSize > 1) return orderItems[0].orderItemName + " 외 " + (itemSize - 1) + "건";
|
||||
else return "없음";
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -66,7 +66,7 @@ public class OrderHistoryDto {
|
||||
orderHistoryDto.orderTime = order.getOrderTime();
|
||||
orderHistoryDto.price = order.getOrderPrice();
|
||||
orderHistoryDto.orderStatus = order.getOrderStatus();
|
||||
orderHistoryDto.storeId = order.getUserId();
|
||||
orderHistoryDto.storeId = order.getStoreId();
|
||||
|
||||
orderHistoryDto.orderItems = order.getOrderItems().stream()
|
||||
.map(_OrderHistoryItem::of)
|
||||
|
||||
@@ -49,8 +49,7 @@ public class OrderRepositoryCustom {
|
||||
orderIdLt(condition.getLastOrderId()),
|
||||
order.orderTime.between(start, end),
|
||||
order.storeId.eq(storeId),
|
||||
order.orderStatus.ne(OrderStatus.PENDING),
|
||||
order.orderStatus.ne(OrderStatus.FAILED)
|
||||
order.orderStatus.ne(OrderStatus.PENDING)
|
||||
)
|
||||
.orderBy(order.id.desc())
|
||||
.limit(pageSize + 1)
|
||||
@@ -88,6 +87,7 @@ public class OrderRepositoryCustom {
|
||||
.leftJoin(order.transaction).fetchJoin()
|
||||
.where(
|
||||
order.orderTime.between(search.getStartDateTime(), search.getEndDateTime()),
|
||||
order.orderStatus.ne(OrderStatus.PENDING),
|
||||
order.storeId.eq(storeId)
|
||||
)
|
||||
.orderBy(order.orderTime.desc())
|
||||
@@ -105,7 +105,8 @@ public class OrderRepositoryCustom {
|
||||
.selectFrom(order)
|
||||
.leftJoin(order.transaction).fetchJoin()
|
||||
.where(
|
||||
order.userId.eq(userId)
|
||||
order.userId.eq(userId),
|
||||
order.orderStatus.ne(OrderStatus.PENDING)
|
||||
)
|
||||
.orderBy(order.orderTime.desc())
|
||||
.offset(pageable.getOffset())
|
||||
@@ -122,7 +123,7 @@ public class OrderRepositoryCustom {
|
||||
return new SliceImpl<>(contents, pageable, hasNext);
|
||||
}
|
||||
|
||||
public Optional<Order> fetchOrder(Long userId){
|
||||
public Optional<Order> fetchOrderBasket(Long userId){
|
||||
|
||||
return Optional.ofNullable(queryFactory.selectFrom(order)
|
||||
.leftJoin(order.orderItems, orderItem).fetchJoin()
|
||||
|
||||
@@ -9,8 +9,10 @@ import com.justpickup.orderservice.domain.order.repository.OrderRepositoryCustom
|
||||
import com.justpickup.orderservice.domain.orderItem.dto.OrderItemDto;
|
||||
import com.justpickup.orderservice.domain.orderItem.entity.OrderItem;
|
||||
import com.justpickup.orderservice.domain.orderItemOption.entity.OrderItemOption;
|
||||
import com.justpickup.orderservice.global.client.store.*;
|
||||
import com.justpickup.orderservice.global.client.user.GetCustomerResponse;
|
||||
import com.justpickup.orderservice.global.client.store.GetItemResponse;
|
||||
import com.justpickup.orderservice.global.client.store.GetStoreResponse;
|
||||
import com.justpickup.orderservice.global.client.store.StoreByUserIdResponse;
|
||||
import com.justpickup.orderservice.global.client.store.StoreClient;
|
||||
import com.justpickup.orderservice.global.client.user.UserClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,7 +27,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -35,7 +36,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
private final OrderRepository orderRepository;
|
||||
private final OrderRepositoryCustom orderRepositoryCustom;
|
||||
private final OrderSender orderSender;
|
||||
private final StoreClient storeClient;
|
||||
private final UserClient userClient;
|
||||
|
||||
@@ -63,10 +63,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
// item name 가져오기
|
||||
Map<Long, String> itemNameMap = getItemNameMap(itemIds);
|
||||
Map<Long, String> itemNameMap = storeClient.getItemNameMap(itemIds);
|
||||
|
||||
// user name 가져오기
|
||||
Map<Long, String> userNameMap = getUserNameMap(userIds);
|
||||
Map<Long, String> userNameMap = userClient.getUserNameMap(userIds);
|
||||
|
||||
// 해당 ID에 맞게 이름 설정해주기
|
||||
for (OrderMainDto._Order order : orders) {
|
||||
@@ -81,22 +81,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
return returnDto;
|
||||
}
|
||||
|
||||
private Map<Long, String> getUserNameMap(Iterable<Long> userIds) {
|
||||
List<GetCustomerResponse> userResponses = userClient.getCustomers(userIds).getData();
|
||||
return userResponses.stream()
|
||||
.collect(
|
||||
toMap(GetCustomerResponse::getUserId, GetCustomerResponse::getUserName)
|
||||
);
|
||||
}
|
||||
|
||||
private Map<Long, String> getItemNameMap(Iterable<Long> itemIds) {
|
||||
List<GetItemsResponse> itemResponses = storeClient.getItems(itemIds).getData();
|
||||
return itemResponses.stream()
|
||||
.collect(
|
||||
toMap(GetItemsResponse::getId, GetItemsResponse::getName)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PrevOrderDto> findPrevOrderMain(PrevOrderSearch search, Pageable pageable, Long userId) {
|
||||
StoreByUserIdResponse store = storeClient.getStoreByUserId(userId).getData();
|
||||
@@ -120,10 +104,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
// item name 가져오기
|
||||
Map<Long, String> itemNameMap = getItemNameMap(itemIds);
|
||||
Map<Long, String> itemNameMap = storeClient.getItemNameMap(itemIds);
|
||||
|
||||
// user name 가져오기
|
||||
Map<Long, String> userNameMap = getUserNameMap(userIds);
|
||||
Map<Long, String> userNameMap = userClient.getUserNameMap(userIds);
|
||||
|
||||
for (PrevOrderDto prevOrderDto : prevOrderDtoList) {
|
||||
String userName = userNameMap.get(prevOrderDto.getUserId());
|
||||
@@ -155,8 +139,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
Map<Long, String> storeNameMap = this.getStoreNameMap(storeIds);
|
||||
Map<Long, String> itemNameMap = this.getItemNameMap(itemIds);
|
||||
Map<Long, String> storeNameMap = storeClient.getStoreNameMap(storeIds);
|
||||
Map<Long, String> itemNameMap = storeClient.getItemNameMap(itemIds);
|
||||
|
||||
for (OrderHistoryDto orderHistoryDto : orderHistoryDtoList) {
|
||||
String userName = storeNameMap.get(orderHistoryDto.getStoreId());
|
||||
@@ -170,15 +154,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
return new SliceImpl<>(orderHistoryDtoList, pageable, orderHistory.hasNext());
|
||||
}
|
||||
|
||||
private Map<Long, String> getStoreNameMap(Set<Long> storeIds) {
|
||||
List<GetStoreResponse> storeResponses = storeClient.getStoreAllById(storeIds).getData();
|
||||
Map<Long, String> storeMap = storeResponses.stream()
|
||||
.collect(
|
||||
toMap(GetStoreResponse::getId, GetStoreResponse::getName)
|
||||
);
|
||||
return storeMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addItemToBasket(OrderItemDto orderItemDto, Long storeId, Long userId) {
|
||||
@@ -209,9 +184,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
public FetchOrderDto fetchOrder(Long userId) {
|
||||
Order order = orderRepositoryCustom.fetchOrder(userId)
|
||||
Order order = orderRepositoryCustom.fetchOrderBasket(userId)
|
||||
.orElseThrow(() -> new OrderException("장바구니 정보를 찾을 수 없습니다."));
|
||||
GetStoreReseponse store = storeClient.getStore(String.valueOf(order.getStoreId())).getData();
|
||||
GetStoreResponse store = storeClient.getStore(String.valueOf(order.getStoreId())).getData();
|
||||
|
||||
List<GetItemResponse> data = storeClient.getItemAndItemOptions(order.getOrderItems().stream()
|
||||
.map(OrderItem::getItemId)
|
||||
@@ -234,15 +209,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
,orderItem))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
FetchOrderDto fetchOrderDto = FetchOrderDto.builder()
|
||||
return FetchOrderDto.builder()
|
||||
.userId(order.getUserId())
|
||||
.orderPrice(order.getOrderPrice())
|
||||
.storeName(store.getName())
|
||||
.orderItemDtoList(orderItemDtoList)
|
||||
.build();
|
||||
|
||||
return fetchOrderDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,8 @@ public class OrderController {
|
||||
public ResponseEntity<Result> patchOrder(@PathVariable("orderId") Long orderId,
|
||||
@RequestBody PatchOrderRequest patchOrderRequest) {
|
||||
OrderStatus orderStatus = patchOrderRequest.getOrderStatus();
|
||||
if (orderStatus != OrderStatus.PLACED && orderStatus != OrderStatus.REJECTED) {
|
||||
throw new OrderException("주문 수락, 거절 외에는 변경 불가능합니다.");
|
||||
if (orderStatus == OrderStatus.PENDING && orderStatus != OrderStatus.FAILED) {
|
||||
throw new OrderException(orderStatus.getMessage() + "는 변경 불가능합니다.");
|
||||
}
|
||||
|
||||
orderService.modifyOrder(orderId, orderStatus);
|
||||
|
||||
@@ -60,6 +60,7 @@ public class OrderCustomerApiController {
|
||||
private Long orderId;
|
||||
private String orderTime;
|
||||
private OrderStatus orderStatus;
|
||||
private Long storeId;
|
||||
private String storeName;
|
||||
private Long orderPrice;
|
||||
private List<_OrderItemResponse> orderItems;
|
||||
@@ -69,6 +70,7 @@ public class OrderCustomerApiController {
|
||||
this.orderTime = orderHistoryDto.getOrderTime()
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
|
||||
this.orderStatus = orderHistoryDto.getOrderStatus();
|
||||
this.storeId = orderHistoryDto.getStoreId();
|
||||
this.storeName = orderHistoryDto.getStoreName();
|
||||
this.orderPrice = orderHistoryDto.getPrice();
|
||||
this.orderItems = orderHistoryDto.getOrderItems()
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.justpickup.orderservice.global.client.store;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GetStoreReseponse {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String phoneNumber;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.justpickup.orderservice.global.client.store;
|
||||
|
||||
import com.justpickup.orderservice.global.client.user.GetCustomerResponse;
|
||||
import com.justpickup.orderservice.global.dto.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -7,6 +8,10 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
@FeignClient("STORE-SERVICE")
|
||||
public interface StoreClient {
|
||||
@@ -24,9 +29,26 @@ public interface StoreClient {
|
||||
Result<List<GetStoreResponse>> getStoreAllById(@PathVariable("storeId") Iterable<Long> storeIds);
|
||||
|
||||
@GetMapping("/store/{storeId}")
|
||||
Result<GetStoreReseponse> getStore(@PathVariable(value = "storeId") String storeId);
|
||||
Result<GetStoreResponse> getStore(@PathVariable(value = "storeId") String storeId);
|
||||
|
||||
@GetMapping("/api/customer/items/{itemId}")
|
||||
Result<List<GetItemResponse>> getItemAndItemOptions(@PathVariable(value = "itemId") List<Long> itemIds);
|
||||
|
||||
default Map<Long, String> getStoreNameMap(Set<Long> storeIds) {
|
||||
List<GetStoreResponse> storeResponses = this.getStoreAllById(storeIds).getData();
|
||||
return storeResponses.stream()
|
||||
.collect(
|
||||
toMap(GetStoreResponse::getId, GetStoreResponse::getName)
|
||||
);
|
||||
}
|
||||
|
||||
default Map<Long, String> getItemNameMap(Iterable<Long> itemIds) {
|
||||
List<GetItemsResponse> itemResponses = this.getItems(itemIds).getData();
|
||||
return itemResponses.stream()
|
||||
.collect(
|
||||
toMap(GetItemsResponse::getId, GetItemsResponse::getName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
@FeignClient("USER-SERVICE")
|
||||
public interface UserClient {
|
||||
@@ -15,4 +18,12 @@ public interface UserClient {
|
||||
|
||||
@GetMapping("/customers/{userIds}")
|
||||
Result<List<GetCustomerResponse>> getCustomers(@PathVariable("userIds") Iterable<Long> userIds);
|
||||
|
||||
default Map<Long, String> getUserNameMap(Iterable<Long> userIds) {
|
||||
List<GetCustomerResponse> userResponses = this.getCustomers(userIds).getData();
|
||||
return userResponses.stream()
|
||||
.collect(
|
||||
toMap(GetCustomerResponse::getUserId, GetCustomerResponse::getUserName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ class OrderCustomerApiControllerTest {
|
||||
fieldWithPath("data.orders[*].orderTime").description("주문 시간 [yyyy-MM-dd HH:mm]"),
|
||||
fieldWithPath("data.orders[*].orderPrice").description("합계"),
|
||||
fieldWithPath("data.orders[*].orderStatus").description("주문 상태"),
|
||||
fieldWithPath("data.orders[*].orderStatus").description("매장 고유번호"),
|
||||
fieldWithPath("data.orders[*].storeName").description("매장 이름"),
|
||||
fieldWithPath("data.orders[*].orderItems[*].orderItemId").description("주문 아이템 고유번호"),
|
||||
fieldWithPath("data.orders[*].orderItems[*].orderItemName").description("주문 아이템 이름"),
|
||||
|
||||
@@ -49,8 +49,6 @@ public class AuthorizationHeaderFilter extends AbstractGatewayFilterFactory<Auth
|
||||
|
||||
String subject = jwtTokenProvider.getUserId(token);
|
||||
|
||||
if (subject.equals("feign")) return chain.filter(exchange);
|
||||
|
||||
if (false == jwtTokenProvider.getRoles(token).contains("StoreOwner")) {
|
||||
return onError(exchange, "권한 없음", HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ spring:
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowedOrigins: "http://just-pickup.com:8081"
|
||||
allowedOrigins: "http://admin.just-pickup.com:8081"
|
||||
allowedMethods:
|
||||
- GET
|
||||
- POST
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
VUE_APP_OWNER_SERVICE_BASEURL=http://just-pickup.com:8001
|
||||
VUE_APP_USER_URL=http://just-pickup.com:8001/user-service
|
||||
VUE_APP_OWNER_SERVICE_BASEURL=http://admin.just-pickup.com:8001
|
||||
VUE_APP_USER_URL=http://admin.just-pickup.com:8001/user-service
|
||||
|
||||
VUE_APP_USER_AUTH_URL=http://just-pickup.com:8001/user-service/auth
|
||||
VUE_APP_API_URL=http://just-pickup.com:8001/order-service/api/owner
|
||||
VUE_APP_USER_AUTH_URL=http://admin.just-pickup.com:8001/user-service/auth
|
||||
VUE_APP_API_URL=http://admin.just-pickup.com:8001/order-service/api/owner
|
||||
@@ -1,5 +1,6 @@
|
||||
import axios from "axios";
|
||||
import jwt from "@/common/jwt";
|
||||
import router from "@/router";
|
||||
|
||||
export default {
|
||||
async requestReissue() {
|
||||
@@ -22,5 +23,23 @@ export default {
|
||||
axios.defaults.headers.common['Authorization'] = "Bearer " + jwt.getToken();
|
||||
|
||||
return axios.get( process.env.VUE_APP_USER_AUTH_URL +"/check/access-token");
|
||||
},
|
||||
async logout() {
|
||||
const config = {
|
||||
headers: {
|
||||
"X-AUTH-TOKEN": jwt.getToken()
|
||||
}
|
||||
}
|
||||
try {
|
||||
const response = await axios.post(process.env.VUE_APP_USER_AUTH_URL + "/logout", null, config);
|
||||
if (response.data.code == 'SUCCESS') {
|
||||
jwt.destroyAll();
|
||||
await router.push("/login");
|
||||
} else {
|
||||
alert("로그아웃 실패");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("[logout]", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
owner-vue/src/api/notification.js
Normal file
19
owner-vue/src/api/notification.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import axios from "axios";
|
||||
|
||||
const url = process.env.VUE_APP_OWNER_SERVICE_BASEURL + "/notification-service";
|
||||
|
||||
export default {
|
||||
requestNotification() {
|
||||
return axios.get(url + "/notifications");
|
||||
},
|
||||
patchNotification(id, isRead) {
|
||||
const body = {
|
||||
read: isRead
|
||||
}
|
||||
|
||||
return axios.patch(url + "/notification/" + id, body)
|
||||
},
|
||||
countsNotification() {
|
||||
return axios.get(url + "/api/notification/counts");
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
},
|
||||
saveItem(method, itemData){
|
||||
const _url = process.env.VUE_APP_OWNER_SERVICE_BASEURL+'/store-service/api/owner/item'+(method==='put'? "/"+itemData.itemId:'')
|
||||
console.log(_url)
|
||||
|
||||
return axios({
|
||||
method:method,
|
||||
url: _url,
|
||||
|
||||
@@ -26,6 +26,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
requestUserInfo() {
|
||||
return axios.get(process.env.VUE_APP_OWNER_SERVICE_BASEURL + '/user-service/store-owner');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ const moment = require('moment');
|
||||
const ACCESS_TOKEN_NAME = "accessToken";
|
||||
const EXPIRED_TIME_NAME = "expiredTime";
|
||||
|
||||
const tag = "[jwt]";
|
||||
|
||||
export default {
|
||||
getToken() {
|
||||
return localStorage.getItem(ACCESS_TOKEN_NAME);
|
||||
@@ -23,6 +21,9 @@ export default {
|
||||
localStorage.removeItem(EXPIRED_TIME_NAME);
|
||||
},
|
||||
isExpired() {
|
||||
if (this.getToken() == null) return true;
|
||||
if (this.getExpiredTime() == null) return true;
|
||||
|
||||
const expiredTime = this.getExpiredTime();
|
||||
|
||||
const expiredMoment = moment(expiredTime);
|
||||
@@ -30,7 +31,7 @@ export default {
|
||||
|
||||
const difference = moment.duration(expiredMoment.diff(currentMoment)).asSeconds();
|
||||
|
||||
console.log(tag, "expireMoment = ", expiredMoment, "currentMoment = ", currentMoment, "diff = ", difference);
|
||||
// console.log(tag, "expireMoment = ", expiredMoment, "currentMoment = ", currentMoment, "diff = ", difference);
|
||||
|
||||
// 만료 30초 전일 경우 만료로 판단
|
||||
return difference <= 30;
|
||||
|
||||
@@ -64,7 +64,6 @@ export default {
|
||||
addItemOption : function () {
|
||||
if(!this.data) return;
|
||||
|
||||
console.log(this.optionType)
|
||||
this.dialog = false
|
||||
this.$emit('addItemOption',this.data,this.optionType)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,6 @@ export default {
|
||||
this.$emit('save')
|
||||
},
|
||||
addItemOption : function (itemOptionValue,optionType){
|
||||
console.log("saveOption",itemOptionValue,optionType)
|
||||
this.$emit("addItemOption",itemOptionValue,optionType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
<v-toolbar elevation="1" dense>
|
||||
<v-toolbar-title>{{ userName }}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn outlined color="grey grey lighten-1" small>상세보기</v-btn>
|
||||
<v-btn outlined color="grey grey lighten-1" small
|
||||
@click="clickDetail"
|
||||
>
|
||||
상세보기
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-title v-if="itemNames.length == 1">
|
||||
{{ itemNames[0] }}
|
||||
@@ -11,40 +15,58 @@
|
||||
<v-card-title v-if="itemNames.length > 1">
|
||||
{{ itemNames[0] }} 외 {{ itemNames.length - 1 }}건
|
||||
</v-card-title>
|
||||
<v-card-subtitle></v-card-subtitle>
|
||||
<v-card-subtitle>{{ orderStatus | getOrderStatusName }}</v-card-subtitle>
|
||||
<v-card-text>{{ orderTime }}</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-row v-if="orderStatus === 'ORDER'">
|
||||
<v-row v-if="orderStatus === 'PLACED'">
|
||||
<v-col sm="6">
|
||||
<v-btn
|
||||
block depressed color="success"
|
||||
@click="placed"
|
||||
block depressed color="#006A95" class="white--text"
|
||||
@click="accepted"
|
||||
>
|
||||
주문 수령
|
||||
주문수락하기
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col sm="6">
|
||||
<v-btn block depressed color="error"
|
||||
@click="reject"
|
||||
<v-btn block depressed color="#FF1400" class="white--text"
|
||||
@click="rejected"
|
||||
>
|
||||
주문 거절
|
||||
주문거절하기
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-else-if="orderStatus === 'PLACED'">
|
||||
<v-row v-else-if="orderStatus === 'ACCEPTED'">
|
||||
<v-col>
|
||||
<v-btn block depressed color="primary">
|
||||
수락됨
|
||||
<v-btn block depressed color="#58ADA0" class="white--text"
|
||||
@click="waiting"
|
||||
>
|
||||
픽업 요청하기
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-else-if="orderStatus === 'REJECT'">
|
||||
<v-row v-else-if="orderStatus === 'REJECTED'">
|
||||
<v-col>
|
||||
<v-btn block depressed color="blue-grey" class="white--text">
|
||||
<v-btn block disabled>
|
||||
거절됨
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-else-if="orderStatus === 'WAITING'">
|
||||
<v-col>
|
||||
<v-btn block depressed color="#FF5C00" class="white--text"
|
||||
@click="finished"
|
||||
>
|
||||
고객 수령완료하기
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-else-if="orderStatus === 'FINISHED'">
|
||||
<v-col>
|
||||
<v-btn block depressed color="#F9E0AF" class="grey--text">
|
||||
픽업 완료됨
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -67,24 +89,47 @@ export default {
|
||||
orderStatus: String
|
||||
},
|
||||
methods: {
|
||||
placed: async function() {
|
||||
accepted: async function() {
|
||||
try {
|
||||
await orderApi.patchOrder(this.id, 'PLACED');
|
||||
this.$emit("placed");
|
||||
await orderApi.patchOrder(this.id, 'ACCEPTED');
|
||||
this.$emit("accepted");
|
||||
alert("해당 주문이 수락 되었습니다.");
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
reject: async function() {
|
||||
rejected: async function() {
|
||||
try {
|
||||
await orderApi.patchOrder(this.id, 'REJECT');
|
||||
this.$emit("reject");
|
||||
await orderApi.patchOrder(this.id, 'REJECTED');
|
||||
this.$emit("rejected");
|
||||
alert("해당 주문이 거절 되었습니다.");
|
||||
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
waiting: async function() {
|
||||
try {
|
||||
await orderApi.patchOrder(this.id, 'WAITING');
|
||||
this.$emit("waiting");
|
||||
alert("해당 주문의 픽업이 요청 되었습니다.");
|
||||
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
finished: async function() {
|
||||
try {
|
||||
await orderApi.patchOrder(this.id, 'FINISHED');
|
||||
this.$emit("finished");
|
||||
alert("해당 주문이 픽업완료 처리 되었습니다.");
|
||||
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
clickDetail: function() {
|
||||
alert("준비중 입니다...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,28 @@ new Vue({
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
|
||||
Vue.filter('getOrderStatusName', function (orderStatus) {
|
||||
switch (orderStatus) {
|
||||
case "PLACED":
|
||||
return "주문신청됨";
|
||||
case "ACCEPTED":
|
||||
return "주문수락됨";
|
||||
case "REJECTED":
|
||||
return "주문거절됨";
|
||||
case "WAITING":
|
||||
return "픽업대기중";
|
||||
case "FINISHED":
|
||||
return "픽업완료됨";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
Vue.filter('currency', function (value) {
|
||||
var num = new Number(value);
|
||||
return num.toFixed(0).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")
|
||||
});
|
||||
|
||||
axios.interceptors.response.use(
|
||||
(response) => {
|
||||
return response;
|
||||
@@ -24,7 +46,6 @@ axios.interceptors.response.use(
|
||||
if (error.response.status === 401) {
|
||||
let code = error.response.data.code;
|
||||
if (code === "EXPIRED") {
|
||||
console.log("## expired");
|
||||
try {
|
||||
const accessToken = await auth.requestReissue();
|
||||
originalRequest.headers.Authorization = "Bearer " + accessToken;
|
||||
|
||||
@@ -24,12 +24,10 @@ const authCheck = async function (to, from, next) {
|
||||
};
|
||||
const routes = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
redirect: 'dashboard',
|
||||
path: '/order',
|
||||
redirect: 'order',
|
||||
component: DashboardLayout,
|
||||
beforeEnter: authCheck,
|
||||
children: [
|
||||
|
||||
{
|
||||
path: '/category',
|
||||
name: 'category',
|
||||
@@ -53,7 +51,13 @@ const routes = [
|
||||
name: 'order',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('./../views/Order.vue')
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/notification',
|
||||
name: 'notificationr',
|
||||
beforeEnter: authCheck,
|
||||
component: () => import('./../views/NotificationView.vue')
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<template>
|
||||
<v-app id="inspire">
|
||||
<side-bar :drawer="drawer"></side-bar>
|
||||
<top-bar @drawerEvent="drawer = !drawer"></top-bar>
|
||||
<top-bar @drawerEvent="drawer = !drawer"
|
||||
:notificationCounts="notificationCounts"/>
|
||||
<v-main style="background: #f5f5f540">
|
||||
<v-container class="py-8, px-6" fluid>
|
||||
<router-view></router-view>
|
||||
<router-view
|
||||
v-on:plusCount="notificationCounts++"
|
||||
v-on:minusCount="notificationCounts--"
|
||||
></router-view>
|
||||
</v-container>
|
||||
</v-main>
|
||||
</v-app>
|
||||
@@ -13,6 +17,7 @@
|
||||
<script>
|
||||
import Sidebar from './Sidebar.vue'
|
||||
import Topbar from "./Topbar.vue";
|
||||
import notificationApi from "@/api/notification";
|
||||
|
||||
export default {
|
||||
name: "DashboardLayout",
|
||||
@@ -20,9 +25,19 @@ export default {
|
||||
'side-bar': Sidebar,
|
||||
'top-bar': Topbar
|
||||
},
|
||||
mounted() {
|
||||
this.searchNotificationCounts();
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
drawer: null
|
||||
drawer: null,
|
||||
notificationCounts: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
searchNotificationCounts: async function() {
|
||||
const response = await notificationApi.countsNotification();
|
||||
this.notificationCounts = response.data.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,6 @@
|
||||
<v-app-bar app elevate-on-scroll elevation="3" color="white">
|
||||
<v-app-bar-nav-icon @click="$emit('drawerEvent')"></v-app-bar-nav-icon>
|
||||
<v-spacer />
|
||||
<v-col lg="6" cols="12">
|
||||
<v-form>
|
||||
<v-text-field
|
||||
class="p-0 m-0 mt-6"
|
||||
full-width
|
||||
dense
|
||||
append-icon="mdi-magnify"
|
||||
outlined
|
||||
rounded
|
||||
placeholder="Search"
|
||||
/>
|
||||
</v-form>
|
||||
</v-col>
|
||||
<v-spacer />
|
||||
<v-menu offset-y>
|
||||
<template v-slot:activator="{ attrs, on }">
|
||||
@@ -24,39 +11,18 @@
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
>
|
||||
<v-badge content="3" color="red" offset-y="10" offset-x="10">
|
||||
<v-icon>mdi-bell</v-icon>
|
||||
</v-badge>
|
||||
<v-btn @click="goNotification"
|
||||
elevation="0"
|
||||
color="white"
|
||||
>
|
||||
<v-badge :content="notificationCounts"
|
||||
:value="notificationCounts"
|
||||
color="red" offset-y="10" offset-x="10">
|
||||
<v-icon>mdi-bell</v-icon>
|
||||
</v-badge>
|
||||
</v-btn>
|
||||
</span>
|
||||
</template>
|
||||
<v-list three-line width="250">
|
||||
<template v-for="(item, index) in items">
|
||||
<v-subheader
|
||||
v-if="item.header"
|
||||
:key="item.header"
|
||||
v-text="item.header"
|
||||
></v-subheader>
|
||||
|
||||
<v-divider
|
||||
v-else-if="item.divider"
|
||||
:key="index"
|
||||
:inset="item.inset"
|
||||
></v-divider>
|
||||
|
||||
<v-list-item v-else :key="item.title">
|
||||
<v-list-item-avatar>
|
||||
<v-img :src="item.avatar"></v-img>
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-html="item.title"></v-list-item-title>
|
||||
<v-list-item-subtitle
|
||||
v-html="item.subtitle"
|
||||
></v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-menu offset-y>
|
||||
<template v-slot:activator="{ attrs, on }">
|
||||
@@ -64,31 +30,31 @@
|
||||
<v-chip link>
|
||||
<v-badge dot bottom color="green" offset-y="10" offset-x="10">
|
||||
<v-avatar size="40">
|
||||
<v-img src="https://randomuser.me/api/portraits/women/81.jpg" />
|
||||
<v-icon>mdi-account-circle</v-icon>
|
||||
</v-avatar>
|
||||
</v-badge>
|
||||
<span class="ml-3">Jane Smith</span>
|
||||
<span class="ml-3">{{ userName }}</span>
|
||||
</v-chip>
|
||||
</span>
|
||||
</template>
|
||||
<v-list width="250" class="py-0">
|
||||
<v-list-item two-line>
|
||||
<v-list-item-avatar>
|
||||
<img src="https://randomuser.me/api/portraits/women/81.jpg" />
|
||||
<v-icon>mdi-account-circle</v-icon>
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>Jane Smith</v-list-item-title>
|
||||
<v-list-item-title>{{ userName }}</v-list-item-title>
|
||||
<v-list-item-subtitle>Logged In</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider />
|
||||
<v-list-item link v-for="(menu, i) in menus" :key="i">
|
||||
<v-list-item link @click="logout">
|
||||
<v-list-item-icon>
|
||||
<v-icon>{{ menu.icon }}</v-icon>
|
||||
<v-icon>mdi-logout</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>
|
||||
{{ menu.title }}
|
||||
Logout
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -97,52 +63,35 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userApi from "../../api/user";
|
||||
import authApi from "../../api/auth";
|
||||
|
||||
export default {
|
||||
name: "Topbar",
|
||||
props: ["notificationCounts"],
|
||||
data() {
|
||||
return {
|
||||
menus: [
|
||||
{ title: "Profile", icon: "mdi-account" },
|
||||
{ title: "Change Password", icon: "mdi-key" },
|
||||
{ title: "Setting", icon: "mdi-cog" },
|
||||
{ title: "Logout", icon: "mdi-logout" },
|
||||
],
|
||||
items: [
|
||||
{
|
||||
avatar: "https://cdn.vuetifyjs.com/images/lists/1.jpg",
|
||||
title: "Brunch this weekend?",
|
||||
subtitle: `<span class="text--primary">Ali Connors</span> — I'll be in your neighborhood doing errands this weekend. Do you want to hang out?`,
|
||||
},
|
||||
{ divider: true, inset: true },
|
||||
{
|
||||
avatar: "https://cdn.vuetifyjs.com/images/lists/2.jpg",
|
||||
title: 'Summer BBQ <span class="grey--text text--lighten-1">4</span>',
|
||||
subtitle: `<span class="text--primary">to Alex, Scott, Jennifer</span> — Wish I could come, but I'm out of town this weekend.`,
|
||||
},
|
||||
{ divider: true, inset: true },
|
||||
{
|
||||
avatar: "https://cdn.vuetifyjs.com/images/lists/3.jpg",
|
||||
title: "Oui oui",
|
||||
subtitle:
|
||||
'<span class="text--primary">Sandra Adams</span> — Do you have Paris recommendations? Have you ever been?',
|
||||
},
|
||||
{ divider: true, inset: true },
|
||||
{
|
||||
avatar: "https://cdn.vuetifyjs.com/images/lists/4.jpg",
|
||||
title: "Birthday gift",
|
||||
subtitle:
|
||||
'<span class="text--primary">Trevor Hansen</span> — Have any ideas about what we should get Heidi for her birthday?',
|
||||
},
|
||||
{ divider: true, inset: true },
|
||||
{
|
||||
avatar: "https://cdn.vuetifyjs.com/images/lists/5.jpg",
|
||||
title: "Recipe to try",
|
||||
subtitle:
|
||||
'<span class="text--primary">Britta Holt</span> — We should eat this: Grate, Squash, Corn, and tomatillo Tacos.',
|
||||
},
|
||||
],
|
||||
userName: '',
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
// 사용자 정보 가져오기
|
||||
const data = await this.getUserInfo();
|
||||
this.userName = data.name;
|
||||
},
|
||||
methods: {
|
||||
getUserInfo: async function() {
|
||||
const response = await userApi.requestUserInfo();
|
||||
return response.data.data;
|
||||
},
|
||||
logout: async function() {
|
||||
await authApi.logout();
|
||||
},
|
||||
goNotification: function() {
|
||||
this.$router.push("/notification");
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
:rules="[v => /.+@.+\..+/.test(v) || 'E-mail must be valid', v => !!v || '이메일은 필수 값입니다']"
|
||||
label="이메일"
|
||||
prepend-icon="mdi-account-circle"
|
||||
v-on:keydown.enter="login"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="password"
|
||||
@@ -18,6 +19,7 @@
|
||||
type="Password"
|
||||
prepend-icon="mdi-lock"
|
||||
append-icon="mdi-eye-off"
|
||||
v-on:keydown.enter="login"
|
||||
></v-text-field>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
@@ -25,20 +27,30 @@
|
||||
<v-card-actions>
|
||||
<v-btn color="success" v-on:click="links('/register')">Register</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="info" v-on:click="login">Login</v-btn>
|
||||
<v-btn color="info"
|
||||
v-on:click="login"
|
||||
>
|
||||
Login
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userApi from '../api/user.js'
|
||||
import jwt from "@/common/jwt";
|
||||
|
||||
export default {
|
||||
name: "LoginUser",
|
||||
mounted() {
|
||||
if (false == jwt.isExpired()) {
|
||||
this.$router.push('/order');
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
email: '',
|
||||
password: ''
|
||||
email: 'owner@gmail.com',
|
||||
password: '1234'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -50,7 +62,7 @@ export default {
|
||||
|
||||
const flag = await userApi.requestLoginUser(this.email, this.password);
|
||||
|
||||
if (flag) await this.$router.push('/prev-order');
|
||||
if (flag) await this.$router.push('/order');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,10 +198,7 @@ export default {
|
||||
method='put'
|
||||
else
|
||||
method='post'
|
||||
store.saveItem(method,itemData)
|
||||
.then(response => console.log(response))
|
||||
.catch(reason => console.log(reason))
|
||||
|
||||
store.saveItem(method,itemData);
|
||||
},
|
||||
addItemOption:function (itemOptionValue,type){
|
||||
var item = {
|
||||
|
||||
88
owner-vue/src/views/NotificationView.vue
Normal file
88
owner-vue/src/views/NotificationView.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<v-subheader class="py-0 d-flex justify-space-between rounded-lg">
|
||||
<h3>알림</h3>
|
||||
</v-subheader>
|
||||
<br>
|
||||
<template
|
||||
v-for="(item, index) in notifications">
|
||||
<v-list-item three-line :key="item.id">
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{item.title}}</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{item.message}}
|
||||
</v-list-item-subtitle>
|
||||
<v-list-item-subtitle>
|
||||
{{item.time}}
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
|
||||
<v-list-item-action>
|
||||
<v-checkbox
|
||||
disabled
|
||||
v-if="item.prevRead"
|
||||
v-model="item.read"
|
||||
hide-details></v-checkbox>
|
||||
<v-checkbox
|
||||
v-else
|
||||
v-model="item.read"
|
||||
@click="clickRead(item.id, item.read)"
|
||||
hide-details></v-checkbox>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
<v-divider
|
||||
v-if="index < notifications.length - 1"
|
||||
:key="'divider-' + index"
|
||||
></v-divider>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import notificationApi from "../api/notification";
|
||||
|
||||
export default {
|
||||
name: "NotificationView",
|
||||
mounted() {
|
||||
this.search();
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
notifications: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search: async function() {
|
||||
const response = await notificationApi.requestNotification();
|
||||
this.render(response.data);
|
||||
},
|
||||
render: function(json) {
|
||||
const notifications = json.data.notifications;
|
||||
notifications.forEach(notification => {
|
||||
this.notifications.push({
|
||||
id: notification.id,
|
||||
message: notification.message,
|
||||
title: notification.title,
|
||||
prevRead: notification.read,
|
||||
read: notification.read,
|
||||
time: notification.time
|
||||
});
|
||||
});
|
||||
},
|
||||
clickRead: async function(id, isRead) {
|
||||
await notificationApi.patchNotification(id, isRead);
|
||||
if (isRead) {
|
||||
alert("해당 알림은 읽음 처리되었습니다.");
|
||||
this.$emit("minusCount");
|
||||
} else {
|
||||
alert("해당 알림은 읽음 해제 처리되었습니다.");
|
||||
this.$emit("plusCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -20,18 +20,21 @@
|
||||
:itemNames="card.itemNames"
|
||||
:orderTime="card.orderTime"
|
||||
:orderStatus="card.orderStatus"
|
||||
@placed="card.orderStatus = 'PLACED'"
|
||||
@reject="card.orderStatus = 'REJECT'"
|
||||
@accepted="card.orderStatus = 'ACCEPTED'"
|
||||
@rejected="card.orderStatus = 'REJECTED'"
|
||||
@waiting="card.orderStatus = 'WAITING'"
|
||||
@finished="card.orderStatus = 'FINISHED'"
|
||||
>
|
||||
</order-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<br><br><br>
|
||||
<br><br>
|
||||
<v-row justify="center" v-if="hasNext">
|
||||
<v-btn rounded outlined color="primary"
|
||||
<v-btn color="#006A95" outlined
|
||||
@click="more">더보기</v-btn>
|
||||
</v-row>
|
||||
<br>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -68,7 +71,6 @@ export default {
|
||||
this.renderCard(response.data)
|
||||
},
|
||||
renderCard: function (json) {
|
||||
console.log(json);
|
||||
const orders = json.data.orders;
|
||||
const size = orders.length;
|
||||
|
||||
|
||||
@@ -105,10 +105,10 @@ export default {
|
||||
|
||||
this.orders.push({
|
||||
orderId: order.orderId,
|
||||
orderStatus: this.getOrderStatusName(order.orderStatus),
|
||||
orderStatus: this.$options.filters.getOrderStatusName(order.orderStatus),
|
||||
orderTime: order.orderTime,
|
||||
orderItemNames: this.getOrderItemName(order.orderItems),
|
||||
orderPrice: order.orderPrice,
|
||||
orderPrice: this.$options.filters.currency(order.orderPrice),
|
||||
userName: order.userName
|
||||
});
|
||||
})
|
||||
@@ -137,12 +137,6 @@ export default {
|
||||
inputEndDate: function(value) {
|
||||
this.endDate = value;
|
||||
},
|
||||
getOrderStatusName: function(orderStatus) {
|
||||
if (orderStatus === "ORDER") return "주문";
|
||||
if (orderStatus === "PLACED") return "주문 수락";
|
||||
if (orderStatus === "REJECT") return "주문 거절";
|
||||
return orderStatus;
|
||||
},
|
||||
getOrderItemName: function(orderItems) {
|
||||
const orderItemLength = orderItems.length;
|
||||
const orderItemName = orderItems[0].orderItemName;
|
||||
|
||||
@@ -3,6 +3,6 @@ module.exports = {
|
||||
'vuetify'
|
||||
],
|
||||
devServer:{
|
||||
allowedHosts: ['just-pickup.com'],
|
||||
allowedHosts: ['admin.just-pickup.com'],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.category.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QCategory is a Querydsl query type for Category
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QCategory extends EntityPathBase<Category> {
|
||||
|
||||
private static final long serialVersionUID = -1430562590L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QCategory category = new QCategory("category");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
public final ListPath<com.justpickup.storeservice.domain.item.entity.Item, com.justpickup.storeservice.domain.item.entity.QItem> items = this.<com.justpickup.storeservice.domain.item.entity.Item, com.justpickup.storeservice.domain.item.entity.QItem>createList("items", com.justpickup.storeservice.domain.item.entity.Item.class, com.justpickup.storeservice.domain.item.entity.QItem.class, PathInits.DIRECT2);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final StringPath name = createString("name");
|
||||
|
||||
public final NumberPath<Integer> order = createNumber("order", Integer.class);
|
||||
|
||||
public final com.justpickup.storeservice.domain.store.entity.QStore store;
|
||||
|
||||
public QCategory(String variable) {
|
||||
this(Category.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QCategory(Path<? extends Category> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QCategory(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QCategory(PathMetadata metadata, PathInits inits) {
|
||||
this(Category.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QCategory(Class<? extends Category> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.store = inits.isInitialized("store") ? new com.justpickup.storeservice.domain.store.entity.QStore(forProperty("store"), inits.get("store")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.favoritestore.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QFavoriteStore is a Querydsl query type for FavoriteStore
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QFavoriteStore extends EntityPathBase<FavoriteStore> {
|
||||
|
||||
private static final long serialVersionUID = -356764916L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QFavoriteStore favoriteStore = new QFavoriteStore("favoriteStore");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final com.justpickup.storeservice.domain.store.entity.QStore store;
|
||||
|
||||
public final NumberPath<Long> userId = createNumber("userId", Long.class);
|
||||
|
||||
public QFavoriteStore(String variable) {
|
||||
this(FavoriteStore.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QFavoriteStore(Path<? extends FavoriteStore> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QFavoriteStore(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QFavoriteStore(PathMetadata metadata, PathInits inits) {
|
||||
this(FavoriteStore.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QFavoriteStore(Class<? extends FavoriteStore> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.store = inits.isInitialized("store") ? new com.justpickup.storeservice.domain.store.entity.QStore(forProperty("store"), inits.get("store")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.item.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QItem is a Querydsl query type for Item
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QItem extends EntityPathBase<Item> {
|
||||
|
||||
private static final long serialVersionUID = -2047337460L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QItem item = new QItem("item");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
public final com.justpickup.storeservice.domain.category.entity.QCategory category;
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
public final ListPath<com.justpickup.storeservice.domain.itemoption.entity.ItemOption, com.justpickup.storeservice.domain.itemoption.entity.QItemOption> itemOptions = this.<com.justpickup.storeservice.domain.itemoption.entity.ItemOption, com.justpickup.storeservice.domain.itemoption.entity.QItemOption>createList("itemOptions", com.justpickup.storeservice.domain.itemoption.entity.ItemOption.class, com.justpickup.storeservice.domain.itemoption.entity.QItemOption.class, PathInits.DIRECT2);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final StringPath name = createString("name");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QPhoto photo;
|
||||
|
||||
public final NumberPath<Long> price = createNumber("price", Long.class);
|
||||
|
||||
public final EnumPath<com.justpickup.storeservice.global.entity.Yn> salesYn = createEnum("salesYn", com.justpickup.storeservice.global.entity.Yn.class);
|
||||
|
||||
public final com.justpickup.storeservice.domain.store.entity.QStore store;
|
||||
|
||||
public QItem(String variable) {
|
||||
this(Item.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QItem(Path<? extends Item> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QItem(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QItem(PathMetadata metadata, PathInits inits) {
|
||||
this(Item.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QItem(Class<? extends Item> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.category = inits.isInitialized("category") ? new com.justpickup.storeservice.domain.category.entity.QCategory(forProperty("category"), inits.get("category")) : null;
|
||||
this.photo = inits.isInitialized("photo") ? new com.justpickup.storeservice.global.entity.QPhoto(forProperty("photo")) : null;
|
||||
this.store = inits.isInitialized("store") ? new com.justpickup.storeservice.domain.store.entity.QStore(forProperty("store"), inits.get("store")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.itemoption.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QItemOption is a Querydsl query type for ItemOption
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QItemOption extends EntityPathBase<ItemOption> {
|
||||
|
||||
private static final long serialVersionUID = -374806570L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QItemOption itemOption = new QItemOption("itemOption");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
public final com.justpickup.storeservice.domain.item.entity.QItem item;
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final StringPath name = createString("name");
|
||||
|
||||
public final EnumPath<OptionType> optionType = createEnum("optionType", OptionType.class);
|
||||
|
||||
public final NumberPath<Long> price = createNumber("price", Long.class);
|
||||
|
||||
public QItemOption(String variable) {
|
||||
this(ItemOption.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QItemOption(Path<? extends ItemOption> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QItemOption(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QItemOption(PathMetadata metadata, PathInits inits) {
|
||||
this(ItemOption.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QItemOption(Class<? extends ItemOption> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.item = inits.isInitialized("item") ? new com.justpickup.storeservice.domain.item.entity.QItem(forProperty("item"), inits.get("item")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.map.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
|
||||
/**
|
||||
* QMap is a Querydsl query type for Map
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QMap extends EntityPathBase<Map> {
|
||||
|
||||
private static final long serialVersionUID = -1253033268L;
|
||||
|
||||
public static final QMap map = new QMap("map");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public QMap(String variable) {
|
||||
super(Map.class, forVariable(variable));
|
||||
}
|
||||
|
||||
public QMap(Path<? extends Map> path) {
|
||||
super(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
public QMap(PathMetadata metadata) {
|
||||
super(Map.class, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.review.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QReview is a Querydsl query type for Review
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QReview extends EntityPathBase<Review> {
|
||||
|
||||
private static final long serialVersionUID = -573894826L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QReview review = new QReview("review");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
public final StringPath content = createString("content");
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final NumberPath<Long> orderId = createNumber("orderId", Long.class);
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QPhoto photo;
|
||||
|
||||
public final com.justpickup.storeservice.domain.reviewreply.entity.QReviewReply reviewReply;
|
||||
|
||||
public final NumberPath<Integer> starRating = createNumber("starRating", Integer.class);
|
||||
|
||||
public final com.justpickup.storeservice.domain.store.entity.QStore store;
|
||||
|
||||
public final NumberPath<Long> userId = createNumber("userId", Long.class);
|
||||
|
||||
public QReview(String variable) {
|
||||
this(Review.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QReview(Path<? extends Review> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QReview(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QReview(PathMetadata metadata, PathInits inits) {
|
||||
this(Review.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QReview(Class<? extends Review> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.photo = inits.isInitialized("photo") ? new com.justpickup.storeservice.global.entity.QPhoto(forProperty("photo")) : null;
|
||||
this.reviewReply = inits.isInitialized("reviewReply") ? new com.justpickup.storeservice.domain.reviewreply.entity.QReviewReply(forProperty("reviewReply")) : null;
|
||||
this.store = inits.isInitialized("store") ? new com.justpickup.storeservice.domain.store.entity.QStore(forProperty("store"), inits.get("store")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.reviewreply.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
|
||||
/**
|
||||
* QReviewReply is a Querydsl query type for ReviewReply
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QReviewReply extends EntityPathBase<ReviewReply> {
|
||||
|
||||
private static final long serialVersionUID = -1004430868L;
|
||||
|
||||
public static final QReviewReply reviewReply = new QReviewReply("reviewReply");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
public final StringPath content = createString("content");
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public QReviewReply(String variable) {
|
||||
super(ReviewReply.class, forVariable(variable));
|
||||
}
|
||||
|
||||
public QReviewReply(Path<? extends ReviewReply> path) {
|
||||
super(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
public QReviewReply(PathMetadata metadata) {
|
||||
super(ReviewReply.class, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.justpickup.storeservice.domain.store.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.dsl.PathInits;
|
||||
|
||||
|
||||
/**
|
||||
* QStore is a Querydsl query type for Store
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
|
||||
public class QStore extends EntityPathBase<Store> {
|
||||
|
||||
private static final long serialVersionUID = 358375596L;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
public static final QStore store = new QStore("store");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QBaseEntity _super = new com.justpickup.storeservice.global.entity.QBaseEntity(this);
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QAddress address;
|
||||
|
||||
public final DateTimePath<java.time.LocalDateTime> businessEndTime = createDateTime("businessEndTime", java.time.LocalDateTime.class);
|
||||
|
||||
public final DateTimePath<java.time.LocalDateTime> businessStartTime = createDateTime("businessStartTime", java.time.LocalDateTime.class);
|
||||
|
||||
public final ListPath<com.justpickup.storeservice.domain.category.entity.Category, com.justpickup.storeservice.domain.category.entity.QCategory> categories = this.<com.justpickup.storeservice.domain.category.entity.Category, com.justpickup.storeservice.domain.category.entity.QCategory>createList("categories", com.justpickup.storeservice.domain.category.entity.Category.class, com.justpickup.storeservice.domain.category.entity.QCategory.class, PathInits.DIRECT2);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = _super.createdAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> createdBy = _super.createdBy;
|
||||
|
||||
public final NumberPath<Long> id = createNumber("id", Long.class);
|
||||
|
||||
public final ListPath<com.justpickup.storeservice.domain.item.entity.Item, com.justpickup.storeservice.domain.item.entity.QItem> items = this.<com.justpickup.storeservice.domain.item.entity.Item, com.justpickup.storeservice.domain.item.entity.QItem>createList("items", com.justpickup.storeservice.domain.item.entity.Item.class, com.justpickup.storeservice.domain.item.entity.QItem.class, PathInits.DIRECT2);
|
||||
|
||||
//inherited
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = _super.lastModifiedAt;
|
||||
|
||||
//inherited
|
||||
public final NumberPath<Long> lastModifiedBy = _super.lastModifiedBy;
|
||||
|
||||
public final com.justpickup.storeservice.domain.map.entity.QMap map;
|
||||
|
||||
public final StringPath phoneNumber = createString("phoneNumber");
|
||||
|
||||
public final com.justpickup.storeservice.global.entity.QPhoto photo;
|
||||
|
||||
public final NumberPath<Long> userId = createNumber("userId", Long.class);
|
||||
|
||||
public QStore(String variable) {
|
||||
this(Store.class, forVariable(variable), INITS);
|
||||
}
|
||||
|
||||
public QStore(Path<? extends Store> path) {
|
||||
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
|
||||
}
|
||||
|
||||
public QStore(PathMetadata metadata) {
|
||||
this(metadata, PathInits.getFor(metadata, INITS));
|
||||
}
|
||||
|
||||
public QStore(PathMetadata metadata, PathInits inits) {
|
||||
this(Store.class, metadata, inits);
|
||||
}
|
||||
|
||||
public QStore(Class<? extends Store> type, PathMetadata metadata, PathInits inits) {
|
||||
super(type, metadata, inits);
|
||||
this.address = inits.isInitialized("address") ? new com.justpickup.storeservice.global.entity.QAddress(forProperty("address")) : null;
|
||||
this.map = inits.isInitialized("map") ? new com.justpickup.storeservice.domain.map.entity.QMap(forProperty("map")) : null;
|
||||
this.photo = inits.isInitialized("photo") ? new com.justpickup.storeservice.global.entity.QPhoto(forProperty("photo")) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.justpickup.storeservice.global.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
|
||||
/**
|
||||
* QAddress is a Querydsl query type for Address
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEmbeddableSerializer")
|
||||
public class QAddress extends BeanPath<Address> {
|
||||
|
||||
private static final long serialVersionUID = -1606742445L;
|
||||
|
||||
public static final QAddress address = new QAddress("address");
|
||||
|
||||
public final StringPath city = createString("city");
|
||||
|
||||
public final StringPath street = createString("street");
|
||||
|
||||
public final StringPath zipcode = createString("zipcode");
|
||||
|
||||
public QAddress(String variable) {
|
||||
super(Address.class, forVariable(variable));
|
||||
}
|
||||
|
||||
public QAddress(Path<? extends Address> path) {
|
||||
super(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
public QAddress(PathMetadata metadata) {
|
||||
super(Address.class, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.justpickup.storeservice.global.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
|
||||
/**
|
||||
* QBaseEntity is a Querydsl query type for BaseEntity
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultSupertypeSerializer")
|
||||
public class QBaseEntity extends EntityPathBase<BaseEntity> {
|
||||
|
||||
private static final long serialVersionUID = -1618660523L;
|
||||
|
||||
public static final QBaseEntity baseEntity = new QBaseEntity("baseEntity");
|
||||
|
||||
public final DateTimePath<java.time.LocalDateTime> createdAt = createDateTime("createdAt", java.time.LocalDateTime.class);
|
||||
|
||||
public final NumberPath<Long> createdBy = createNumber("createdBy", Long.class);
|
||||
|
||||
public final DateTimePath<java.time.LocalDateTime> lastModifiedAt = createDateTime("lastModifiedAt", java.time.LocalDateTime.class);
|
||||
|
||||
public final NumberPath<Long> lastModifiedBy = createNumber("lastModifiedBy", Long.class);
|
||||
|
||||
public QBaseEntity(String variable) {
|
||||
super(BaseEntity.class, forVariable(variable));
|
||||
}
|
||||
|
||||
public QBaseEntity(Path<? extends BaseEntity> path) {
|
||||
super(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
public QBaseEntity(PathMetadata metadata) {
|
||||
super(BaseEntity.class, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.justpickup.storeservice.global.entity;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.*;
|
||||
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
|
||||
import com.querydsl.core.types.PathMetadata;
|
||||
import javax.annotation.processing.Generated;
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
|
||||
/**
|
||||
* QPhoto is a Querydsl query type for Photo
|
||||
*/
|
||||
@Generated("com.querydsl.codegen.DefaultEmbeddableSerializer")
|
||||
public class QPhoto extends BeanPath<Photo> {
|
||||
|
||||
private static final long serialVersionUID = 329628753L;
|
||||
|
||||
public static final QPhoto photo = new QPhoto("photo");
|
||||
|
||||
public final StringPath name = createString("name");
|
||||
|
||||
public final StringPath path = createString("path");
|
||||
|
||||
public QPhoto(String variable) {
|
||||
super(Photo.class, forVariable(variable));
|
||||
}
|
||||
|
||||
public QPhoto(Path<? extends Photo> path) {
|
||||
super(path.getType(), path.getMetadata());
|
||||
}
|
||||
|
||||
public QPhoto(PathMetadata metadata) {
|
||||
super(Photo.class, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.justpickup.storeservice.domain.category.entity.Category;
|
||||
import com.justpickup.storeservice.domain.category.entity.QCategory;
|
||||
import com.justpickup.storeservice.domain.item.entity.QItem;
|
||||
import com.justpickup.storeservice.domain.store.entity.QStore;
|
||||
import com.querydsl.core.QueryFactory;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -17,21 +16,25 @@ public class CategoryRepositoryCustom {
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
public List<Category> getCategoryList(Long userId){
|
||||
public List<Category> getCategoryListByUserId(Long userId){
|
||||
|
||||
List<Category> categoryList = jpaQueryFactory.selectFrom(QCategory.category)
|
||||
return jpaQueryFactory.selectFrom(QCategory.category)
|
||||
.leftJoin(QCategory.category.items, QItem.item).fetchJoin()
|
||||
.join(QCategory.category.store, QStore.store).fetchJoin()
|
||||
.where(QCategory.category.store.userId.eq(userId))
|
||||
.orderBy(QCategory.category.order.asc())
|
||||
.distinct()
|
||||
.fetch();
|
||||
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
public List<Category> getCategoryListById(Long storeId){
|
||||
|
||||
|
||||
|
||||
|
||||
return jpaQueryFactory.selectFrom(QCategory.category)
|
||||
.leftJoin(QCategory.category.items, QItem.item).fetchJoin()
|
||||
.join(QCategory.category.store, QStore.store).fetchJoin()
|
||||
.where(QCategory.category.store.id.eq(storeId))
|
||||
.orderBy(QCategory.category.order.asc())
|
||||
.distinct()
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,15 @@ public class CategoryService {
|
||||
private final CategoryRepositoryCustom categoryRepositoryCustom;
|
||||
private final StoreRepository storeRepository;
|
||||
|
||||
public List<CategoryDto> getCategoriesWithItem(Long storeId){
|
||||
public List<CategoryDto> getCategoriesWithItemByUserId(Long userId){
|
||||
return categoryRepositoryCustom.getCategoryListByUserId(userId)
|
||||
.stream()
|
||||
.map(CategoryDto::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return categoryRepositoryCustom.getCategoryList(storeId)
|
||||
public List<CategoryDto> getCategoriesWithItemById(Long storeId){
|
||||
return categoryRepositoryCustom.getCategoryListById(storeId)
|
||||
.stream()
|
||||
.map(CategoryDto::new)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -24,7 +24,7 @@ public class CategoryCustomerApiController {
|
||||
|
||||
@GetMapping("/categories")
|
||||
public ResponseEntity<Result> getCategories(@RequestParam("storeId") Long storeId) {
|
||||
List<CategoryDto> categoryList = categoryService.getCategoriesWithItem(storeId);
|
||||
List<CategoryDto> categoryList = categoryService.getCategoriesWithItemById(storeId);
|
||||
|
||||
GetCategoriesResponse getCategoriesResponse = new GetCategoriesResponse(categoryList);
|
||||
|
||||
|
||||
@@ -22,21 +22,18 @@ public class CategoryOwnerApiController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@GetMapping("/category")
|
||||
public ResponseEntity getCategoryList(@RequestHeader(value = "user-id") String userId ){
|
||||
Long storeId = Long.parseLong(userId);
|
||||
List<CategoryDto> categoryList = categoryService.getCategoriesWithItem(storeId);
|
||||
public ResponseEntity getCategoryList(@RequestHeader(value = "user-id") String userHeader){
|
||||
Long userId = Long.parseLong(userHeader);
|
||||
List<CategoryDto> categoryList = categoryService.getCategoriesWithItemByUserId(userId);
|
||||
|
||||
List<CategoryResponse> categoryResponseList = categoryList.stream()
|
||||
.map(CategoryResponse::new)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(Result.createSuccessResult(categoryResponseList));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
static class CategoryResponse{
|
||||
private Long categoryId;
|
||||
|
||||
@@ -54,13 +54,15 @@ public class RefreshTokenServiceImpl implements RefreshTokenService {
|
||||
|
||||
// refresh token 검증
|
||||
String findRefreshTokenId = findRefreshToken.getRefreshTokenId();
|
||||
if (!jwtTokenProvider.validateJwtToken(refreshToken) ||
|
||||
!jwtTokenProvider.equalRefreshTokenId(findRefreshTokenId, refreshToken)) {
|
||||
|
||||
if (!jwtTokenProvider.validateJwtToken(refreshToken)) {
|
||||
refreshTokenRedisRepository.delete(findRefreshToken);
|
||||
throw new RefreshTokenNotValidException("Not validate jwt token = " + refreshToken);
|
||||
}
|
||||
|
||||
if (!jwtTokenProvider.equalRefreshTokenId(findRefreshTokenId, refreshToken)) {
|
||||
throw new RefreshTokenNotValidException("redis 의 값과 일치하지 않습니다. = " + refreshToken);
|
||||
}
|
||||
|
||||
User findUser = userRepository.findById(Long.valueOf(userId))
|
||||
.orElseThrow(() -> new NotExistUserException("유저 고유 번호 : " + userId + "는 없는 유저입니다."));
|
||||
|
||||
@@ -69,7 +71,7 @@ public class RefreshTokenServiceImpl implements RefreshTokenService {
|
||||
List<String> roles = authentication.getAuthorities()
|
||||
.stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
|
||||
|
||||
String newAccessToken = jwtTokenProvider.createJwtAccessToken(userId, "/refreshToken", roles);
|
||||
String newAccessToken = jwtTokenProvider.createJwtAccessToken(userId, "/reissu", roles);
|
||||
Date expiredTime = jwtTokenProvider.getExpiredTime(newAccessToken);
|
||||
|
||||
return JwtTokenDto.builder()
|
||||
|
||||
@@ -29,8 +29,8 @@ public class AuthController {
|
||||
private final CookieProvider cookieProvider;
|
||||
|
||||
@GetMapping("/reissue")
|
||||
public ResponseEntity<Result> refreshToken(@RequestHeader("X-AUTH-TOKEN") String accessToken,
|
||||
@CookieValue("refresh-token") String refreshToken) {
|
||||
public ResponseEntity<Result> refreshToken(@RequestHeader(value = "X-AUTH-TOKEN") String accessToken,
|
||||
@CookieValue(value = "refresh-token") String refreshToken) {
|
||||
JwtTokenDto jwtTokenDto = refreshTokenService.refreshJwtToken(accessToken, refreshToken);
|
||||
|
||||
ResponseCookie responseCookie = cookieProvider.createRefreshTokenCookie(refreshToken);
|
||||
@@ -55,8 +55,7 @@ public class AuthController {
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public ResponseEntity<Result> logout(@RequestHeader("X-AUTH-TOKEN") String accessToken,
|
||||
@RequestHeader("REFRESH-TOKEN") String refreshToken) {
|
||||
public ResponseEntity<Result> logout(@RequestHeader("X-AUTH-TOKEN") String accessToken) {
|
||||
|
||||
refreshTokenService.logoutToken(accessToken);
|
||||
|
||||
@@ -64,7 +63,7 @@ public class AuthController {
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.header(HttpHeaders.SET_COOKIE, refreshCookie.toString())
|
||||
.body(Result.createErrorResult(""));
|
||||
.body(Result.createSuccessResult(""));
|
||||
}
|
||||
|
||||
@GetMapping("/check/access-token")
|
||||
|
||||
@@ -17,8 +17,8 @@ public class CustomerDto extends UserDto {
|
||||
|
||||
@Builder
|
||||
public CustomerDto(Long id, String email, String password, String name,
|
||||
String phoneNumber, String dtype, String refreshTokenId) {
|
||||
super(id, email, password, name, phoneNumber, dtype, refreshTokenId);
|
||||
String phoneNumber, String dtype) {
|
||||
super(id, email, password, name, phoneNumber, dtype);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.justpickup.userservice.domain.user.dto;
|
||||
|
||||
import com.justpickup.userservice.domain.user.entity.StoreOwner;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -9,8 +10,13 @@ public class StoreOwnerDto extends UserDto {
|
||||
|
||||
@Builder
|
||||
public StoreOwnerDto(Long id, String email, String password, String name,
|
||||
String phoneNumber, String dtype, String businessNumber, String refreshTokenId) {
|
||||
super(id, email, password, name, phoneNumber, dtype, refreshTokenId);
|
||||
String phoneNumber, String dtype, String businessNumber) {
|
||||
super(id, email, password, name, phoneNumber, dtype);
|
||||
this.businessNumber = businessNumber;
|
||||
}
|
||||
|
||||
public static StoreOwnerDto of(StoreOwner storeOwner) {
|
||||
return new StoreOwnerDto(storeOwner.getId(), storeOwner.getEmail(), storeOwner.getPassword(),
|
||||
storeOwner.getName(), storeOwner.getPhoneNumber(), storeOwner.getDtype(), storeOwner.getBusinessNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ public abstract class UserDto {
|
||||
private String name;
|
||||
private String phoneNumber;
|
||||
private String dtype;
|
||||
private String refreshTokenId;
|
||||
|
||||
// == 생성 메소드 == //
|
||||
public UserDto(Customer customer) {
|
||||
@@ -23,13 +22,12 @@ public abstract class UserDto {
|
||||
}
|
||||
|
||||
public UserDto(Long id, String email, String password, String name, String phoneNumber,
|
||||
String dtype, String refreshTokenId) {
|
||||
String dtype) {
|
||||
this.id = id;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.name = name;
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.dtype = dtype;
|
||||
this.refreshTokenId = refreshTokenId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,5 @@ public interface UserService {
|
||||
CustomerDto findCustomerByUserId(Long userId);
|
||||
void saveStoreOwner(StoreOwnerDto storeOwnerDto);
|
||||
List<CustomerDto> findCustomerByUserIds(List<Long> userIds);
|
||||
StoreOwnerDto findOwnerById(Long userId);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.justpickup.userservice.domain.user.entity.User;
|
||||
import com.justpickup.userservice.domain.user.exception.DuplicateUserEmail;
|
||||
import com.justpickup.userservice.domain.user.exception.NotExistUserException;
|
||||
import com.justpickup.userservice.domain.user.repository.CustomerRepository;
|
||||
import com.justpickup.userservice.domain.user.repository.StoreOwnerRepository;
|
||||
import com.justpickup.userservice.domain.user.repository.UserRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,6 +33,7 @@ import java.util.stream.Collectors;
|
||||
public class UserServiceImpl implements UserService, UserDetailsService {
|
||||
|
||||
private final CustomerRepository customerRepository;
|
||||
private final StoreOwnerRepository storeOwnerRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
|
||||
@@ -77,4 +79,12 @@ public class UserServiceImpl implements UserService, UserDetailsService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoreOwnerDto findOwnerById(Long userId) {
|
||||
StoreOwner storeOwner = storeOwnerRepository.findById(userId)
|
||||
.orElseThrow(() -> new NotExistUserException(userId + "는 존재하지 않은 사용자입니다."));
|
||||
|
||||
return StoreOwnerDto.of(storeOwner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@GetMapping("/customer/")
|
||||
public ResponseEntity getCustomerByToken(@Valid @RequestHeader(value = "user-id") String userId ) {
|
||||
@GetMapping("/customer")
|
||||
public ResponseEntity getCustomerByToken(@Valid @RequestHeader(value="user-id") String userId) {
|
||||
|
||||
CustomerDto customerDto = userService.findCustomerByUserId(Long.parseLong(userId));
|
||||
|
||||
@@ -90,6 +90,26 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/store-owner")
|
||||
public ResponseEntity<Result> getStoreOwnerByToken(@RequestHeader(value="user-id") String userHeader) {
|
||||
Long userId = Long.valueOf(userHeader);
|
||||
|
||||
StoreOwnerDto storeOwnerDto = userService.findOwnerById(userId);
|
||||
|
||||
return ResponseEntity.ok(Result.createSuccessResult(storeOwnerDto));
|
||||
}
|
||||
|
||||
@Data
|
||||
static class StoreOwnerByTokenResponse {
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public StoreOwnerByTokenResponse(StoreOwnerDto dto) {
|
||||
this.id = dto.getId();
|
||||
this.name = dto.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/store-owner")
|
||||
public ResponseEntity<Result> joinStoreOwner(@Valid @RequestBody JoinStoreOwnerRequest joinRequest) {
|
||||
// 회원 가입
|
||||
|
||||
@@ -22,6 +22,8 @@ public class CookieProvider {
|
||||
|
||||
public ResponseCookie removeRefreshTokenCookie() {
|
||||
return ResponseCookie.from("refresh-token", null)
|
||||
.maxAge(0)
|
||||
.path("/")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user