Skip to content

Commit c9ced15

Browse files
chore: wip
1 parent e5b9b47 commit c9ced15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+245
-228
lines changed

app/Actions/Commerce/CouponIndexAction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { CouponRequestType } from '@stacksjs/orm'
21
import { Action } from '@stacksjs/actions'
32

43
import { coupons } from '@stacksjs/commerce'
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { CustomerRequestType } from '@stacksjs/orm'
22
import { Action } from '@stacksjs/actions'
3+
import { customers } from '@stacksjs/commerce'
4+
import { response } from '@stacksjs/router'
35

46
export default new Action({
57
name: 'Customer Destroy',
@@ -8,10 +10,8 @@ export default new Action({
810
async handle(request: CustomerRequestType) {
911
const id = request.getParam('id')
1012

11-
const model = await Customer.findOrFail(Number(id))
13+
await customers.destroy(Number(id))
1214

13-
model.delete()
14-
15-
return 'Model deleted!'
15+
return response.json({ message: 'Customer deleted successfully' })
1616
},
1717
})

app/Actions/Commerce/DeliveryRouteIndexAction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { DeliveryRouteRequestType } from '@stacksjs/orm'
21
import { Action } from '@stacksjs/actions'
32

43
import { deliveryRoutes } from '@stacksjs/commerce'

app/Actions/Commerce/GiftCardDestroyAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export default new Action({
1616

1717
return response.json({ message: 'GiftCard deleted successfully' })
1818
},
19-
})
19+
})

app/Actions/Commerce/GiftCardUpdateAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export default new Action({
1717

1818
return response.json(model)
1919
},
20-
})
20+
})
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

app/Actions/Commerce/ManufacturerIndexAction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { ManufacturerRequestType } from '@stacksjs/orm'
21
import { Action } from '@stacksjs/actions'
32

43
import { manufacturer } from '@stacksjs/commerce'
@@ -9,7 +8,7 @@ export default new Action({
98
name: 'Manufacturer Index',
109
description: 'Manufacturer Index ORM Action',
1110
method: 'GET',
12-
async handle(request: ManufacturerRequestType) {
11+
async handle() {
1312
const results = await manufacturer.fetchWithProductCount()
1413

1514
return response.json(results)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { OrderRequestType } from '@stacksjs/orm'
2+
import { Action } from '@stacksjs/actions'
3+
4+
import { orders } from '@stacksjs/commerce'
5+
6+
import { response } from '@stacksjs/router'
7+
8+
export default new Action({
9+
name: 'Order Destroy',
10+
description: 'Order Destroy ORM Action',
11+
method: 'DELETE',
12+
async handle(request: OrderRequestType) {
13+
const id = request.getParam('id')
14+
15+
await orders.destroy(Number(id))
16+
17+
return response.json({
18+
success: true,
19+
message: 'Order deleted successfully',
20+
})
21+
},
22+
})

app/Actions/Commerce/OrderIndexAction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Action } from '@stacksjs/actions'
2+
import { orders } from '@stacksjs/commerce'
3+
24
import { response } from '@stacksjs/router'
35

46
export default new Action({
57
name: 'Order Index',
68
description: 'Order Index ORM Action',
79
method: 'GET',
810
async handle() {
9-
const results = Order.all()
11+
const results = await orders.fetchAll()
1012

1113
return response.json(results)
1214
},

app/Actions/Commerce/OrderShowAction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { OrderRequestType } from '@stacksjs/orm'
22
import { Action } from '@stacksjs/actions'
33

4+
import { orders } from '@stacksjs/commerce'
5+
46
import { response } from '@stacksjs/router'
57

68
export default new Action({
@@ -10,7 +12,7 @@ export default new Action({
1012
async handle(request: OrderRequestType) {
1113
const id = request.getParam('id')
1214

13-
const model = await Order.findOrFail(Number(id))
15+
const model = await orders.fetchById(Number(id))
1416

1517
return response.json(model)
1618
},

0 commit comments

Comments
 (0)