-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
49 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
order/src/main/java/com/yas/order/mapper/CheckoutMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.yas.order.mapper; | ||
|
||
import com.yas.order.model.Checkout; | ||
import com.yas.order.model.CheckoutItem; | ||
import com.yas.order.viewmodel.checkout.CheckoutItemPostVm; | ||
import com.yas.order.viewmodel.checkout.CheckoutItemVm; | ||
import com.yas.order.viewmodel.checkout.CheckoutPostVm; | ||
import com.yas.order.viewmodel.checkout.CheckoutVm; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Mapper(componentModel = "spring") | ||
@Component | ||
public interface CheckoutMapper { | ||
@Mapping(target = "id", ignore = true) | ||
@Mapping(target = "checkoutId", ignore = true) | ||
CheckoutItem toModel(CheckoutItemPostVm checkoutItemPostVm); | ||
|
||
@Mapping(target = "id", ignore = true) | ||
@Mapping(target = "checkoutState", ignore = true) | ||
@Mapping(target = "checkoutItem", source = "checkoutItemPostVms") | ||
Checkout toModel(CheckoutPostVm checkoutPostVm); | ||
|
||
@Mapping(target = "checkoutId", source = "checkoutId.id") | ||
CheckoutItemVm toVm(CheckoutItem checkoutItem); | ||
|
||
@Mapping(target = "checkoutItemVms", source = "checkoutItem") | ||
CheckoutVm toVm(Checkout checkout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ public record CheckoutPostVm( | |
String couponCode, | ||
@NotNull | ||
List<CheckoutItemPostVm> checkoutItemPostVms | ||
|
||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters