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

Feat: 냉장고 관련 API 뼈대 작성 #23

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -31,7 +31,11 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
// 다른 엔티티 관련 접근
.requestMatchers("/example/**").permitAll()
// Ingredient 관련 접근
.requestMatchers("/ingredient/**").permitAll()
.requestMatchers("/ingredient/receipt/upload", "/ingredient/receipt/classify", "/ingredient/purchased", "/ingredient/photo", "/ingredient/category").permitAll()
.requestMatchers("/ingredient/purchase-date", "/ingredient/expiry-date", "/ingredient/", "/ingredient/", "/ingredient/search/name/list", "/ingredient/search/category/list", "/ingredient/category/add").permitAll()
// Fridge 관련 접근
.requestMatchers("/fridge/ingredient/list", "/fridge/ingredient/near-expiry").permitAll()

// 기타 관련 접근
.requestMatchers("/", "/api-docs/**", "/api-docs/swagger-config/*", "/swagger-ui/*", "/swagger-ui/**", "/v3/api-docs/**").permitAll()
.anyRequest().authenticated()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.backend.DuruDuru.global.web.controller;

import com.backend.DuruDuru.global.apiPayload.ApiResponse;
import com.backend.DuruDuru.global.apiPayload.code.status.SuccessStatus;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@Validated
@CrossOrigin
@Slf4j
@RequestMapping("/fridge")
@Tag(name = "냉장고 API", description = "냉장고 관련 API입니다.")
public class FridgeController {

// 전체 식재료 리스트 조회
@PostMapping("/ingredient/list")
@Operation(summary = "등록된 전체 식재료 리스트 조회 API", description = "등록된 전체 식재료 리스트 조회 API")
public ApiResponse<?> findAllIngredients() {
return ApiResponse.onSuccess(SuccessStatus.FRIDGE_OK, null);
}

// 소비기한 임박 식재료 조회
@PostMapping("/ingredient/near-expiry")
@Operation(summary = "소비기한 임박 식재료 조회 API", description = "소비기한 임박 식재료 조회 API")
public ApiResponse<?> ingredientNearExpiry() {
return ApiResponse.onSuccess(SuccessStatus.FRIDGE_OK, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,91 +22,91 @@ public class IngredientController {
@PostMapping("/receipt/upload")
@Operation(summary = "영수증 이미지 업로드 (식재료 목록 자동 인식) API", description = "영수증 이미지 업로드 (식재료 목록 자동 인식) API")
public ApiResponse<?> receiptUpload(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 카테고리 분류 (식재료 목록 자동 인식)
@PostMapping("/receipt/classify")
@Operation(summary = "식재료 카테고리 분류 (식재료 목록 자동 인식) API", description = "식재료 카테고리 분류 (식재료 목록 자동 인식) API")
public ApiResponse<?> receiptClassify(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 구매한 식재료 목록 조회 (식재료 목록 자동 인식)
@GetMapping("/purchased")
@Operation(summary = "구매한 식재료 목록 조회 (식재료 목록 자동 인식) API", description = "구매한 식재료 목록 조회 (식재료 목록 자동 인식) API")
public ApiResponse<?> purchasedIngredientsList(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 추가할 식재료 사진 등록
@PostMapping("/photo")
@Operation(summary = "추가할 식재료 사진 등록 API", description = "추가할 식재료 사진 등록 API")
public ApiResponse<?> ingredientPhoto(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 카테고리 설정
@PostMapping("/category")
@Operation(summary = "식재료 카테고리 설정 API", description = "식재료 카테고리 설정 API")
public ApiResponse<?> ingredientCategory(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 구매 날짜 등록
@PostMapping("/purchase-date")
@Operation(summary = "식재료 구매 날짜 등록 API", description = "식재료 구매 날짜 등록 API")
public ApiResponse<?> purchaseDate(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 소비기한 등록
// 식재료 소비기한 등록 (자동 계산 포함)
@PostMapping("/expiry-date")
@Operation(summary = "식재료 소비기한 등록 API", description = "식재료 소비기한 등록 API")
public ApiResponse<?> ingredientExpiryDate(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 직접 등록
@PostMapping("/")
@Operation(summary = "식재료 직접 등록 API", description = "식재료 직접 등록 API")
public ApiResponse<?> ingredientRawAdd(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 정보 수정
@PatchMapping("/{ingredient-id}")
@Operation(summary = "식재료 정보 수정 API", description = "식재료 정보 수정 API")
public ApiResponse<?> updateIngredient(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 삭제
@DeleteMapping("/{ingredient-id}")
@Operation(summary = "식재료 삭제 API", description = "식재료 삭제 API")
public ApiResponse<?> deleteIngredient(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 이름으로 검색
@GetMapping("/search/name/list")
@Operation(summary = "식재료 이름으로 검색 API", description = "식재료 이름으로 검색 API")
public ApiResponse<?> searchIngredientByName(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 식재료 카테고리로 검색
@GetMapping("/search/category/list")
@Operation(summary = "식재료 카테고리로 검색 API", description = "식재료 카테고리로 검색 API")
public ApiResponse<?> searchIngredientByCategory(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}

// 새로운 식재료 카테고리 추가
@PostMapping("/category/add")
@Operation(summary = "새로운 식재료 카테고리 추가 API", description = "새로운 식재료 카테고리 추가 API")
public ApiResponse<?> addNewCategory(){
return ApiResponse.onSuccess(SuccessStatus.EXAMPLE_OK, null);
return ApiResponse.onSuccess(SuccessStatus.INGREDIENT_OK, null);
}


Expand Down
Loading