Skip to content

Commit

Permalink
style : 코드 포맷팅
Browse files Browse the repository at this point in the history
  • Loading branch information
kkangh00n committed Jan 14, 2024
1 parent d3ffb89 commit 99688d9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.prgrms.catchtable.shop.domain;

import static com.prgrms.catchtable.common.exception.ErrorCode.*;
import static com.prgrms.catchtable.common.exception.ErrorCode.INVALID_INPUT_TYPE;

import com.prgrms.catchtable.common.exception.ErrorCode;
import com.prgrms.catchtable.common.exception.custom.BadRequestCustomException;
import java.util.Arrays;
import lombok.Getter;
Expand Down
20 changes: 5 additions & 15 deletions src/main/java/com/prgrms/catchtable/shop/domain/Shop.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.prgrms.catchtable.shop.domain;

import static com.prgrms.catchtable.common.exception.ErrorCode.SHOP_NOT_RUNNING;
import static jakarta.persistence.CascadeType.*;
import static jakarta.persistence.CascadeType.ALL;
import static jakarta.persistence.EnumType.STRING;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

import com.prgrms.catchtable.common.BaseEntity;
import com.prgrms.catchtable.common.exception.custom.BadRequestCustomException;
import com.prgrms.catchtable.reservation.domain.ReservationTime;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
Expand All @@ -31,37 +29,29 @@
@Entity
public class Shop extends BaseEntity {

@BatchSize(size = 30)
@OneToMany(mappedBy = "shop", cascade = ALL, orphanRemoval = true)
List<Menu> menuList = new ArrayList<>();
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "shop_id")
private Long id;

@Column(name = "shop_name")
private String name;

@Column(name = "rating")
private BigDecimal rating;

@Column(name = "category")
@Enumerated(STRING)
private Category category;

@Embedded
private Address address;

@Column(name = "capacity")
private int capacity;

@Column(name = "opening_time")
private LocalTime openingTime;

@Column(name = "closing_time")
private LocalTime closingTime;

@BatchSize(size = 30)
@OneToMany(mappedBy = "shop", cascade = ALL, orphanRemoval = true)
List<Menu> menuList = new ArrayList<>();

@Builder
public Shop(String name, BigDecimal rating, Category category, Address address, int capacity,
LocalTime openingTime, LocalTime closingTime) {
Expand All @@ -74,7 +64,7 @@ public Shop(String name, BigDecimal rating, Category category, Address address,
this.closingTime = closingTime;
}

public void updateMenuList(List<Menu> menuList){
public void updateMenuList(List<Menu> menuList) {
this.menuList.addAll(menuList);
this.menuList.forEach(menu -> menu.insertShop(this));
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/prgrms/catchtable/shop/dto/ShopMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ private static GetAllShopResponse toGetAllShopResponse(Shop shop) {
.build();
}

public static GetShopResponse toGetShopResponse(Shop shop, List<ReservationTime> reservationTimeList) {
public static GetShopResponse toGetShopResponse(Shop shop,
List<ReservationTime> reservationTimeList) {

List<MenuResponse> menuResponses = shop.getMenuList().stream()
.map(menu -> MenuResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.prgrms.catchtable.common.restdocs;

import static com.prgrms.catchtable.common.Role.*;
import static com.prgrms.catchtable.common.Role.MEMBER;
import static com.prgrms.catchtable.common.Role.OWNER;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.prgrms.catchtable.common.Role;
import com.prgrms.catchtable.jwt.provider.JwtTokenProvider;
import com.prgrms.catchtable.jwt.token.Token;
import com.prgrms.catchtable.member.domain.Member;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package com.prgrms.catchtable.security.controller;

import static org.springframework.http.MediaType.*;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.prgrms.catchtable.common.Role;
import com.prgrms.catchtable.common.base.BaseIntegrationTest;
import com.prgrms.catchtable.jwt.domain.RefreshToken;
import com.prgrms.catchtable.jwt.provider.JwtTokenProvider;
import com.prgrms.catchtable.jwt.repository.RefreshTokenRepository;
import com.prgrms.catchtable.jwt.service.RefreshTokenService;
import com.prgrms.catchtable.jwt.token.Token;
import com.prgrms.catchtable.member.MemberFixture;
import com.prgrms.catchtable.member.domain.Member;
Expand All @@ -24,7 +22,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ void getAllTest() throws Exception {
.headers(httpHeaders))
.andExpect(status().isOk())
.andExpect(jsonPath("$.shopResponses.[0].name").value(shop.getName()))
.andExpect(jsonPath("$.shopResponses.[0].openingTime").value(shop.getOpeningTime().toString()))
.andExpect(jsonPath("$.shopResponses.[0].closingTime").value(shop.getClosingTime().toString()));
.andExpect(
jsonPath("$.shopResponses.[0].openingTime").value(shop.getOpeningTime().toString()))
.andExpect(jsonPath("$.shopResponses.[0].closingTime").value(
shop.getClosingTime().toString()));
}

@Test
Expand Down Expand Up @@ -116,7 +118,9 @@ void getBySearchTest() throws Exception {
.params(params))
.andExpect(status().isOk())
.andExpect(jsonPath("$.shopResponses.[0].name").value(shop.getName()))
.andExpect(jsonPath("$.shopResponses.[0].openingTime").value(shop.getOpeningTime().toString()))
.andExpect(jsonPath("$.shopResponses.[0].closingTime").value(shop.getClosingTime().toString()));
.andExpect(
jsonPath("$.shopResponses.[0].openingTime").value(shop.getOpeningTime().toString()))
.andExpect(jsonPath("$.shopResponses.[0].closingTime").value(
shop.getClosingTime().toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import com.prgrms.catchtable.common.exception.custom.BadRequestCustomException;
import com.prgrms.catchtable.common.exception.custom.NotFoundCustomException;
import com.prgrms.catchtable.owner.domain.Owner;
import com.prgrms.catchtable.owner.fixture.OwnerFixture;
Expand Down

0 comments on commit 99688d9

Please sign in to comment.