This repository was archived by the owner on Mar 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ export class CheckoutService {
174
174
where : { id } ,
175
175
include : {
176
176
lines : {
177
+ orderBy : { createdAt : 'asc' } ,
177
178
include : {
178
179
productVariant : {
179
180
include : {
@@ -251,9 +252,9 @@ export class CheckoutService {
251
252
return checkout . lines . find ( ( line ) => line . productVariant . id === variantId ) ;
252
253
}
253
254
254
- async addOneToCheckoutLineByLineId ( lineId : string ) : Promise < boolean > {
255
+ async addOneToCheckoutLineByLineId ( id : string ) : Promise < boolean > {
255
256
await this . prisma . checkoutLine . update ( {
256
- where : { id : lineId } ,
257
+ where : { id } ,
257
258
data : {
258
259
quantity : {
259
260
increment : 1 ,
@@ -264,9 +265,9 @@ export class CheckoutService {
264
265
return true ;
265
266
}
266
267
267
- async removeOneFromCheckoutLineByLineId ( lineId : string ) : Promise < boolean > {
268
+ async removeOneFromCheckoutLineByLineId ( id : string ) : Promise < boolean > {
268
269
const updated = await this . prisma . checkoutLine . update ( {
269
- where : { id : lineId } ,
270
+ where : { id } ,
270
271
data : {
271
272
quantity : {
272
273
decrement : 1 ,
@@ -275,7 +276,7 @@ export class CheckoutService {
275
276
} ) ;
276
277
277
278
if ( updated . quantity <= 0 ) {
278
- await this . prisma . checkoutLine . delete ( { where : { id : lineId } } ) ;
279
+ await this . prisma . checkoutLine . delete ( { where : { id } } ) ;
279
280
}
280
281
281
282
return true ;
You can’t perform that action at this time.
0 commit comments