Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop -> main #1135

Merged
merged 30 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f9c9d8d
feat : 도메인 λͺ¨λΈ λΉ„μŠ€λ‹ˆμŠ€ κ΅¬ν˜„ 둜직 μž‘μ„±
DHkimgit Nov 26, 2024
f62e322
feat : command DTO μž‘μ„±
DHkimgit Nov 26, 2024
c138c80
feat : BusStation enum 멀버 μΆ”κ°€
DHkimgit Nov 26, 2024
70e5b38
feat : repository query λ©”μ†Œλ“œ μΆ”κ°€
DHkimgit Nov 26, 2024
180f899
feat : μ „λž΅νŒ¨ν„΄ μΈν„°νŽ˜μ΄μŠ€ μž‘μ„±
DHkimgit Nov 26, 2024
8f487af
feat : μ „λž΅νŒ¨ν„΄ κ΅¬ν˜„μ²΄ μž‘μ„±
DHkimgit Nov 26, 2024
fa05713
feat : response DTO μž‘μ„±
DHkimgit Nov 26, 2024
ab7e344
feat : μ‹œλ‚΄λ²„μŠ€ μŠ€μΌ€μ€„ 쑰회 κ΅¬ν˜„ 둜직 κ°œμ„ 
DHkimgit Nov 26, 2024
cd81e3b
feat : λŒ€μ„± λ²„μŠ€ μŠ€μΌ€μ€„ 데이터 μž‘μ„±
DHkimgit Nov 26, 2024
69ed6b8
feat : service 계측 μž‘μ„±
DHkimgit Nov 26, 2024
e8f80cf
feat : controller μž‘μ„±
DHkimgit Nov 26, 2024
552b763
chore : 클래슀 이름 λ³€κ²½
DHkimgit Nov 26, 2024
65a66b9
refactor : μ…”ν‹€λ²„μŠ€ κ΅¬ν˜„μ²΄ 톡합
DHkimgit Nov 26, 2024
fca0a90
chore : 좜λ ₯ μˆ˜μ •, μƒμˆ˜ μΆ”κ°€
DHkimgit Nov 26, 2024
bb908b5
chore : static import 적용
DHkimgit Nov 28, 2024
a8646e4
chore : μ½”λ“œ 리뷰 반영 - indent
DHkimgit Nov 28, 2024
475534c
feat : λ²„μŠ€ νƒ€μž… μ •λ ¬ κΈ°μ€€ μΆ”κ°€
DHkimgit Dec 6, 2024
f3fecd8
feature: λͺ¨λ“  상점 쑰회 API에 ν˜œνƒ 상세 ν•„λ“œ μΆ”κ°€ (#1121)
20HyeonsuLee Dec 6, 2024
ef1ef9e
feat : Api μΈν„°νŽ˜μ΄μŠ€ λ©”μ„œλ“œ μΆ”κ°€
DHkimgit Dec 6, 2024
d874940
feat: 상점 ν˜œνƒ 상세보기 ν•„λ“œ μΆ”κ°€ (#1123)
BaeJinho4028 Dec 7, 2024
187fbd2
chore : 주석, μŠ€ν‚€λ§ˆ μˆ˜μ • 및 κ°œμ„ 
DHkimgit Dec 10, 2024
0552b56
chore : 주석, μŠ€ν‚€λ§ˆ μˆ˜μ • 및 κ°œμ„ 
DHkimgit Dec 10, 2024
bc82893
refactor: μ—‘μ…€ λ©”μ„œλ“œ 뢄리 (#1041)
dradnats1012 Dec 11, 2024
031e938
fix : 일뢀 μš”μ²­μ— λŒ€ν•΄ 404 μ—λŸ¬ λ°˜ν™˜ν•˜λŠ” 였λ₯˜ μˆ˜μ •
DHkimgit Dec 11, 2024
2c4291b
feat : μ²œμ•ˆμ—­ <-> 터미널 정보 제곡
DHkimgit Dec 11, 2024
392dfab
feat: λ²„μŠ€ κ΅ν†΅νŽΈ 쑰회 API
DHkimgit Dec 12, 2024
610fee0
feat: μ–΄λ“œλ―Ό ν˜œνƒ 상세 νŽ˜μ΄μ§€ ν˜œνƒλ¬Έκ΅¬ 미리보기 μΆ”κ°€ (#1132)
krSeonghyeon Dec 12, 2024
91f7692
feat: ν•™κ΅λ²„μŠ€ μ‹œκ°„ν‘œ κ΄€λ ¨ API (#1119)
kih1015 Dec 12, 2024
14d9d8e
chore: 지역 이름 μˆ˜μ • (#1134)
kih1015 Dec 12, 2024
885875d
fix: μ–΄λ“œλ―Ό νžˆμŠ€ν† λ¦¬ κΈ°λŠ₯ μˆ˜μ • (#1131)
Soundbar91 Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import in.koreatech.koin.admin.benefit.dto.AdminBenefitCategoryResponse;
import in.koreatech.koin.admin.benefit.dto.AdminBenefitCategoriesResponse;
import in.koreatech.koin.admin.benefit.dto.AdminBenefitShopsResponse;
import in.koreatech.koin.admin.benefit.dto.AdminCreateBenefitCategoryRequest;
import in.koreatech.koin.admin.benefit.dto.AdminCreateBenefitCategoryResponse;
Expand All @@ -21,6 +21,7 @@
import in.koreatech.koin.admin.benefit.dto.AdminDeleteShopsRequest;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitCategoryRequest;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitCategoryResponse;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitShopsRequest;
import in.koreatech.koin.admin.benefit.dto.AdminSearchBenefitShopsResponse;
import in.koreatech.koin.global.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -44,7 +45,7 @@ public interface AdminBenefitApi {
)
@Operation(summary = "상점 ν˜œνƒ μΉ΄ν…Œκ³ λ¦¬λ₯Ό λͺ¨λ‘ μ‘°νšŒν•œλ‹€.")
@GetMapping("/categories")
ResponseEntity<AdminBenefitCategoryResponse> getBenefitCategories(
ResponseEntity<AdminBenefitCategoriesResponse> getBenefitCategories(
@Auth(permit = {ADMIN}) Integer adminId
);

Expand Down Expand Up @@ -127,6 +128,22 @@ ResponseEntity<AdminCreateBenefitShopsResponse> createBenefitShops(
@Auth(permit = {ADMIN}) Integer adminId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "201"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
}
)
@Operation(summary = "νŠΉμ • ν˜œνƒμ„ μ œκ³΅ν•˜λŠ” 상점을 μˆ˜μ •ν•œλ‹€.")
@PutMapping
ResponseEntity<Void> modifyBenefitShops(
@RequestBody AdminModifyBenefitShopsRequest request,
@Auth(permit = {ADMIN}) Integer adminId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "204"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import in.koreatech.koin.admin.benefit.dto.AdminBenefitCategoryResponse;
import in.koreatech.koin.admin.benefit.dto.AdminBenefitCategoriesResponse;
import in.koreatech.koin.admin.benefit.dto.AdminBenefitShopsResponse;
import in.koreatech.koin.admin.benefit.dto.AdminCreateBenefitCategoryRequest;
import in.koreatech.koin.admin.benefit.dto.AdminCreateBenefitCategoryResponse;
Expand All @@ -23,6 +23,7 @@
import in.koreatech.koin.admin.benefit.dto.AdminDeleteShopsRequest;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitCategoryRequest;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitCategoryResponse;
import in.koreatech.koin.admin.benefit.dto.AdminModifyBenefitShopsRequest;
import in.koreatech.koin.admin.benefit.dto.AdminSearchBenefitShopsResponse;
import in.koreatech.koin.admin.benefit.service.AdminBenefitService;
import in.koreatech.koin.global.auth.Auth;
Expand All @@ -36,10 +37,10 @@ public class AdminBenefitController implements AdminBenefitApi {
private final AdminBenefitService adminBenefitService;

@GetMapping("/categories")
public ResponseEntity<AdminBenefitCategoryResponse> getBenefitCategories(
public ResponseEntity<AdminBenefitCategoriesResponse> getBenefitCategories(
@Auth(permit = {ADMIN}) Integer adminId
) {
AdminBenefitCategoryResponse response = adminBenefitService.getBenefitCategories();
AdminBenefitCategoriesResponse response = adminBenefitService.getBenefitCategories();
return ResponseEntity.ok(response);
}

Expand Down Expand Up @@ -90,6 +91,15 @@ public ResponseEntity<AdminCreateBenefitShopsResponse> createBenefitShops(
return ResponseEntity.status(HttpStatus.CREATED).body(response);
}

@PutMapping
public ResponseEntity<Void> modifyBenefitShops(
@RequestBody AdminModifyBenefitShopsRequest request,
@Auth(permit = {ADMIN}) Integer adminId
) {
adminBenefitService.modifyBenefitShops(request);
return ResponseEntity.ok().build();
}

@DeleteMapping("/{id}/shops")
public ResponseEntity<Void> deleteBenefitShops(
@PathVariable("id") Integer benefitId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import io.swagger.v3.oas.annotations.media.Schema;

@JsonNaming(SnakeCaseStrategy.class)
public record AdminBenefitCategoryResponse(
public record AdminBenefitCategoriesResponse(
@Schema(description = "ν˜œνƒ μΉ΄ν…Œκ³ λ¦¬ 리슀트")
List<InnerBenefitResponse> benefits
) {

public static AdminBenefitCategoryResponse from(List<BenefitCategory> benefitCategories) {
return new AdminBenefitCategoryResponse(
public static AdminBenefitCategoriesResponse from(List<BenefitCategory> benefitCategories) {
return new AdminBenefitCategoriesResponse(
benefitCategories.stream().map(InnerBenefitResponse::from).toList()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import in.koreatech.koin.domain.benefit.model.BenefitCategoryMap;
import in.koreatech.koin.domain.shop.model.shop.Shop;
import io.swagger.v3.oas.annotations.media.Schema;

@JsonNaming(SnakeCaseStrategy.class)
public record AdminBenefitShopsResponse(
@Schema(example = "3", description = "상점 개수")
Integer count,
Expand All @@ -16,27 +18,36 @@ public record AdminBenefitShopsResponse(
List<InnerShopResponse> shops
) {

public static AdminBenefitShopsResponse from(List<Shop> shops) {
public static AdminBenefitShopsResponse from(List<BenefitCategoryMap> benefitCategoryMaps) {
return new AdminBenefitShopsResponse(
shops.size(),
shops.stream()
benefitCategoryMaps.size(),
benefitCategoryMaps.stream()
.map(InnerShopResponse::from)
.toList()
);
}

@JsonNaming(SnakeCaseStrategy.class)
private record InnerShopResponse(
@Schema(example = "1", description = "μƒμ ν˜œνƒ 맀핑id")
Integer shopBenefitMapId,

@Schema(example = "1", description = "고유 id")
Integer id,

@Schema(example = "μˆ˜μ‹ λ°˜μ ", description = "이름")
String name
String name,

@Schema(example = "4인 이상 ν”½μ—…μ„œλΉ„μŠ€", description = "ν˜œνƒ 미리보기 문ꡬ")
String detail
) {

public static InnerShopResponse from(Shop shop) {
public static InnerShopResponse from(BenefitCategoryMap benefitCategoryMap) {
return new InnerShopResponse(
shop.getId(),
shop.getName()
benefitCategoryMap.getId(),
benefitCategoryMap.getShop().getId(),
benefitCategoryMap.getShop().getName(),
benefitCategoryMap.getDetail()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,27 @@

import in.koreatech.koin.global.validation.NotBlankElement;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

@JsonNaming(SnakeCaseStrategy.class)
public record AdminCreateBenefitShopsRequest(
@Schema(description = "상점 ID 리슀트", example = "[1, 2, 5]", requiredMode = REQUIRED)
@NotNull(message = "상점 ID λ¦¬μŠ€νŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@NotBlankElement(message = "상점 ID λ¦¬μŠ€νŠΈλŠ” 빈 μš”μ†Œκ°€ μ‘΄μž¬ν•  수 μ—†μŠ΅λ‹ˆλ‹€.")
List<Integer> shopIds
@NotNull(message = "상점정보 λ¦¬μŠ€νŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@NotBlankElement(message = "상점정보 λ¦¬μŠ€νŠΈλŠ” 빈 μš”μ†Œκ°€ μ‘΄μž¬ν•  수 μ—†μŠ΅λ‹ˆλ‹€.")
List<InnerBenefitShopsRequest> shopDetails
) {

@JsonNaming(SnakeCaseStrategy.class)
public record InnerBenefitShopsRequest(
@Schema(description = "상점 고유 id", example = "2", requiredMode = REQUIRED)
@NotNull(message = "상점은 ν•„μˆ˜μž…λ‹ˆλ‹€.")
Integer shopId,

@Schema(description = "ν˜œνƒ 미리보기 문ꡬ", example = "4인 이상 ν”½μ—…μ„œλΉ„μŠ€", requiredMode = REQUIRED)
@NotBlank(message = "ν˜œνƒ 미리보기 λ¬Έκ΅¬λŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@Size(min = 2, max = 15, message = "ν˜œνƒ 미리보기 λ¬Έκ΅¬λŠ” μ΅œμ†Œ 2자 μ΅œλŒ€ 15μžμž…λ‹ˆλ‹€.")
String detail
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import in.koreatech.koin.domain.benefit.model.BenefitCategoryMap;
import in.koreatech.koin.domain.shop.model.shop.Shop;
import io.swagger.v3.oas.annotations.media.Schema;

public record AdminCreateBenefitShopsResponse(
@Schema(description = "상점 리슀트")
@Schema(description = "상점 정보")
List<InnerShopResponse> shops
) {
public static AdminCreateBenefitShopsResponse from(List<Shop> shops) {
public static AdminCreateBenefitShopsResponse from(List<BenefitCategoryMap> benefitCategoryMaps) {
return new AdminCreateBenefitShopsResponse(
shops.stream().map(InnerShopResponse::from).toList()
benefitCategoryMaps.stream()
.map(InnerShopResponse::from)
.toList()
);
}

Expand All @@ -23,13 +26,17 @@ private record InnerShopResponse(
Integer id,

@Schema(description = "상점 이름", example = "μˆ˜μ‹ λ°˜μ ")
String name
String name,

@Schema(example = "4인 이상 ν”½μ—…μ„œλΉ„μŠ€", description = "ν˜œνƒ 미리보기 문ꡬ")
String detail
) {

public static InnerShopResponse from(Shop shop) {
public static InnerShopResponse from(BenefitCategoryMap benefitCategoryMap) {
return new InnerShopResponse(
shop.getId(),
shop.getName()
benefitCategoryMap.getShop().getId(),
benefitCategoryMap.getShop().getName(),
benefitCategoryMap.getDetail()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package in.koreatech.koin.admin.benefit.dto;

import static com.fasterxml.jackson.databind.PropertyNamingStrategies.*;
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;

import java.util.List;

import com.fasterxml.jackson.databind.annotation.JsonNaming;

import in.koreatech.koin.global.validation.NotBlankElement;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

@JsonNaming(SnakeCaseStrategy.class)
public record AdminModifyBenefitShopsRequest(
@NotNull(message = "ν˜œνƒλ¬Έκ΅¬ 변경정보 λ¦¬μŠ€νŠΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@NotBlankElement(message = "ν˜œνƒλ¬Έκ΅¬ 변경정보 λ¦¬μŠ€νŠΈλŠ” 빈 μš”μ†Œκ°€ μ‘΄μž¬ν•  수 μ—†μŠ΅λ‹ˆλ‹€.")
List<InnerBenefitShopsRequest> modifyDetails
) {

@JsonNaming(SnakeCaseStrategy.class)
public record InnerBenefitShopsRequest(
@Schema(description = "μƒμ ν˜œνƒ 맀핑id", example = "2", requiredMode = REQUIRED)
@NotNull(message = "μƒμ ν˜œνƒ 맀핑idλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
Integer shopBenefitMapId,

@Schema(description = "ν˜œνƒ 미리보기 문ꡬ", example = "4인 이상 ν”½μ—…μ„œλΉ„μŠ€", requiredMode = REQUIRED)
@NotBlank(message = "ν˜œνƒ 미리보기 λ¬Έκ΅¬λŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")
@Size(min = 2, max = 15, message = "ν˜œνƒ 미리보기 λ¬Έκ΅¬λŠ” μ΅œμ†Œ 2자 μ΅œλŒ€ 15μžμž…λ‹ˆλ‹€.")
String detail
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package in.koreatech.koin.admin.benefit.exception;

import in.koreatech.koin.global.exception.DataNotFoundException;

public class BenefitMapNotFoundException extends DataNotFoundException {

private static final String DEFAULT_MESSAGE = "ν•΄λ‹Ή ν˜œνƒ μΉ΄ν…Œκ³ λ¦¬μ— μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” μž…λ‹ˆλ‹€.";

public BenefitMapNotFoundException(String message) {
super(message);
}

public BenefitMapNotFoundException(String message, String detail) {
super(message, detail);
}

public static BenefitMapNotFoundException withDetail(String detail) {
return new BenefitMapNotFoundException(DEFAULT_MESSAGE, detail);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.CrudRepository;

import in.koreatech.koin.domain.benefit.model.BenefitCategoryMap;
import org.springframework.data.repository.query.Param;

public interface AdminBenefitCategoryMapRepository extends Repository<BenefitCategoryMap, Integer> {
public interface AdminBenefitCategoryMapRepository extends CrudRepository<BenefitCategoryMap, Integer> {

void save(BenefitCategoryMap benefitCategoryMap);
List<BenefitCategoryMap> findAllByIdIn(List<Integer> ids);

@Query("""
SELECT bcm
Expand All @@ -22,6 +22,16 @@ public interface AdminBenefitCategoryMapRepository extends Repository<BenefitCat
""")
List<BenefitCategoryMap> findAllByBenefitCategoryIdOrderByShopName(@Param("benefitId") Integer benefitId);

@Query("""
SELECT bcm
FROM BenefitCategoryMap bcm
WHERE bcm.benefitCategory.id = :benefitId AND bcm.shop.id IN :shopIds
""")
List<BenefitCategoryMap> findAllByBenefitCategoryIdAndShopIds(
@Param("benefitId") Integer benefitId,
@Param("shopIds") List<Integer> shopIds
);

@Modifying
@Query("""
DELETE FROM BenefitCategoryMap bcm
Expand Down
Loading
Loading