**What** - Implements the admin/store retrieval end point - Service implementation of the retrieve method - Service implementation of the computeLineItems method which aggregates the right line item based on the changes that are made - client - medusa-js api - medusa-react queries hooks **Tests** - Unit tests of the retrieval end points - Unit tests of the service retrieve method and computeLineItems - Integration tests for admin/store - client - medusa-js tests - medusa-react hooks tests FIXES CORE-492
31 lines
738 B
TypeScript
31 lines
738 B
TypeScript
import {
|
|
OrderEdit,
|
|
OrderEditItemChangeType,
|
|
OrderItemChange,
|
|
} from "@medusajs/medusa"
|
|
import { Connection } from "typeorm"
|
|
|
|
type OrderItemChangeData = {
|
|
id: string
|
|
type: OrderEditItemChangeType
|
|
order_edit_id: string
|
|
original_line_item_id?: string
|
|
line_item_id?: string
|
|
}
|
|
|
|
export const simpleOrderItemChangeFactory = async (
|
|
connection: Connection,
|
|
data: OrderItemChangeData
|
|
) => {
|
|
const manager = connection.manager
|
|
const change = manager.create<OrderItemChange>(OrderItemChange, {
|
|
id: data.id,
|
|
type: data.type,
|
|
order_edit_id: data.order_edit_id,
|
|
line_item_id: data.line_item_id,
|
|
original_line_item_id: data.original_line_item_id,
|
|
})
|
|
|
|
return await manager.save<OrderItemChange>(change)
|
|
}
|