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(cart): Line items operations #6066

Merged
merged 15 commits into from
Jan 16, 2024
13 changes: 7 additions & 6 deletions packages/cart/src/services/cart-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,11 @@ export default class CartModuleService implements ICartModuleService {
| string
| CartTypes.CreateLineItemForCartDTO[]
| CartTypes.CreateLineItemForCartDTO,
dataOrSharedContext?:
@MedusaContext()
olivermrbl marked this conversation as resolved.
Show resolved Hide resolved
dataOrSharedContext:
olivermrbl marked this conversation as resolved.
Show resolved Hide resolved
| CartTypes.CreateLineItemDTO[]
| CartTypes.CreateLineItemDTO
| Context,
| Context = {},
@MedusaContext() sharedContext: Context = {}
): Promise<CartTypes.CartLineItemDTO[] | CartTypes.CartLineItemDTO> {
let items: LineItem[] = []
Expand Down Expand Up @@ -345,12 +346,12 @@ export default class CartModuleService implements ICartModuleService {
| string
| CartTypes.UpdateLineItemWithSelectorDTO[]
| Partial<CartTypes.CartLineItemDTO>,
@MedusaContext()
olivermrbl marked this conversation as resolved.
Show resolved Hide resolved
dataOrSharedContext:
| CartTypes.UpdateLineItemDTO
| Partial<CartTypes.UpdateLineItemDTO>
| Context = {},
@MedusaContext()
sharedContext: Context = {}
@MedusaContext() sharedContext: Context = {}
): Promise<CartTypes.CartLineItemDTO[] | CartTypes.CartLineItemDTO> {
let items: LineItem[] = []
if (isString(lineItemIdOrDataOrSelector)) {
Expand All @@ -377,7 +378,7 @@ export default class CartModuleService implements ICartModuleService {
} as CartTypes.UpdateLineItemWithSelectorDTO,
]

items = await this.updateLineItemsWithSelector(
items = await this.updateLineItemsWithSelector_(
toUpdate,
dataOrSharedContext as Context
olivermrbl marked this conversation as resolved.
Show resolved Hide resolved
)
Expand Down Expand Up @@ -405,7 +406,7 @@ export default class CartModuleService implements ICartModuleService {
}

@InjectTransactionManager("baseRepository_")
protected async updateLineItemsWithSelector(
protected async updateLineItemsWithSelector_(
updates: CartTypes.UpdateLineItemWithSelectorDTO[],
@MedusaContext() sharedContext: Context = {}
): Promise<LineItem[]> {
Expand Down
Loading