Skip to content

Commit

Permalink
Refactor: create parent class for BoxCollect, BagCollect (#119)
Browse files Browse the repository at this point in the history
* refactor: create parent class for BoxCollect, BagCollect

* chore: delete unused import

* fix: get user Info from clothingSalesId

* fix: get clothingSales api

* refactor: builder pattern in dto

* fix: enable createdDate on clothingSales

* fix: register product

* fix: get ClothingSalesProductCount

* refactor: reduce query for pendingClothingSales
  • Loading branch information
hyunihs authored Aug 1, 2024
1 parent c83f9c4 commit 3528da6
Show file tree
Hide file tree
Showing 51 changed files with 515 additions and 1,066 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ClothingSalesController {

@Operation(summary = "๋ฐฑ ์ดˆ๊ธฐ ์š”์ฒญ", description = """
๋ฐฑ ์ดˆ๊ธฐ ์š”์ฒญ์„ ํ•ฉ๋‹ˆ๋‹ค.
๋ฐฑ ์ดˆ๊ธฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '๋Œ€๊ธฐ์ค‘' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
๋ฐฑ ์ดˆ๊ธฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '์‹ ์ฒญ ์™„๋ฃŒ' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
MediaType: multipart/form-data
""")
Expand All @@ -36,7 +36,7 @@ public SuccessResponse<BagInitResponse> handleBagInit(@ModelAttribute PostBagIni

@Operation(summary = "๋ฐฑ ์ˆ˜๊ฑฐ ์š”์ฒญ", description = """
๋ฐฑ ์ˆ˜๊ฑฐ ์š”์ฒญ์„ ํ•ฉ๋‹ˆ๋‹ค.
๋ฐฑ ์ˆ˜๊ฑฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '๋Œ€๊ธฐ์ค‘' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
๋ฐฑ ์ˆ˜๊ฑฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '์‹ ์ฒญ ์™„๋ฃŒ' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
MediaType: multipart/form-data
""")
Expand All @@ -47,8 +47,8 @@ public SuccessResponse<BagCollectResponse> handleRepickBagCollectionRequest(@Mod

@Operation(summary = "๋ฐ•์Šค ์ˆ˜๊ฑฐ ์š”์ฒญ", description = """
๋ฐ•์Šค ์ˆ˜๊ฑฐ ์š”์ฒญ์„ ํ•ฉ๋‹ˆ๋‹ค.
๋ฐ•์Šค ์ˆ˜๊ฑฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '๋Œ€๊ธฐ์ค‘' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
๋ฐ•์Šค ์ˆ˜๊ฑฐ ์š”์ฒญ ๋“ฑ๋ก ์‹œ '์‹ ์ฒญ ์™„๋ฃŒ' ์ƒํƒœ๋กœ ๋“ฑ๋ก๋ฉ๋‹ˆ๋‹ค.
MediaType: multipart/form-data
""")
@PostMapping(value = "/box/collection", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
Expand All @@ -58,28 +58,14 @@ public SuccessResponse<BoxCollectResponse> handleBoxCollectionRequest(@ModelAttr

@Operation(summary = "์˜ท์žฅ ์ •๋ฆฌ ํ†ตํ•ฉ ์กฐํšŒ: ์ง„ํ–‰ ์ค‘์ธ ์ˆ˜๊ฑฐ", description = """
์˜ท์žฅ ์ •๋ฆฌ ํ†ตํ•ฉ ์กฐํšŒ: ์ง„ํ–‰ ์ค‘์ธ ์ˆ˜๊ฑฐ, ์‹ ์ฒญ ์™„๋ฃŒ์ผ ์ˆœ์œผ๋กœ ์ •๋ ฌ๋˜์–ด ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
- id: ์ˆ˜๊ฑฐ ID, '๋ฐฑ ์ˆ˜๊ฑฐ ์š”์ฒญ' ์‹œ '๋ฐฑ ์š”์ฒญ ID'๋ฅผ ์กฐํšŒํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
- clothingSalesCount: ์ˆ˜๊ฑฐ ํšŒ์ฐจ(๊ฐ๊ฐ์˜ ์œ ์ €์— ๋Œ€ํ•ด ๊ณ ์œ ํ•œ ๊ฐ’์ž…๋‹ˆ๋‹ค).
- type: ๋ฐ•์Šค/๋ฐฑ
- requestDate: ์‹ ์ฒญ ์™„๋ฃŒ์ผ
- bagArriveDate: ๋ฐฑ ๋„์ฐฉ์ผ (๋ฐ•์Šค์˜ ๊ฒฝ์šฐ ํ•ญ์ƒ null)
- collectDate: ์ˆ˜๊ฑฐ ์™„๋ฃŒ์ผ
- productDate: ์ƒํ’ˆํ™” ์™„๋ฃŒ์ผ
""")
@GetMapping("/pending")
public SuccessResponse<List<GetPendingClothingSales>> getPendingClothingSales() {
return SuccessResponse.createSuccess(clothingSalesService.getPendingClothingSales());
return SuccessResponse.success(clothingSalesService.getPendingClothingSales());
}

@Operation(summary = "์˜ท์žฅ ์ •๋ฆฌ ํ†ตํ•ฉ ์กฐํšŒ: ํŒ๋งค ์ค‘์ธ ์˜ท์žฅ", description = """
์˜ท์žฅ ์ •๋ฆฌ ํ†ตํ•ฉ ์กฐํšŒ: ํŒ๋งค ์ค‘์ธ ์˜ท์žฅ, ์‹ ์ฒญ ์™„๋ฃŒ์ผ ์ˆœ์œผ๋กœ ์ •๋ ฌ๋˜์–ด ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
- id: ์ˆ˜๊ฑฐ ID
- clothingSalesCount: ์ˆ˜๊ฑฐ ํšŒ์ฐจ(๊ฐ๊ฐ์˜ ์œ ์ €์— ๋Œ€ํ•ด ๊ณ ์œ ํ•œ ๊ฐ’์ž…๋‹ˆ๋‹ค).
- clothingSalesPeriod: ์‹ ์ฒญ ์™„๋ฃŒ์ผ ~ ํŒ๋งค ์ง„ํ–‰ ์‹œ์ž‘์ผ
- sellingQuantity: ํŒ๋งค ์ค‘์ธ ์˜๋ฅ˜ ์ˆ˜๋Ÿ‰
- pendingQuantity: ๊ตฌ๋งค ํ™•์ • ๋Œ€๊ธฐ ์ˆ˜๋Ÿ‰
- soldQuantity: ํŒ๋งค ์™„๋ฃŒ ์ˆ˜๋Ÿ‰
- totalPoint: ์ด ํฌ์ธํŠธ
์˜ท์žฅ ์ •๋ฆฌ ํ†ตํ•ฉ ์กฐํšŒ: ํŒ๋งค ์ค‘์ธ ์˜ท์žฅ, ์‹ ์ฒญ ์™„๋ฃŒ์ผ ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ •๋ ฌ๋˜์–ด ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
""")
@GetMapping("/selling")
public SuccessResponse<List<GetSellingClothingSales>> getSellingClothingSales() {
Expand All @@ -92,9 +78,9 @@ public SuccessResponse<List<GetSellingClothingSales>> getSellingClothingSales()
- requestedQuantity: ์‹ ์ฒญํ•œ ์˜๋ฅ˜ ์ˆ˜๋Ÿ‰
- productQuantity: ํŒ๋งค ๊ฐ€๋Šฅํ•œ ์˜๋ฅ˜ ์ˆ˜๋Ÿ‰
""")
@GetMapping("/products/{clothingSalesCount}")
public SuccessResponse<GetProductListByClothingSales> getProductsByClothingSalesCount(@PathVariable Integer clothingSalesCount) {
return SuccessResponse.success(clothingSalesService.getProductsByClothingSalesCount(clothingSalesCount));
@GetMapping("/products/{clothingSalesId}")
public SuccessResponse<GetProductListByClothingSales> getProductsByClothingSalesId(@PathVariable Long clothingSalesId) {
return SuccessResponse.success(clothingSalesService.getProductsByClothingSalesId(clothingSalesId));
}

@Operation(summary = "์ƒํ’ˆ ๊ฐ€๊ฒฉ ์ž…๋ ฅํ•˜๊ธฐ", description = """
Expand All @@ -108,7 +94,7 @@ public SuccessResponse<GetProductListByClothingSales> getProductsByClothingSales
""")
@PatchMapping("/products/price")
public SuccessResponse<Boolean> updateProductPrice(@RequestBody List<PostProductPrice> postProductPriceList) {
return SuccessResponse.createSuccess(clothingSalesService.updateProductPrice(postProductPriceList));
return SuccessResponse.success(clothingSalesService.updateProductPrice(postProductPriceList));
}

// TODO: ADMIN ACCESS
Expand Down Expand Up @@ -136,24 +122,24 @@ public SuccessResponse<PageResponse<List<GetClothingSalesProductCount>>> getClot
}

@Operation(summary = "์œ ์ € ์ƒํ’ˆ ํ˜„ํ™ฉ")
@GetMapping("/products/{userId}/{clothingSalesCount}/{productStateType}")
public SuccessResponse<PageResponse<List<GetClothingSalesProduct>>> getClothingSalesProduct(@PathVariable Long userId,
@PathVariable Integer clothingSalesCount,
@GetMapping("/products/{clothingSalesId}/{productStateType}")
public SuccessResponse<PageResponse<List<GetClothingSalesProduct>>> getClothingSalesProduct(@PathVariable Long clothingSalesId,
@PathVariable ProductStateType productStateType,
@ParameterObject PageCondition pageCondition) {
return SuccessResponse.success(clothingSalesService.getClothingSalesProduct(userId, clothingSalesCount, productStateType, pageCondition));
return SuccessResponse.success(clothingSalesService.getClothingSalesProduct(clothingSalesId, productStateType, pageCondition));
}

@Operation(summary = "์˜ท์žฅ ์ •๋ฆฌ ์ƒํ’ˆ ๋ฌด๊ฒŒ ๋“ฑ๋ก")
@PostMapping("/weight")
public SuccessResponse<Boolean> updateClothingSalesWeight(@RequestBody PostClothingSalesWeight postClothingSalesWeight) {
return SuccessResponse.success(clothingSalesService.updateClothingSalesWeight(postClothingSalesWeight));
@PatchMapping("/weight")
public SuccessResponse<Boolean> updateClothingSalesWeight(@RequestBody PatchClothingSalesWeight patchClothingSalesWeight) {
clothingSalesService.updateClothingSalesWeight(patchClothingSalesWeight);
return SuccessResponse.success(true);
}

@Operation(summary = "์˜ท์žฅ ์ •๋ฆฌ ์œ ์ € ์ •๋ณด")
@GetMapping("/{userId}/{clothingSalesCount}")
public SuccessResponse<GetClothingSalesUser> getClothingSalesUserInfo(@PathVariable Long userId, @PathVariable Integer clothingSalesCount) {
return SuccessResponse.success(clothingSalesService.getClothingSalesUser(userId, clothingSalesCount));
@GetMapping("/{clothingSalesId}")
public SuccessResponse<GetClothingSalesUser> getClothingSalesUserInfo(@PathVariable Long clothingSalesId) {
return SuccessResponse.success(clothingSalesService.getClothingSalesUser(clothingSalesId));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public record BagCollectResponse(
@Schema(description = "์˜๋ฅ˜ ์‚ฌ์ง„ url", example = "https://repick.s3.ap-northeast-2.amazonaws.com/repick/2021/09/15/1631690136_1.jpg") String imageUrl,
@Schema(description = "๋ฐฑ ์ˆ˜๋Ÿ‰", example = "3") Integer bagQuantity,
Address address,
@Schema(description = "๋ฐฑ ์ƒํƒœ", example = "๋Œ€๊ธฐ์ค‘") String bagInitState
@Schema(description = "๋ฐฑ ์ƒํƒœ", example = "์‹ ์ฒญ ์™„๋ฃŒ") String bagCollectState
) {
public static BagCollectResponse of(BagCollect bagCollect, String bagCollectStateType) {
return new BagCollectResponse(
bagCollect.getId(),
bagCollect.getImageUrl(),
bagCollect.getBagQuantity(),
bagCollect.getQuantity(),
bagCollect.getAddress(),
bagCollectStateType
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

public record BagInitResponse(
@Schema(description = "๋ฐฑ ์ดˆ๊ธฐ ์š”์ฒญ ID", example = "1") Long bagInitId,
@Schema(description = "์˜๋ฅ˜ ์‚ฌ์ง„ url", example = "https://repick.s3.ap-northeast-2.amazonaws.com/repick/2021/09/15/1631690136_1.jpg") String imageUrl,
@Schema(description = "๋ฐฑ ์ˆ˜๋Ÿ‰", example = "3") Integer bagQuantity,
Address address,
@Schema(description = "๋ฐฑ ์ƒํƒœ", example = "๋Œ€๊ธฐ์ค‘") String bagInitState
) {
public static BagInitResponse of(BagInit bagInit, String bagInitStateType) {
return new BagInitResponse(
bagInit.getId(),
bagInit.getImageUrl(),
bagInit.getBagQuantity(),
bagInit.getAddress(),
bagInitStateType
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static BoxCollectResponse of(BoxCollect boxCollect, String boxCollectStat
return new BoxCollectResponse(
boxCollect.getId(),
boxCollect.getImageUrl(),
boxCollect.getBoxQuantity(),
boxCollect.getQuantity(),
boxCollect.getAddress(),
boxCollectStateType
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
package com.example.repick.domain.clothingSales.dto;

import com.example.repick.domain.clothingSales.entity.BagInit;
import com.example.repick.domain.clothingSales.entity.BoxCollect;
import com.example.repick.domain.clothingSales.entity.ClothingSalesStateType;
import com.example.repick.domain.product.entity.Product;
import com.example.repick.domain.clothingSales.entity.*;
import com.example.repick.domain.product.entity.ProductState;
import com.example.repick.domain.product.entity.ProductStateType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;

import java.time.format.DateTimeFormatter;
import java.util.List;

@Builder
public record GetClothingSales(
@Schema(description = "์˜ท์žฅ ์ •๋ฆฌ id (๋ฆฌํ”ฝ๋ฐฑ ๋ฐฐ์†ก ์š”์ฒญ์ธ ๊ฒฝ์šฐ ๋ฆฌํ”ฝ๋ฐฑ ๋ฐฐ์†ก ์š”์ฒญ id)") Long id,
@Schema(description = "(๋ฐฑ์ผ ๊ฒฝ์šฐ) ๋ฐฑ ๋ฐฐ์†ก ์—ฌ๋ถ€, true: ๋ฐฑ ๋ฐฐ์†ก๊นŒ์ง€ ๋‹จ๊ณ„ false: ๋ฐฑ ์ˆ˜๊ฑฐ๋ถ€ํ„ฐ") Boolean isBagDelivered,
@Schema(description = "์ฝ”๋“œ") String code,
@Schema(description = "์ด๋ฆ„") String name,
@Schema(description = "์œ ์ € ID") Long userId,
@Schema(description = "์˜ท์žฅ ์ •๋ฆฌ ํšŒ์ฐจ") Integer clothingSalesCount,
@Schema(description = "๋ฐ•์Šค ์ˆ˜๊ฑฐ ์—ฌ๋ถ€, true: ๋ฐ•์Šค ์ˆ˜๊ฑฐ false: ๋ฐฑ ์ˆ˜๊ฑฐ", example = "true") Boolean isBoxCollect,
@Schema(description = "ํ˜„ํ™ฉ") String status,
@Schema(description = "์‹ ์ฒญ์ผ") String requestDate,
@Schema(description = "(๋ฐฑ์ผ ๊ฒฝ์šฐ) ๋ฐฑ ๋ฐฐ์†ก ์—ฌ๋ถ€, true: ๋ฐฑ ๋ฐฐ์†ก๊นŒ์ง€ ๋‹จ๊ณ„ false: ๋ฐฑ ์ˆ˜๊ฑฐ๋ถ€ํ„ฐ") Boolean isBagDelivered,
@Schema(description = "์ˆ˜๊ฑฐ ์ง„ํ–‰ ์—ฌ๋ถ€") Boolean isForCollect,
@Schema(description = "์ƒํ’ˆํ™” ์‹œ์ž‘์ผ") String productStartDate,
@Schema(description = "ํŒ๋งค๊ธฐ๊ฐ„") String salesPeriod,
Expand All @@ -29,47 +27,42 @@ public record GetClothingSales(
@Schema(description = "ํŒ๋งค๋งŒ๋ฃŒ ๋ฆฌํ„ด") Boolean isExpiredAndReturned
) {

public static GetClothingSales of(BoxCollect boxCollect, List<Product> products, List<ProductState> productStates) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
return new GetClothingSales(
boxCollect.getUser().getId().toString() + "-" + boxCollect.getClothingSalesCount(),
boxCollect.getUser().getNickname(),
boxCollect.getUser().getId(),
boxCollect.getClothingSalesCount(),
true,
boxCollect.getClothingSalesState().getValue(),
boxCollect.getCreatedDate().format(formatter),
null,
boxCollect.getClothingSalesState() != ClothingSalesStateType.REQUEST_CANCELLED,
boxCollect.getClothingSalesState().getId() >= 14 ? products.get(0).getSalesStartDate().format(formatter) : null,
boxCollect.getClothingSalesState().getId() >= 14 ? products.get(0).getSalesStartDate().format(formatter)
+ " ~ " + products.get(0).getSalesStartDate().plusDays(90).format(formatter) : null,
boxCollect.getUser().getSettlementRequestDate() != null ? boxCollect.getUser().getSettlementRequestDate().format(formatter) : null,
boxCollect.getUser().getSettlementCompleteDate() != null ? boxCollect.getUser().getSettlementCompleteDate().format(formatter) : null,
boxCollect.getClothingSalesState().getId() >= 13? productStates.stream().anyMatch(productState -> productState.getProductStateType() == ProductStateType.REJECTED) : null,
boxCollect.getClothingSalesState() == ClothingSalesStateType.SELLING_EXPIRED
);
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yy");

// ์ˆ˜๊ฑฐ ์š”์ฒญ์ผ ๊ฒฝ์šฐ
public static GetClothingSales ofClothingSales(ClothingSales clothingSales, List<ProductState> productStates) {
ClothingSalesStateType clothingSalesState = clothingSales.getClothingSalesState();
boolean isBoxCollect = clothingSales instanceof BoxCollect;
boolean isProducted = ClothingSalesStateType.AFTER_PRODUCTION.contains(clothingSalesState);
boolean isSelling = ClothingSalesStateType.AFTER_SELLING.contains(clothingSalesState);

return GetClothingSales.builder()
.id(clothingSales.getId())
.isBagDelivered(isBoxCollect? null : true)
.code(clothingSales.getUser().getId().toString() + "-" + clothingSales.getClothingSalesCount())
.name(clothingSales.getUser().getNickname())
.isBoxCollect(isBoxCollect)
.status(clothingSalesState.getAdminValue())
.requestDate(clothingSales.getCreatedDate().format(formatter))
.isForCollect(clothingSalesState != ClothingSalesStateType.REQUEST_CANCELLED)
.productStartDate(isSelling? clothingSales.getProductList().get(0).getSalesStartDate().format(formatter) : null)
.salesPeriod(isSelling? clothingSales.getProductList().get(0).getSalesStartDate().format(formatter)
+ " ~ " + clothingSales.getProductList().get(0).getSalesStartDate().plusDays(90).format(formatter) : null)
.settlementRequestDate(clothingSales.getUser().getSettlementRequestDate() != null ? clothingSales.getUser().getSettlementRequestDate().format(formatter) : null)
.settlementCompleteDate(clothingSales.getUser().getSettlementCompleteDate() != null ? clothingSales.getUser().getSettlementCompleteDate().format(formatter) : null)
.isRejected(isProducted? productStates.stream().anyMatch(productState -> productState.getProductStateType() == ProductStateType.REJECTED) : null)
.isExpiredAndReturned(clothingSalesState == ClothingSalesStateType.SELLING_EXPIRED)
.build();
}

public static GetClothingSales of(BagInit bagInit, List<Product> products, List<ProductState> productStates) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
return new GetClothingSales(
bagInit.getUser().getId().toString() + "-" + bagInit.getClothingSalesCount(),
bagInit.getUser().getNickname(),
bagInit.getUser().getId(),
bagInit.getClothingSalesCount(),
false,
bagInit.getClothingSalesState() != ClothingSalesStateType.BAG_COLLECT_REQUEST? bagInit.getClothingSalesState().getValue() : "๋ฆฌํ”ฝ๋ฐฑ ๋ฐฐ์†ก ์™„๋ฃŒ",
bagInit.getCreatedDate().format(formatter),
bagInit.getBagCollect() != null,
bagInit.getClothingSalesState().getId() >= 6,
bagInit.getClothingSalesState().getId() >= 14 ? products.get(0).getSalesStartDate().format(formatter) : null,
bagInit.getClothingSalesState().getId() >= 14 ? products.get(0).getSalesStartDate().format(formatter)
+ " ~ " + products.get(0).getSalesStartDate().plusDays(90).format(formatter) : null,
bagInit.getUser().getSettlementRequestDate() != null ? bagInit.getUser().getSettlementRequestDate().format(formatter) : null,
bagInit.getUser().getSettlementCompleteDate() != null ? bagInit.getUser().getSettlementCompleteDate().format(formatter) : null,
bagInit.getClothingSalesState().getId() >= 13? productStates.stream().anyMatch(productState -> productState.getProductStateType() == ProductStateType.REJECTED) : null,
bagInit.getClothingSalesState() == ClothingSalesStateType.SELLING_EXPIRED
);
// ๋ฐฑ ๋ฐฐ์†ก ์š”์ฒญ์ผ ๊ฒฝ์šฐ
public static GetClothingSales ofBagInit(BagInit bagInit, BagInitState bagInitState) {
return GetClothingSales.builder()
.id(bagInit.getId())
.isBagDelivered(false)
.name(bagInit.getUser().getNickname())
.status(bagInitState.getBagInitStateType().getAdminValue())
.requestDate(bagInit.getCreatedDate().format(formatter))
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
package com.example.repick.domain.clothingSales.dto;

import com.example.repick.domain.clothingSales.entity.BoxCollect;
import com.example.repick.domain.clothingSales.entity.ClothingSales;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;


public record GetPendingClothingSales(
@Schema(description = "์ˆ˜๊ฑฐ ID", example = "1") Long id,
@Schema(description = "์˜ท์žฅ ์ •๋ฆฌ ํšŒ์ฐจ", example = "1") Integer clothingSalesCount,
@Schema(description = "ํƒ€์ž…(๋ฐ•์Šค/๋ฐฑ)", example = "๋ฐ•์Šค") String type,
@Schema(description = "์‹ ์ฒญ ์™„๋ฃŒ์ผ", example = "24.09.15") String requestDate,
@Schema(description = "๋ฐฑ ๋„์ฐฉ์ผ", example = "24.09.16") String bagArriveDate,
@Schema(description = "์ˆ˜๊ฑฐ ์™„๋ฃŒ์ผ", example = "24.09.17") String collectDate,
@Schema(description = "์ƒํ’ˆํ™” ์™„๋ฃŒ์ผ", example = "24.09.18") String productDate
@Schema(description = "๋ฐ•์Šค ์ˆ˜๊ฑฐ ์—ฌ๋ถ€ true: ๋ฐ•์Šค ์ˆ˜๊ฑฐ, false: ๋ฆฌํ”ฝ๋ฐฑ ์ˆ˜๊ฑฐ") boolean isBoxCollect,
@Schema(description = "์‹ ์ฒญ ์™„๋ฃŒ์ผ") LocalDateTime requestDate,
@Schema(description = "์ˆ˜๊ฑฐ ์™„๋ฃŒ์ผ") LocalDateTime collectDate,
@Schema(description = "์ƒํ’ˆ ์ดฌ์˜์ผ") LocalDateTime shootDate,
@Schema(description = "์ƒํ’ˆํ™” ์™„๋ฃŒ์ผ") LocalDateTime productDate
) {
public static GetPendingClothingSales of(Long id, Integer clothingSalesCount, String type, String requestDate, String bagArriveDate, String collectDate, String productDate) {
public static GetPendingClothingSales of(ClothingSales clothingSales, LocalDateTime requestDate, LocalDateTime collectDate, LocalDateTime shootDate, LocalDateTime productDate) {
return new GetPendingClothingSales(
id,
clothingSalesCount,
type,
clothingSales.getId(),
clothingSales.getClothingSalesCount(),
clothingSales instanceof BoxCollect,
requestDate,
bagArriveDate,
collectDate,
shootDate,
productDate
);
}
Expand Down
Loading

0 comments on commit 3528da6

Please sign in to comment.