File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,14 +46,15 @@ export const runBatchOperation = async <Actions extends ActionsType>(
4646 ) ;
4747
4848 const queries = actions
49- . map ( ( action , index ) => action ?. query ( params [ index ] ) )
49+ . map ( ( action , index ) => action ?. query ( ... ( params [ index ] ?? [ ] ) ) )
5050 . filter ( ( action ) => action !== undefined ) as NonEmptyArray <
5151 BatchItem < "sqlite" >
5252 > ;
5353
5454 if ( ! queries . length ) {
5555 throw Error ( "No queries provided in batch operation" ) ;
5656 }
57+
5758 const results = await db ( ) . batch ( queries ) ;
5859
5960 const mappedResults = [ ] ;
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ export const patchCartItemQuantity = async (
2828
2929 if ( finalQuantity > stock ) throw errors . PRODUCT_OUT_OF_STOCK ( stock ) ;
3030
31- const cartOperation = getCartOperation (
31+ const cartOperationType = getCartOperationType (
3232 quantity ,
3333 cartQuantity ,
3434 finalQuantity ,
3535 stock ,
3636 ) ;
3737
38- const cart = await cartOperationMap [ cartOperation ] (
38+ const cart = await cartOperationMap [ cartOperationType ] (
3939 productId ,
4040 cartId ,
4141 finalQuantity ,
@@ -44,7 +44,7 @@ export const patchCartItemQuantity = async (
4444 return extendCart ( toCartDTO ( cart ) ) ;
4545} ;
4646
47- const getCartOperation = (
47+ const getCartOperationType = (
4848 quantity : number ,
4949 cartQuantity : number ,
5050 finalQuantity : number ,
You can’t perform that action at this time.
0 commit comments