Skip to content

Commit f32cecb

Browse files
chore: wip
1 parent e781585 commit f32cecb

File tree

4 files changed

+5
-256
lines changed

4 files changed

+5
-256
lines changed

routes/api.ts

Lines changed: 0 additions & 252 deletions
Original file line numberDiff line numberDiff line change
@@ -29,258 +29,6 @@ route.get('/install', 'Actions/InstallAction')
2929
route.post('/ai/ask', 'Actions/AI/AskAction')
3030
route.post('/ai/summary', 'Actions/AI/SummaryAction')
3131

32-
route.group({ prefix: '/payments' }, async () => {
33-
route.get('/fetch-customer/{id}', 'Actions/Payment/FetchPaymentCustomerAction')
34-
route.get('/fetch-transaction-history/{id}', 'Actions/Payment/FetchTransactionHistoryAction')
35-
route.get('/fetch-user-subscriptions/{id}', 'Actions/Payment/FetchUserSubscriptionsAction')
36-
route.get('/fetch-active-subscription/{id}', 'Actions/Payment/FetchActiveSubscriptionAction')
37-
route.get('/default-payment-method/{id}', 'Actions/Payment/FetchDefaultPaymentMethodAction')
38-
route.get('/payment-methods/{id}', 'Actions/Payment/FetchPaymentMethodsAction')
39-
route.get('/create-setup-intent/{id}', 'Actions/Payment/CreateSetupIntentAction')
40-
route.delete('/delete-payment-method/{id}', 'Actions/Payment/DeleteDefaultPaymentAction')
41-
route.put('/update-default-payment-method/{id}', 'Actions/Payment/UpdateDefaultPaymentMethodAction')
42-
route.post('/set-default-payment-method/{id}', 'Actions/Payment/SetDefaultPaymentAction')
43-
route.post('/user-default-payment-method/{id}', 'Actions/Payment/SetUserDefaultPaymentAction')
44-
route.post('/payment-method/{id}', 'Actions/Payment/StorePaymentMethodAction')
45-
route.post('/create-payment-intent/{id}', 'Actions/Payment/CreatePaymentIntentAction')
46-
route.post('/create-subscription/{id}', 'Actions/Payment/CreateSubscriptionAction')
47-
route.post('/update-subscription/{id}', 'Actions/Payment/UpdateSubscriptionAction')
48-
route.post('/cancel-subscription/{id}', 'Actions/Payment/CancelSubscriptionAction')
49-
route.post('/create-invoice-subscription/{id}', 'Actions/Payment/CreateInvoiceSubscription')
50-
route.patch('/update-customer/{id}', 'Actions/Payment/UpdateCustomerAction')
51-
route.post('/checkout/{id}', 'Actions/Payment/CreateCheckoutAction')
52-
53-
route.get('/fetch-product/{id}', 'Actions/Payment/FetchProductAction')
54-
55-
route.post('/store-transaction/{id}', 'Actions/Payment/StoreTransactionAction')
56-
})
57-
58-
route.group({ prefix: '/commerce' }, async () => {
59-
route.get('/customers', 'Actions/Commerce/CustomersAction')
60-
61-
// Print Devices
62-
route.get('/print-devices', 'Actions/Commerce/PrintDeviceIndexOrmAction')
63-
route.post('/print-devices', 'Actions/Commerce/PrintDeviceStoreOrmAction')
64-
route.get('/print-devices/{id}', 'Actions/Commerce/PrintDeviceShowOrmAction')
65-
route.patch('/print-devices/{id}', 'Actions/Commerce/PrintDeviceUpdateOrmAction')
66-
route.delete('/print-devices/{id}', 'Actions/Commerce/PrintDeviceDestroyOrmAction')
67-
68-
// Product Categories
69-
route.get('/product-categories', 'Actions/Commerce/CategoryIndexOrmAction')
70-
route.post('/product-categories', 'Actions/Commerce/CategoryStoreOrmAction')
71-
route.get('/product-categories/{id}', 'Actions/Commerce/CategoryShowOrmAction')
72-
route.patch('/product-categories/{id}', 'Actions/Commerce/CategoryUpdateOrmAction')
73-
route.delete('/product-categories/{id}', 'Actions/Commerce/CategoryDestroyOrmAction')
74-
75-
// Payments
76-
route.get('/payments', 'Actions/Commerce/PaymentIndexOrmAction')
77-
route.post('/payments', 'Actions/Commerce/PaymentStoreOrmAction')
78-
route.get('/payments/{id}', 'Actions/Commerce/PaymentShowOrmAction')
79-
route.get('/payments/stats', 'Actions/Commerce/PaymentFetchStatsAction')
80-
route.get('/payments/monthly-trends', 'Actions/Commerce/PaymentMonthlyTrendsAction')
81-
82-
// Drivers
83-
route.get('/drivers', 'Actions/Commerce/DriverIndexOrmAction')
84-
route.post('/drivers', 'Actions/Commerce/DriverStoreOrmAction')
85-
route.get('/drivers/{id}', 'Actions/Commerce/DriverShowOrmAction')
86-
route.patch('/drivers/{id}', 'Actions/Commerce/DriverUpdateOrmAction')
87-
route.delete('/drivers/{id}', 'Actions/Commerce/DriverDestroyOrmAction')
88-
89-
// Waitlist Products
90-
route.get('/waitlist-products', 'Actions/Commerce/WaitlistProductIndexOrmAction')
91-
route.post('/waitlist-products', 'Actions/Commerce/WaitlistProductStoreOrmAction')
92-
route.get('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductShowOrmAction')
93-
route.patch('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductUpdateOrmAction')
94-
route.delete('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductDestroyOrmAction')
95-
route.get('/waitlist-products/analytics', 'Actions/Commerce/WaitlistProductAnalyticsAction')
96-
route.get('/waitlist-products/status-stats', 'Actions/Commerce/WaitlistProductStatusAction')
97-
route.get('/waitlist-products/quantity-distribution', 'Actions/Commerce/WaitlistProductQuantityDistributionAction')
98-
route.get('/waitlist-products/time-series', 'Actions/Commerce/WaitlistProductTimeSeriesAction')
99-
100-
// Digital Deliveries
101-
route.get('/digital-deliveries', 'Actions/Commerce/DigitalDeliveryIndexOrmAction')
102-
route.post('/digital-deliveries', 'Actions/Commerce/DigitalDeliveryStoreOrmAction')
103-
route.get('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryShowOrmAction')
104-
route.patch('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryUpdateOrmAction')
105-
route.delete('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryDestroyOrmAction')
106-
107-
// Product Manufacturers
108-
route.get('/product-manufacturers', 'Actions/Commerce/ManufacturerIndexOrmAction')
109-
route.post('/product-manufacturers', 'Actions/Commerce/ManufacturerStoreOrmAction')
110-
route.get('/product-manufacturers/{id}', 'Actions/Commerce/ManufacturerShowOrmAction')
111-
112-
// Shipping Zones
113-
route.get('/shipping-zones', 'Actions/Commerce/Shipping/ShippingZoneIndexOrmAction')
114-
route.post('/shipping-zones', 'Actions/Commerce/Shipping/ShippingZoneStoreOrmAction')
115-
route.get('/shipping-zones/{id}', 'Actions/Commerce/Shipping/ShippingZoneShowOrmAction')
116-
route.patch('/shipping-zones/{id}', 'Actions/Commerce/Shipping/ShippingZoneUpdateOrmAction')
117-
route.delete('/shipping-zones/{id}', 'Actions/Commerce/Shipping/ShippingZoneDestroyOrmAction')
118-
119-
// Customers
120-
route.get('/customers', 'Actions/Commerce/CustomerIndexOrmAction')
121-
route.post('/customers', 'Actions/Commerce/CustomerStoreOrmAction')
122-
route.get('/customers/{id}', 'Actions/Commerce/CustomerShowOrmAction')
123-
route.patch('/customers/{id}', 'Actions/Commerce/CustomerUpdateOrmAction')
124-
route.delete('/customers/{id}', 'Actions/Commerce/CustomerDestroyOrmAction')
125-
126-
// Print Logs
127-
route.get('/print-logs', 'Actions/Commerce/ReceiptIndexOrmAction')
128-
route.post('/print-logs', 'Actions/Commerce/ReceiptStoreOrmAction')
129-
route.get('/print-logs/{id}', 'Actions/Commerce/ReceiptShowOrmAction')
130-
route.patch('/print-logs/{id}', 'Actions/Commerce/ReceiptUpdateOrmAction')
131-
route.delete('/print-logs/{id}', 'Actions/Commerce/ReceiptDestroyOrmAction')
132-
133-
// Product Variants
134-
route.get('/product-variants', 'Actions/Commerce/Products/ProductVariantIndexOrmAction')
135-
route.post('/product-variants', 'Actions/Commerce/ProductVariantStoreOrmAction')
136-
route.get('/product-variants/{id}', 'Actions/Commerce/ProductVariantShowOrmAction')
137-
route.patch('/product-variants/{id}', 'Actions/Commerce/ProductVariantUpdateOrmAction')
138-
route.delete('/product-variants/{id}', 'Actions/Commerce/ProductVariantDestroyOrmAction')
139-
140-
// License Keys
141-
route.get('/license-keys', 'Actions/Commerce/Shipping/LicenseKeyIndexOrmAction')
142-
route.post('/license-keys', 'Actions/Commerce/Shipping/LicenseKeyStoreOrmAction')
143-
route.get('/license-keys/{id}', 'Actions/Commerce/Shipping/LicenseKeyShowOrmAction')
144-
route.patch('/license-keys/{id}', 'Actions/Commerce/Shipping/LicenseKeyUpdateOrmAction')
145-
route.delete('/license-keys/{id}', 'Actions/Commerce/Shipping/LicenseKeyDestroyOrmAction')
146-
147-
// Waitlist Restaurants
148-
route.get('/waitlist-restaurants', 'Actions/Commerce/WaitlistRestaurantIndexOrmAction')
149-
route.post('/waitlist-restaurants', 'Actions/Commerce/WaitlistRestaurantStoreOrmAction')
150-
route.get('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantShowOrmAction')
151-
route.patch('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantUpdateOrmAction')
152-
route.delete('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantDestroyOrmAction')
153-
route.get('/waitlist-restaurants/dashboard', 'Actions/Commerce/WaitlistRestaurantDashboardAction')
154-
155-
// Product Reviews
156-
route.get('/product-reviews', 'Actions/Commerce/Product/ReviewIndexOrmAction')
157-
route.post('/product-reviews', 'Actions/Commerce/Product/ReviewStoreOrmAction')
158-
route.get('/product-reviews/{id}', 'Actions/Commerce/Product/ReviewShowOrmAction')
159-
160-
// Product Units
161-
route.get('/product-units', 'Actions/Commerce/Product/UnitIndexOrmAction')
162-
route.post('/product-units', 'Actions/Commerce/Product/UnitStoreOrmAction')
163-
route.get('/product-units/{id}', 'Actions/Commerce/Product/UnitShowOrmAction')
164-
165-
// Gift Cards
166-
route.get('/gift-cards', 'Actions/Commerce/GiftCardIndexOrmAction')
167-
route.post('/gift-cards', 'Actions/Commerce/GiftCardStoreOrmAction')
168-
route.get('/gift-cards/{id}', 'Actions/Commerce/GiftCardShowOrmAction')
169-
route.get('/gift-cards/stats', 'Actions/Commerce/GiftCardStatsAction')
170-
route.patch('/gift-cards/{id}/balance', 'Actions/Commerce/GiftCardUpdateBalanceAction')
171-
172-
// Orders
173-
route.get('/orders', 'Actions/Commerce/OrderIndexOrmAction')
174-
route.post('/orders', 'Actions/Commerce/OrderStoreOrmAction')
175-
route.get('/orders/{id}', 'Actions/Commerce/OrderShowOrmAction')
176-
route.get('/orders/export', 'Actions/Commerce/OrderExportAction')
177-
178-
// Coupons
179-
route.get('/coupons', 'Actions/Commerce/CouponIndexOrmAction')
180-
route.post('/coupons', 'Actions/Commerce/CouponStoreOrmAction')
181-
route.get('/coupons/{id}', 'Actions/Commerce/CouponShowOrmAction')
182-
183-
// Tax Rates
184-
route.get('/tax-rates', 'Actions/Commerce/TaxRateIndexOrmAction')
185-
route.post('/tax-rates', 'Actions/Commerce/TaxRateStoreOrmAction')
186-
route.get('/tax-rates/{id}', 'Actions/Commerce/TaxRateShowOrmAction')
187-
route.patch('/tax-rates/{id}', 'Actions/Commerce/TaxRateUpdateOrmAction')
188-
route.delete('/tax-rates/{id}', 'Actions/Commerce/TaxRateDestroyOrmAction')
189-
190-
// Transactions
191-
route.get('/transactions', 'Actions/Commerce/TransactionIndexOrmAction')
192-
route.post('/transactions', 'Actions/Commerce/TransactionStoreOrmAction')
193-
route.get('/transactions/{id}', 'Actions/Commerce/TransactionShowOrmAction')
194-
195-
// Loyalty Points
196-
route.get('/loyalty-points', 'Actions/Commerce/LoyaltyPointIndexOrmAction')
197-
route.post('/loyalty-points', 'Actions/Commerce/LoyaltyPointStoreOrmAction')
198-
route.get('/loyalty-points/{id}', 'Actions/Commerce/LoyaltyPointShowOrmAction')
199-
200-
// Product Items
201-
route.get('/product-items', 'Actions/Commerce/Product/ItemIndexOrmAction')
202-
route.post('/product-items', 'Actions/Commerce/Product/ItemStoreOrmAction')
203-
route.get('/product-items/{id}', 'Actions/Commerce/Product/ItemShowOrmAction')
204-
205-
// Loyalty Rewards
206-
route.get('/loyalty-rewards', 'Actions/Commerce/LoyaltyRewardIndexOrmAction')
207-
route.post('/loyalty-rewards', 'Actions/Commerce/LoyaltyRewardStoreOrmAction')
208-
route.get('/loyalty-rewards/{id}', 'Actions/Commerce/LoyaltyRewardShowOrmAction')
209-
210-
// Shipping Methods
211-
route.get('/shipping-methods', 'Actions/Commerce/Shipping/ShippingMethodIndexOrmAction')
212-
route.post('/shipping-methods', 'Actions/Commerce/Shipping/ShippingMethodStoreOrmAction')
213-
route.get('/shipping-methods/{id}', 'Actions/Commerce/Shipping/ShippingMethodShowOrmAction')
214-
route.patch('/shipping-methods/{id}', 'Actions/Commerce/Shipping/ShippingMethodUpdateOrmAction')
215-
route.delete('/shipping-methods/{id}', 'Actions/Commerce/Shipping/ShippingMethodDestroyOrmAction')
216-
217-
// Shipping Rates
218-
route.get('/shipping-rates', 'Actions/Commerce/Shipping/ShippingRateIndexOrmAction')
219-
route.post('/shipping-rates', 'Actions/Commerce/Shipping/ShippingRateStoreOrmAction')
220-
route.get('/shipping-rates/{id}', 'Actions/Commerce/Shipping/ShippingRateShowOrmAction')
221-
route.patch('/shipping-rates/{id}', 'Actions/Commerce/Shipping/ShippingRateUpdateOrmAction')
222-
route.delete('/shipping-rates/{id}', 'Actions/Commerce/Shipping/ShippingRateDestroyOrmAction')
223-
224-
// Delivery Routes
225-
route.get('/delivery-routes', 'Actions/Commerce/Shipping/DeliveryRouteIndexOrmAction')
226-
route.post('/delivery-routes', 'Actions/Commerce/Shipping/DeliveryRouteStoreOrmAction')
227-
route.get('/delivery-routes/{id}', 'Actions/Commerce/Shipping/DeliveryRouteShowOrmAction')
228-
route.patch('/delivery-routes/{id}', 'Actions/Commerce/Shipping/DeliveryRouteUpdateOrmAction')
229-
route.delete('/delivery-routes/{id}', 'Actions/Commerce/Shipping/DeliveryRouteDestroyOrmAction')
230-
})
231-
232-
route.group({ prefix: '/cms' }, async () => {
233-
route.get('/posts', 'Actions/Cms/PostIndexAction')
234-
route.post('/posts', 'Actions/Cms/PostStoreAction')
235-
route.get('/posts/{id}', 'Actions/Cms/PostShowAction')
236-
route.patch('/posts/{id}', 'Actions/Cms/PostUpdateAction')
237-
route.delete('/posts/{id}', 'Actions/Cms/PostDestroyAction')
238-
239-
// Pages
240-
route.get('/pages', 'Actions/Cms/PageIndexAction')
241-
route.post('/pages', 'Actions/Cms/PageStoreAction')
242-
route.get('/pages/{id}', 'Actions/Cms/PageShowAction')
243-
route.patch('/pages/{id}', 'Actions/Cms/PageUpdateAction')
244-
route.delete('/pages/{id}', 'Actions/Cms/PageDestroyAction')
245-
246-
// Post Categories
247-
route.get('/categorizables', 'Actions/Cms/CategorizableIndexAction')
248-
route.post('/categorizables', 'Actions/Cms/CategorizableStoreAction')
249-
route.get('/categorizables/{id}', 'Actions/Cms/CategorizableShowAction')
250-
route.patch('/categorizables/{id}', 'Actions/Cms/CategorizableUpdateAction')
251-
route.delete('/categorizables/{id}', 'Actions/Cms/CategorizableDestroyAction')
252-
253-
// Post Tags
254-
route.get('/taggables', 'Actions/Cms/TaggableIndexAction')
255-
route.post('/taggables', 'Actions/Cms/TaggableStoreAction')
256-
route.get('/taggables/{id}', 'Actions/Cms/TaggableShowAction')
257-
route.patch('/taggables/{id}', 'Actions/Cms/TaggableUpdateAction')
258-
route.delete('/taggables/{id}', 'Actions/Cms/TaggableDestroyAction')
259-
})
260-
261-
route.group({ prefix: '/queues' }, async () => {
262-
route.get('/', 'Actions/Queue/FetchQueuesAction')
263-
})
264-
265-
route.group({ prefix: '/realtime' }, async () => {
266-
route.get('/websockets', 'Actions/Realtime/FetchWebsocketsAction')
267-
})
268-
26932
route.post('/password/send-password-reset-email', 'Actions/Password/SendPasswordResetEmailAction')
27033
route.post('/password/reset', 'Actions/Password/PasswordResetAction')
27134

272-
// route.action('/example') // equivalent to `route.get('/example', 'ExampleAction')`
273-
// route.action('Dashboard/GetProjects')
274-
// route.action('Dashboard/Settings/UpdateAiConfig')
275-
// route.job('/example-two') // equivalent to `route.get('/example-two', 'ExampleTwoJob')`
276-
277-
// Query Dashboard routes
278-
route.group({ prefix: '/queries' }, async () => {
279-
route.get('/stats', 'Controllers/QueryController@getStats')
280-
route.get('/recent', 'Controllers/QueryController@getRecentQueries')
281-
route.get('/slow', 'Controllers/QueryController@getSlowQueries')
282-
route.get('/:id', 'Controllers/QueryController@getQuery')
283-
route.get('/timeline', 'Controllers/QueryController@getQueryTimeline')
284-
route.get('/frequent', 'Controllers/QueryController@getFrequentQueries')
285-
route.post('/prune', 'Controllers/QueryController@pruneQueryLogs')
286-
})

storage/framework/core/payments/src/drivers/stripe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { config } from '@stacksjs/config'
22
import Stripe from 'stripe'
33

4-
const apiKey = config?.services?.stripe?.secretKey || 'aa'
4+
const apiKey = 'aa'
55

66
const client = new Stripe(apiKey, {
77
apiVersion: '2025-02-24.acacia',

storage/framework/core/router/src/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { UserModel } from '@stacksjs/orm'
1+
import type { AuthUser } from '@stacksjs/auth'
22
import type { AuthToken, CustomAttributes, HttpMethod, NumericField, RequestData, RequestInstance, RouteParam, RouteParams } from '@stacksjs/types'
33
import { getCurrentUser } from '@stacksjs/auth'
44
import { customValidate } from '@stacksjs/validation'
@@ -253,7 +253,7 @@ export class Request<T extends RequestData = RequestData> implements RequestInst
253253
return method.toUpperCase() as HttpMethod
254254
}
255255

256-
public async user(): Promise<UserModel | undefined> {
256+
public async user(): Promise<AuthUser | undefined> {
257257
return await getCurrentUser()
258258
}
259259
}

storage/framework/core/router/src/response.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ interface ResponseData {
88

99
export class Response implements ResponseInstance {
1010
public json(data: any, statusCode: number = 200): ResponseData {
11+
const isErrorStatus = statusCode >= 400
1112
return {
1213
status: statusCode,
1314
headers: { 'Content-Type': 'application/json' },
14-
body: JSON.stringify(data),
15+
body: JSON.stringify(isErrorStatus ? { errors: data } : { data }),
1516
}
1617
}
1718

0 commit comments

Comments
 (0)